Get the App
SLTechnology News&Howtos  ›  Servers  › 

The implementation method of redistributing Partition size in CentOS7

Shulou Source: shulou.com Published: 2022-06-02 03:57:36 10月29日 Update

Yesterday, I installed a system for people who forgot to skip the automatic partition. The size of the automatic partition is very speechless and not suitable for daily use.

Execute command: df-h

You can see that the system automatically allocates all the remaining space under the home partition, but we generally use the space under the root partition, so we have to move more space under the home to the root.

First you need to back up the contents of the home folder, execute the command: cp-r / home/ homebak/ (if the new system does not create another account, you do not have to back up)

Uninstall ​ home: umount / home (if there is a process in home, use fuser-m-v-I-k / home to terminate the process under home, and finally use umount / home to uninstall / home)

Delete home sector: lvremove / dev/mapper/centos-home

Add 100g to the sector where the root is located: lvextend-L + 100G / dev/mapper/centos-root

Extended root file system: xfs_growfs / dev/mapper/centos-root

Re-create home lv: lvcreate-L 64g-n home centos (64g here is the original minus the removed space, not randomly filled)

Create a file system: mkfs.xfs / dev/centos/home

Mount home: mount / dev/centos/home / home

Cp the backup back to home and delete the backup.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Tags: System backup space file content command process size allocation thing that is account location folder if speechless remaining learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Xiaomi NVidia Apple MySQL