centos root expansion, home directory reduce the capacity

reference:

https://blog.csdn.net/evandeng2009/article/details/49814097

 

The main command:

CD 15/ 
16 LL 
. 17 mkdir Backup 
18 is LL 
20 is -R & lt CP / home / * / Backup / # backup / home directory to / Backup 
21 is CD / home / 
22 is LL 
26 is CD / 
27 CD Backup / 
30 LL 
31 is CD / 
32 LL 
umount 33 is / home 
34 is W 
35 reboot 
36 W 
37 [umount / home associated with this unloading # / home mount 
38 is -H DF 
39 the lvremove / dev / CentOS / home delete the logical volume # Home 
40 # See the vgdisplay volume group free space 
41 lvcreate -L 200G -n home centos # -L represents the size of the default unit is M; -n represents a volume name; CentOS7 CentOS here is the installation of the system on the established default volume group 
42 lvdisplay # logical view Home 
43 is the vgdisplay 
44 df -h 
45 vgchange -ay centos # optional steps of: activating the volume group centos, such that the entry into force of the new home logical
46 mkfs -t xfs / dev / centos / home # xfs file system on the establishment of the new home logical 
file before 47 mount / dev / centos / home / home / # this new logical volume linked to the home folder / home in go directly to mount also restart with fstab line 
48 DF -H 
49 -R & lt CP / Backup / * / home / # copy then copied back out before something new / home in 
50 CD / home / 
53 is LL 
54 is CD / 
55 LL 
56 the lvextend -L + 200G / dev / CentOS / root # to release the extra space allocated to the root volume; + sign indicates that the additional basis of the original, do not add the specific amount set is good, the rest slag slag that point it idle space 
57 is -H DF 
58 the lvdisplay 
59 -ay the vgchange CentOS 
60 -H DF   
61 is xfs_growfs / dev / CentOS / # root root volume expansion, xfs_growfs extended file system. Do not use xfs_growfs extended file system, the disk is not know much space 
62 df -h # Look at the size of the root is already in force, the more than 200 G

  

Guess you like

Origin www.cnblogs.com/andy9468/p/11041619.html