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





print: 
Recent comments
1 hour 53 min ago
3 hours 36 min ago
6 hours 1 min ago
6 hours 7 min ago
10 hours 41 min ago
12 hours 42 min ago
16 hours 6 min ago
18 hours 12 min ago
18 hours 23 min ago
20 hours 49 min ago