Crippa Andrea

Shrink ext3 Partitions (Centos 5/RHEL 5 way)

This entry was posted by admin ( Crippa Andrea ) on 9 January 2010 at 2:47 PM and have got 442 reads . It's field under Linux and tagged , , , , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

NOTE : This article come with ABSOLUTELY NO WARRANTY about any data loss.
Rember to do a FULL BACKUP of your filesystem every time you need to expand/shrink them.

Here you are an how-to for shrink ext3 partitions.

NOTE : You can’t perform on-line shrink, so the filesystem must be unmounted. If you can unmount your filesystem, do this and go to step 2.

STEP 1
If you can’t unoumt your filesystem (eg. root filesystem), you need to boot from the installation CD, and type linux rescue at the boot prompt.

NOTE : You can select your preferred language, don’t turn up ethernet link, don’t scan for filesystem.

When you are at the prompt, simply type this commands :
lvm vgscan -v
lvm vgchange -a y

NOTE : The first command perform a scan of the LVM , trying to find the VolumeGroup, with the second command you activate it.

STEP 2:
Suppose you are about to resize the Logical Volume LogVol00 inside the Volume Group VolGroup00 for a size of 10 GigaBytes
Resize the filesystem, using this command :
e2fsck -f /dev/VolGroup00/LogVol00
resize2fs /dev/VolGroup00/LogVol00 10G

STEP 3:
If you need to retrive the space in the LVM (why not ?) , run this :
lvm lvresize /dev/VolGroup00/LogVol00 -L 10G

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
:, , , , , ,

1 Trackback or Pingback for this entry

Leave a Reply