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 linux reduces the size of LV

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

Share

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

This article is about how linux reduces the size of LV. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Determine the mount directory of lv and lv

Df-h

[root@hzwmesdb1] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/vg_hzwmesdb2-lv_root

50g 8.1g 39G 18% /

Tmpfs 16G 0 16G 0% / dev/shm

/ dev/sdy1 477M 52m 400M 12% / boot

/ dev/mapper/vg_hzwmesdb2-lv_home

210G 13G 187G 7% / home

2. Uninstall the mount directory

Umount / home

Check whether the reduction operation can be carried out.

E2fsck-f / dev/mapper/vg_hzwmesdb2-lv_home

Change the size of the system

Resize2fs / dev/mapper/vg_hzwmesdb2-lv_home 10G

Reduce the size of LV

Lvresize-L 10G / dev/mapper/vg_hzwmesdb2-lv_home

Six mount directory

Mount-a

Example:

[root@hzwmesdb1 ~] # umount / home

[root@hzwmesdb1] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/vg_hzwmesdb2-lv_root

50g 8.1g 39G 18% /

Tmpfs 16G 0 16G 0% / dev/shm

/ dev/sdy1 477M 52m 400M 12% / boot

[root@hzwmesdb1] # e2fsck-f / dev/mapper/vg_hzwmesdb2-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/vg_hzwmesdb2-lv_home: 7196 files 13975552 (0.1% non-contiguous), 4314765 + 55873536 blocks

[root@hzwmesdb1 ~] # resize2fs / dev/mapper/vg_hzwmesdb2-lv_home 50G

Resize2fs 1.41.12 (17-May-2010)

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

The filesystem on / dev/mapper/vg_hzwmesdb2-lv_home is now 13107200 blocks long.

[root@hzwmesdb1] # lvresize-L 50G / dev/mapper/vg_hzwmesdb2-lv_home

WARNING: Reducing active logical volume to 50.00 GiB.

THIS MAY DESTROY YOUR DATA (filesystem etc.)

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

Size of logical volume vg_hzwmesdb2/lv_home changed from 213.14 GiB (54564 extents) to 50.00 GiB (12800 extents).

Logical volume lv_home successfully resized.

[root@hzwmesdb1] # mount-a

[root@hzwmesdb1] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/vg_hzwmesdb2-lv_root

50g 8.1g 39G 18% /

Tmpfs 16G 0 16G 0% / dev/shm

/ dev/sdy1 477M 52m 400M 12% / boot

/ dev/mapper/vg_hzwmesdb2-lv_home

50g 13G 34G 28% / home

Thank you for reading! This is the end of the article on "how to reduce the size of linux LV". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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