这是我的df -kh的输出
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 34G 17G 67% /
devtmpfs 2.5G 0 2.5G 0% /dev
tmpfs 2.5G 140K 2.5G 1% /dev/shm
tmpfs 2.5G 8.9M 2.5G 1% /run
tmpfs 2.5G 0 2.5G 0% /sys/fs/cgroup
/dev/sda1 497M 133M 365M 27% /boot
我想增加194 GB的大小。
我运行了lvextend -L + 194G / dev / mapper / centos-root命令,得到的消息是文件系统已调整大小。我重新启动了系统。我期望看到我的/为244GB。但是不是
卷组详细信息
[root@localhost mapper]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 249.51 GiB
PE Size 4.00 MiB
Total PE 63874
Alloc PE / Size 63648 / 248.62 GiB
Free PE / Size 226 / 904.00 MiB
VG UUID icZPDf-z0cO-5qMl-Gbtr-XisU-6ptl-cpG3dz
逻辑卷的详细信息
[root@localhost mapper]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID MzofJC-7I6W-XcM9-xwrT-Ns86-LdYt-OYltON
LV Write Access read/write
LV Creation host, time localhost, 2015-07-02 09:04:52 +1200
LV Status available
# open 2
LV Size 4.62 GiB
Current LE 1184
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID 1J50kj-hcBC-T5rY-y6LV-0xEI-ZVId-qBfgQl
LV Write Access read/write
LV Creation host, time localhost, 2015-07-02 09:04:53 +1200
LV Status available
# open 1
LV Size 244.00 GiB
Current LE 62464
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
/etc/fstab OUTPUT
#
# /etc/fstab
# Created by anaconda on Thu Jul 2 09:04:53 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=c4f605aa-56b0-4bde-ae0b-ddf6f0e4a983 /boot xfs defaults 0 0
#/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
如何扩展/ dev / mapper / centos-root?有什么帮助吗?
嗯,我没有碰到这个链接-https: //themacwrangler.wordpress.com/2015/01/16/re-sizing-partitions-in-centos7/。很有帮助。
我也必须增加文件系统,而我没有。很好的学习。
万一将来内容不可用,请在上面的链接处复制页面的内容。
Re-sizing partitions in Centos7
By default in a CentOS7 install we get a couple of partitions created for the root user and one for home usually something like this:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 2.7G 48G 6% /
devtmpfs 239M 0 239M 0% /dev
tmpfs 246M 0 246M 0% /dev/shm
tmpfs 246M 29M 217M 12% /run
tmpfs 246M 0 246M 0% /sys/fs/cgroup
/dev/mapper/centos-home 29G 33M 29G 1% /home
/dev/sda1 497M 96M 401M 20% /boot
Note that the root partition is 50Gb and the home partition is 29Gb
Often I find myself wanting or needing to remove the centos-home partition and expand the centos-root partition.
It is a pretty straight forward exercise, but one that I often forget the steps involved.
So here they are:
• First backup any data that might exist in /home so you can restore it later.
• Unmount the centos-home partition.
# umount /home/
• Next show the logical volumes.
# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID azXfXa-YPiG-Bx9x-NfIO-eswN-iHVw-YsXpYe
LV Write Access read/write
LV Creation host, time localhost, 2014-12-01 13:02:00 +1100
LV Status available
# open 2
LV Size 1.03 GiB
Current LE 264
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID LtYf7h-h1kx-p7OR-ZdN8-2Xo8-KXYT-uC2Roa
LV Write Access read/write
LV Creation host, time localhost, 2014-12-01 13:02:01 +1100
LV Status available
# open 0
LV Size 28.48 GiB
Current LE 7290
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID DjnSO6-gsbN-g83Q-VhfC-u3Ft-8DqY-sPMx35
LV Write Access read/write
LV Creation host, time localhost, 2014-12-01 13:02:03 +1100
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
•Now remove the logical volume for centos-home.
# lvremove /dev/centos/home
Do you really want to remove active logical volume home? [y/n]: y
Logical volume "home" successfully removed
•You should now have the free space available in VFree when you have a look using vgs.
# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- 79.51g 28.48g
• Now resize the centos-root partition.
# lvresize -L +28.47GB /dev/mapper/centos-root
Rounding size to boundary between physical extents: 28.47 GiB
Extending logical volume root to 78.47 GiB
Logical volume root successfully resized
Note that I expanded the partition by slightly less than the available space, 28.47Gb instead of 28.48Gb, this is just to make sure you avoid hitting an insufficient free space error.
• Grow the partition to use all the free space
#xfs_growfs /dev/mapper/centos-root
• Confirm your new partition size.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 79G 2.7G 76G 4% /
devtmpfs 239M 0 239M 0% /dev
tmpfs 246M 0 246M 0% /dev/shm
tmpfs 246M 29M 217M 12% /run
tmpfs 246M 0 246M 0% /sys/fs/cgroup
/dev/sda1 497M 96M 401M 20% /boot
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句