A Beginner's Guide To LVM - Page 4
4 Resize Logical Volumes And Their FilesystemsIn this chapter we will learn how to resize our logical volume share which has an ext3 filesystem. (I will show how to resize logical volumes with xfs and reiserfs filesystems further down this tutorial.) First we must unmount it: umount /var/share share should not be listed anymore in the df -h output: server1:~# df -h Now let's enlarge share from 40GB to 50GB: lvextend -L50G /dev/fileserver/share server1:~# lvextend -L50G /dev/fileserver/share Until now we have enlarged only share, but not the ext3 filesystem on share. This is what we do now: e2fsck -f /dev/fileserver/share server1:~# e2fsck -f /dev/fileserver/share Make a note of the total amount of blocks (10485760) because we need it when we shrink share later on. resize2fs /dev/fileserver/share server1:~# resize2fs /dev/fileserver/share Let's mount share: mount /dev/fileserver/share /var/share and in the df -h output share should now have 50GB instead of 40: server1:~# df -h Shrinking a logical volume is the other way round: first we must shrink the filesystem before we reduce the logical volume's size. Let's shrink share to 40GB again: umount /var/share df -h server1:~# df -h e2fsck -f /dev/fileserver/share server1:~# e2fsck -f /dev/fileserver/share When resizing an ext3 filesystem to a certain size (instead of all available space), resize2fs takes the number of blocks as argument (you can as well specify the new size in MB, etc. See man resize2fs for more details). From our previous operation we know the 40GB equals 10485760 blocks so we run resize2fs /dev/fileserver/share 10485760 server1:~# resize2fs /dev/fileserver/share 10485760 We've shrinked the filesystem, now we must shrink the logical volume, too: lvreduce -L40G /dev/fileserver/share server1:~# lvreduce -L40G /dev/fileserver/share We can ignore the warning that data might be destroyed because we have shrinked the filesystem before. Let's mount share again: mount /dev/fileserver/share /var/share The output of df -h should now look like this: server1:~# df -h
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com
Red Hat Virtual Experience - a free virtual event. Dec. 9th





print: 
Recent comments
7 hours 52 min ago
13 hours 40 min ago
15 hours 31 min ago
17 hours 16 min ago
21 hours 6 min ago
1 day 2 hours ago
1 day 3 hours ago
1 day 7 hours ago
1 day 12 hours ago
1 day 18 hours ago