The following is a centos7
test done on the version
Use the following command to view disk usage
ls -lh
file system capacity used% mount point Devtmpfs 3.9G 0 3.9G 0%/devtmpfs 3.9G 0 3.9G 0%/dev/shmtmpfs 3.9G 2.9M 3.9G 1%/runtmpfs 3.9g 0 3.9G 0%/sys/fs/cgroup /dev/mapper/fedora-root 60G 46G 12G 8 1%/tmpfs 3.9G 400K 3.9G 1%/tm P /dev/sda1 477M 141M 307M 32%/boottmpfs 787M 0 787M 0%/run/user/0/dev/mapper/fedora-home 141G 60M 134G 1%/Home
/dev/mapper/fedora-home
The corresponding mount directory is/home
/dev/mapper/fedora-root
The corresponding mount directory is/root
From the list above /dev/mapper/fedora-home
, we can see that the catalogue is very large, but we are /dev/mapper/fedora-root
very small now, how can we move the space in the past? Use the following actions
The following steps demonstrate the space size of mobile/home 1G to/root canceling the/home directory mount
Umount-v/Home
check the disks to be transferred
E2fsck-ff /dev/mapper/fedora-home# 5 Steps for this command operation result must all be passed
The results are shown below
E2fsck 1.42.13 (17-may-20154: Checking reference counts 5th step: Check Cluster summary information /dev/mapper/fedora-home:130190/ 10838016 files (0.1% non-contiguous), 8077341/43338752 blocks
Change the/dev/mapper/fedora-home disk size
Calculation steps: 141G-Transfer 1g = 140G
Resize2fs/dev/mapper/fedora-home 140G
Cut disk space
Lvreduce-l -1g/dev/mapper/fedora-home
Re-mount Home/home
Mount-v/Home
Transfer to/root
Lvextend-l+1g/dev/mapper/fedora-root
Make/root space Effective
Resize2fs/dev/mapper/fedora-root
"Re-mount Disk space" Linux System/home disk space is re-attached to/root