Centos 6 / 7 system, adjust the home partition and expand the root partition

Centos 6 / 7 system, adjust the home partition and expand the root partition

Sometimes, when installing the CentOS system, the default partition is used. In fact, the home partition is rarely used when building a website, so the home space is adjusted to the root.

Under SSH (centos 7 64-bit system):
1. Check the partition status:

 df -h


2. Unmount /home

 fuser -km /home/ umount /home


3. Delete the lv where /home is located

 lvremove /dev/mapper/centos-home


4. Expand the lv where /root is located and increase 800G

 lvextend -L +870G /dev/mapper/centos-root


5. Expand the /root file system

 xfs_growfs /dev/mapper/centos-root

Centos 6 uses the following command:

 resize2fs /dev/mapper/centos-root

6. Recreate the home lv

 lvcreate -L 3G -n /dev/mapper/centos-home

  1. Creating a file system

     mkfs.xfs /dev/mapper/centos-home


8. Mount home

 mount /dev/mapper/centos-home


9. Finally, check if it is successful:

 df -h

<<:  Hostodo: $15/year/512MB memory/15GB space/1TB traffic/KVM/Los Angeles/Dallas

>>:  NyaVM: $4/month/512MB memory/5GB space/2TB traffic/KVM/San Jose C3

Recommend

Spartan Host: $45/month/X3470/24GB memory/1TB space/10TB traffic/Dallas/Seattle

Spartan Host, introduced many times, is a stable ...

CrownCloud: $5/month/2GB memory/30GB SSD space/3TB traffic/KVM/Los Angeles

CrownCloud, a US hosting provider, has been opera...

Lokad: 1GB of free FTP space

Lokad is a French hosting company that provides c...

$4.95/month/5G space/100G traffic/support Alipay: Sugarhosts

Introduction to Sugarhosts Sugarhosts is a Britis...

NatcoWeb: $5/month/1GB RAM/25GB storage/1TB traffic/OpenVZ/New York

NatcoWeb, an American hosting provider, provides ...

HiFormance: 25% off all VPS, including special packages

HiFormance, an American hosting company, has been...