centos 磁盘挂载

首先通过fdisk -l发现新挂的磁盘,假设为 /dev/sdb

 

[root@centos1 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a37c8

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@centos1 ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
[root@centos1 ~]# vgcreate data01 /dev/sdb
Volume group "data01" successfully created
[root@centos1 ~]# lvcreate data01 -n data -l 100%VG
Logical volume "data" created.
[root@centos1 ~]# mkfs -t xfs /dev/mapper/data01-data
meta-data=/dev/mapper/data01-data isize=512 agcount=4, agsize=1310464 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=5241856, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@centos1 ~]# echo '/dev/mapper/data01-data /data/ xfs defaults 1 2' >> /etc/fstab
[root@centos1 ~]# ll /data
total 0
[root@centos1 ~]# cd /data
[root@centos1 data]# mount /dev/mapper/data01-data /data
[root@centos1 data]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 475M 0 475M 0% /dev
tmpfs 487M 0 487M 0% /dev/shm
tmpfs 487M 7.7M 479M 2% /run
tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/mapper/centos-root 17G 13G 4.1G 77% /
/dev/sda1 1014M 163M 852M 17% /boot
tmpfs 98M 0 98M 0% /run/user/0
/dev/mapper/data01-data 20G 33M 20G 1% /data

 

 

如果是批量的,可以用pssh

pssh -h all.ip -i "pvcreate /dev/sdb"

 

posted on 2024-05-11 02:36  jerry1111  阅读(1)  评论(0编辑  收藏  举报

导航