Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Dynamic expansion of Linux root directory (solution / dev/mapper/ce)

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

First, you must make sure that other partitions have enough space to allocate to the root directory /. You can view it using the following command:

$sudo df-h

As you can see, there is still a lot of free space in the home directory, so we allocate some of the home space to the root directory.

The idea of expanding the root directory is as follows:

Back up the / home folder, delete the logical volume of the / home file system, increase the logical volume of the / file system, increase the size of the / file system, and finally create a new / home directory and restore the contents of the / home folder.

Backup / home partition content

You need to choose a partition that can hold the size of the / home folder, and you can see that the remaining space of / run is 32G, so we will back up / home under / run.

$sudo tar cvf / run/home.tar / home

Uninstall / home

To terminate all processes that use the / home file system, be careful not to do the following in the / home directory:

$sudo fuser-km / home

Then, uninstall:

$sudo umount / home

Delete the logical volume lv where / home resides:

$sudo lvremove / dev/mapper/centos-home

Select y.

Expand the logical volume where the root directory is located, and here increase by 1T:

$sudo lvextend-L + 1T / dev/mapper/centos-root

7. Expansion / file system:

$sudo xfs_growfs / dev/mapper/centos-root

Logical volumes required to rebuild the / home file system:

Since we just allocated 1.0T, the logical volume created here is 2.5T in size.

$sudo lvcreate-L 2.5T-n/dev/mapper/centos-home

9. Create a file system:

$sudo mkfs.xfs / dev/mapper/centos-home

Mount the newly created file system to the / home directory:

$sudo mount / dev/mapper/centos-home

Restore the contents of the / home directory:

$sudo tar xvf / run/home.tar-C /

Delete the backup below / run:

$sudo rm-rf / run/home.tar

-

Copyright notice: this article is the original article of CSDN blogger "shuai_wow", in accordance with the CC 4.0BY-SA copyright Agreement. Please attach the original source link and this statement for reprint.

Original link: https://blog.csdn.net/u013431916/article/details/80548069

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report