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

CorgiTech 2GB RAM SSD Hard Drive VMware Japan Simple Review

Introduction: CorgiTech: $7/month/1GB memory/30GB...

Psychz: $79/month/12GB RAM/500GB hard drive/30TB traffic/29 IP/Los Angeles

Psychz, an American hosting provider, has its own...

RamNode: $5.25/month/15GB SSD space/unlimited traffic/Atlanta/Netherlands

RamNode, vps is quite stable and the price is fir...

Baidu Netdisk Super Membership 188 yuan

For the 7th anniversary event, super membership i...

HiFormance: OpenVZ VPS Special Offers

HiFormance and OpenVZ VPS have been making headli...

Incloudibly: $8/month/2GB RAM/40GB storage/3TB bandwidth/VMware/Switzerland

Incloudibly is a Swiss hosting provider founded i...