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

How to divide the home space to root under CentOS

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to separate the home space to the root under CentOS". The explanation in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to divide the home space to root under CentOS".

The following example tries to separate 5G out of 20g of home space to root space.

[root@localhost] # df-h

File system capacity used available mount point% used

/ dev/mapper/VolGroup-lv_root

75g 50g 22g 70% /

Tmpfs 3.9G 88K 3.9G 1% / dev/shm

/ dev/sda1 485M 30M 430M 7% / boot

/ dev/mapper/VolGroup-lv_home

20g 174m 19G 1% / home

[root@localhost ~] # umount / home

[root@localhost ~] # e2fsck-f/dev/mapper/VolGroup-lv_home

E2fsck 1.41.12 (17-May-2010)

Step 1: check inode, block, and size

Step 2: check the directory structure

Step 3: check directory connectivity

Pass 4: Checking reference counts

Step 5: check the cluster profile information

/ dev/mapper/VolGroup-lv_home: 158/1310720files (0.0% non-contiguous), 126581 blocks 5242880

[root@localhost ~] # resize2fs-p/dev/mapper/VolGroup-lv_home 15G

Resize2fs 1.41.12 (17-May-2010)

Resizing the filesystem on/dev/mapper/VolGroup-lv_home to 3932160 (4k) blocks.

Begin pass 3 (max = 160)

Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The filesystem on/dev/mapper/VolGroup-lv_home is now 3932160 blocks long.

[root@localhost ~] # mount / home

[root@localhost] # df-h

File system capacity used available mount point% used

/ dev/mapper/VolGroup-lv_root

75g 50g 22g 70% /

Tmpfs 3.9G 88K 3.9G 1% / dev/shm

/ dev/sda1 485M 30M 430M 7% / boot

/ dev/mapper/VolGroup-lv_home

15g 170m 14G 2% / home

[root@localhost] # lvreduce-L 15G / dev/mapper/VolGroup-lv_home

WARNING: Reducing active and open logical volume to 15.00 GiB

THIS MAY DESTROY YOUR DATA (filesystem etc.)

Do you really want to reduce lv_home? [y/n]: y

Reducing logical volume lv_home to 15.00 GiB

Logical volume lv_home successfully resized

[root@localhost ~] # vgdisplay

-Volume group

VGName VolGroup

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 7

VGAccess read/write

VGStatus resizable

MAXLV 0

CurLV 3

Open LV 3

MaxPV 0

CurPV 1

ActPV 1

VGSize 99.51 GiB

PESize 4.00 MiB

Total PE 25474

Alloc PE / Size 24194 / 94.51 GiB

Free PE / Size 1280 / 5.00 GiB

VGUUID cxzV5u-cG1f-HvPd-pE8c-eKrR-dBjN-H07k3I

[root@localhost] # lvextend-L + 5.00G/dev/mapper/VolGroup-lv_root

Extending logical volume lv_root to 80.57 GiB

Logical volume lv_root successfully resized

[root@localhost ~] # resize2fs-p/dev/mapper/VolGroup-lv_root

Resize2fs 1.41.12 (17-May-2010)

Filesystem at / dev/mapper/VolGroup-lv_rootis mounted on /; on-line resizing required

Old desc_blocks = 5, new_desc_blocks = 6

Performing an on-line resize of/dev/mapper/VolGroup-lv_root to 21121024 (4k) blocks.

The filesystem on/dev/mapper/VolGroup-lv_root is now 21121024 blocks long.

[root@localhost] # df-h

File system capacity used available mount point% used

/ dev/mapper/VolGroup-lv_root

80g 50g 27g 66% /

Tmpfs 3.9G 88K 3.9G 1% / dev/shm

/ dev/sda1 485M 30M 430M 7% / boot

/ dev/mapper/VolGroup-lv_home

15g 170m 14G 2% / home

Thank you for your reading, the above is the content of "how to separate home space to root under CentOS". After the study of this article, I believe you have a deeper understanding of how to separate home space to root under CentOS, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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