3

I'm trying to shrink the size of Logical Volume

--- Logical volume ---
LV Name                /dev/vg_linuxph53/lv_home
VG Name                vg_linuxph53
LV UUID                bWrIb2-ek2G-2G3Y-a6kA-8nnB-8fM4-6OenbJ
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                55.12 GiB
Current LE             1764
Segments               2
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:2

so I tried to unmount it first

[root@linxuph53 sites]# umount /home
umount: /home: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@linxuph53 sites]# 

as outlined this article, but it didn't work. What should I do?

Also it seems that on FC14 I don't have e2fsadm utility installed.

1

1 Answer 1

4

It is almost certain that you have to umount the filesystem first; almost no filesystem allows online shrinking (btrfs however requires that the filesystem is mounted, and it takes the active mount point as argument: btrfs filesystem resize -Xg /mnt/point, with X somem number of gigabytes).

To figure out what's using the mount, simply try "lsof /home" to list the processes keeping it open. Stop those processes and you should get a clean umount.

Next, you'll have to shrink the filesystem. Depending on the fs you use, this may or may not be doable. If you're using ext2/3/4, you can do it using the "resize2fs" tool (it will require a fsck first). This tool allows you to specify the desired size in a human friendly manner, such as "20G". I'd recommend you to size the fs a bit smaller than you want, so you can size it up after shrinking the volume. Read on.

After the file system is shrunk, you can finally size down the logical volume using "lvreduce". You'll have to do something like

# lvreduce -L20G /dev/vg_linuxph53/lv_home

You can also specify a relative size like "-10G" to shrink the volume by 10G.

If you've now sized the fs quite a bit smaller than the target size, so you're confident that the volume does not cut it off anywhere, then you can up the size of the fs again. Do this using resize2fs or another fs-specific tool. Check the man page of the tool for details. resize2fs will expand to the size of the volume if no size is specified.

1
  • Ntfs does support online shrinking.
    – longneck
    Aug 17, 2012 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .