标签:
在VMware中添加一块新的5G硬盘
显示当前分区
# fdisk -l
通常在你在虚拟机中添加一块新硬盘时,你可能会看到新硬盘没有自动加载。这是因为连接到硬盘的SCSI总线需要重新扫描来使得新硬盘可见。
这里有一个简单的命令来重新扫描SCSI总线和SCSI设备。
确定主机总线号
# ls /sys/class/scsi_host/
host0 host11 host14 host17 host2 host22 host25 host28 host30 host4 host7
host1 host12 host15 host18 host20 host23 host26 host29 host31 host5 host8
host10 host13 host16 host19 host21 host24 host27 host3 host32 host6 host9
重新扫描SCSI总线来添加设备
# for i in $(ls /sys/class/scsi_host/); do echo "- - -" > /sys/class/scsi_host/$i/scan; done
重新显示分区。这时候发现新硬盘已经自动加载了。
# fdisk -l
... Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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
显示文件系统,可以看到根分区的VG是rhel,VL是root,分区类型是xfs
# df -hT
Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/rhel-root xfs 4.0G 1.8G 2.3G 45% / devtmpfs devtmpfs 227M 0 227M 0% /dev tmpfs tmpfs 237M 0 237M 0% /dev/shm tmpfs tmpfs 237M 8.5M 229M 4% /run tmpfs tmpfs 237M 0 237M 0% /sys/fs/cgroup /dev/sda1 xfs 497M 168M 329M 34% /boot tmpfs tmpfs 48M 0 48M 0% /run/user/0
将/dev/sda2建立为pv
# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
由于系统已经有了VG:rhel,这里直接将新建的pv加入到这个VG
# vgextend rhel /dev/sdb
Volume group "rhel" successfully extended
给VL:root增加5G的空间
# lvextend -L +5G /dev/rhel/root
Size of logical volume rhel/root changed from 3.97 GiB (1016 extents) to 8.97 GiB (2296 extents). Logical volume root successfully resized.
给VL:root增加剩余的空间
# lvextend -l +100%FREE /dev/rhel/root
Size of logical volume rhel/root changed from 8.97 GiB (2296 extents) to 9.00 GiB (2305 extents). Logical volume root successfully resized.
LV扩容之后需要激活修改的配置
# xfs_growfs /dev/rhel/root
meta-data=/dev/mapper/rhel-root isize=256 agcount=4, agsize=260096 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 finobt=0 data = bsize=4096 blocks=1040384, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 1040384 to 2360320
重新显示文件系统,可以看到根分区大小从4G增加到了9G
# df -hT
Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/rhel-root xfs 9.0G 1.8G 7.3G 20% / devtmpfs devtmpfs 227M 0 227M 0% /dev tmpfs tmpfs 237M 0 237M 0% /dev/shm tmpfs tmpfs 237M 8.5M 229M 4% /run tmpfs tmpfs 237M 0 237M 0% /sys/fs/cgroup /dev/sda1 xfs 497M 168M 329M 34% /boot tmpfs tmpfs 48M 0 48M 0% /run/user/0
标签:
原文地址:http://www.cnblogs.com/edward2013/p/5082972.html