LVM, logical volumes size can be increased or decreased depends on our needs. Logical volume can be shirked/reduced using “lvreduce” command but this will not reduce the filesystem. You need to reduce the filesystem before reducing the logical volume. Logical volume can be extended/increased using “lvextend” command.Once you have extended the logical volume ,then you need to increase the filesystem to the see new space on the mount points.
Most of the Linux/Unix beginners will confuse with term ‘volume’ and ‘filesystem’. Volume is a raw partition like a physical disk.In a order to store data on volume,you need a filesystems on that.(Ex:ext2,ext3,ext4…etc..)
1.Extending the Logical Volume size
Logical volumes can be increased on fly without un-mounting the filesystem. Here we will see how to increase the linear filesystem and volume on Redhat Linux 6.
1.Check the volume group free space before proceeding to the volume expansion.
From the above output ,we can see volume group “uavg” has 5.89GB free space.
2.We are planning to extend volume “lvol0″ from uavg volumegroup.
2.We are planning to extend volume “lvol0″ from uavg volumegroup.
3.Extend the logical volume by 100MB.
4.Check the mountpoint “/vol1″ .The new space is not be reflected there because,Since you didn’t resize the filesystem.
5.Increase the filesystem.
6.Check the mountpoint now.
Here we will see how to reduce the volume “lvol0″ which is part of volume group “uavg” .
1.List he volume information.
2.un-mount the filesystem.
3.Reduce the filesystem by 100MB. The current filesystem size is 200MB.
Option 100MB – Final size of the volume.
5.Reduce the volume. “-L” – Final size of the volume.
Here i am giving volume final size as 104MB. So that volume may have some room and won’t touch the filesystem part.The extra 4MB can be recovered using resize2fs. Its up to you how you want to proceed.
Note:You can also give 100MB. For safer side, its better to give some extra space on the volume level.
Having good backup is recommeded before proceeding to volume resize.
6.Activate the volume and Mount it.
Hope now you are familiar with volume re-sizing operation on Logical volume manager.
4.Check the mountpoint “/vol1″ .The new space is not be reflected there because,Since you didn’t resize the filesystem.
5.Increase the filesystem.
6.Check the mountpoint now.
Wow..We have successfully increased the vol1 from 100MB to 200MB.
The same way you can increase any type of volume layouts.
The same way you can increase any type of volume layouts.
2.Reducing the Logical Volume size
Volumes can’t be reduced on the fly.To reduce the volume ,
1. umount the filesystem
2. Reduce the filesystem size
3. Reduce the logical volume
4. Mount the volume .
1. umount the filesystem
2. Reduce the filesystem size
3. Reduce the logical volume
4. Mount the volume .
Here we will see how to reduce the volume “lvol0″ which is part of volume group “uavg” .
1.List he volume information.
2.un-mount the filesystem.
3.Reduce the filesystem by 100MB. The current filesystem size is 200MB.
Option 100MB – Final size of the volume.
“resize2fs” required to check the filesystem consistency before reduce the FS.
We have successfully reduced the filesystem to 100MB.
4.De-activate the volume.
4.De-activate the volume.
5.Reduce the volume. “-L” – Final size of the volume.
Here i am giving volume final size as 104MB. So that volume may have some room and won’t touch the filesystem part.The extra 4MB can be recovered using resize2fs. Its up to you how you want to proceed.
Note:You can also give 100MB. For safer side, its better to give some extra space on the volume level.
Having good backup is recommeded before proceeding to volume resize.
6.Activate the volume and Mount it.
Hope now you are familiar with volume re-sizing operation on Logical volume manager.
No comments:
Post a Comment