After LVM creation if we need to extended or reduce we can do that using e2fsck, lvreduce,lvextend.
First we need to create Logical Volume Manager LVM CREATION TUTORIAL.
Now the Logical Volume size is 20MB
[rhel5@bash /]# lvdisplay
--- Logical volume ---
LV Size 20.00 MB
Now I will reduce the size 20MB into 12MB
Umount the file system for which one we want to reduce
[rhel5@bash /]# umount /dev/vg1/data
then using mount command check if the partition is mounted or not.
[rhel5@bash /]#mount
if it is umount successfully (not mount) then go to next step.
Check The File System
e2fsck comman is used to check the ext2 and ext3 file system.
This command is normally used when we reduce or extended file system. it will check the inodes, directory structure,
directory connectivity, and Rerference counts.
-f it will check the filesyste with force.
[rhel5@bash /]# e2fsck -f /dev/vg1/data
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vg1/data: 11/3072 files (9.1% non-contiguous), 1531/12288 blocks
[rhel5@bash /]# resize2fs /dev/vg1/data 12M
it will enlarge or shrink the partition size
[rhel5@bash /]# lvreduce -L 12M /dev/vg1/data
WARNING: Reducing active logical volume to 12.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce data? [y/n]: y
Reducing logical volume data to 12.00 MB
Logical volume data successfully resized
Now LVM Reduce succefully.
[rhel5@bash /]# lvdisplay --- Logical volume --- LV Name /dev/vg1/data VG Name vg1 LV UUID 0Qm2tL-PH7W-uve4-oRgu-lf3X-D4jF-4qKK8F LV Write Access read/write LV Status available # open 0 LV Size 12.00 MB Current LE 3 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0
Logical Volume Manager Extended Lvextend
it is just like lvreduce.
We need to follow the same step.
[rhel5@bash /]# resize2fs /dev/vg1/data 20M
[rhel5@bash /]# lvextend -L 20M /dev/vg1/data
Extending logical volume data to 20.00 MB
Logical volume data successfully resized
[rhel5@bash /]# lvdisplay
ignore this error message
resize2fs is used to re size the file system. resize2fs
Error message " [root@localhost ~]# vgcreate vg /dev/hd10 /dev/hda11 /dev/hda12
/dev/hd10 not identified as an existing physical volume
Unable to add physical volume '/dev/hd10' to volume group 'vg'."
0 comments:
Post a Comment