Monday, March 21, 2011

Reducing and Creating a New Volume on LVM

From the previous post we have added 70G free space as below by reducing
the Volume of xen-vm1:

# vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  DomUVol   1   1   0 wz--n- 267.66G   67.66G
  xen-vm1   1   1   0 wz--n- 500.00G   70.00G
  xen-vm2   1   1   0 wz--n- 498.00G 1020.00M
#

Now adding a new volume of 40G


Checking existing Volumes
# lvscan
  ACTIVE            '/dev/DomUVol/lvol0' [200.00 GB] inherit
  ACTIVE            '/dev/xen-vm2/xen_prov2' [497.00 GB] inherit
  ACTIVE            '/dev/xen-vm1/xen_prov1' [430.00 GB] inherit



Create a New volume of 40G on xen-vm1 VolumeGroup which we reduced 
on previous post:


[root@Linux ~]# lvcreate -L40G -n xen-vm3 xen-vm1
  Logical volume "xen-vm3" created

Now check the newly created Volume:


[root@Linux ~]# lvscan
  ACTIVE            '/dev/DomUVol/lvol0' [200.00 GB] inherit
  ACTIVE            '/dev/xen-vm2/xen_prov2' [497.00 GB] inherit
  ACTIVE            '/dev/xen-vm1/xen_prov1' [430.00 GB] inherit
  ACTIVE            '/dev/xen-vm1/xen-vm3' [40.00 GB] inherit

Create a Filesystem ext3 for newly added Logical Volume




[root@Linux ~]# mkfs.ext3 /dev/xen-vm1/xen-vm3

mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
5242880 inodes, 10485760 blocks
524288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
320 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Now Mounting the new file system:

[root@Linux]# ls
lost+found  vms  xen_vm1  xen_vm2  zipdb


[root@Linux]# mkdir xen_vm3

[root@Linux]# mount /dev/xen-vm1/xen-vm3 /FMW/xen_vm3


For Permanent Mount add to /etc/fstab: 


/dev/mapper/xen--vm1-xen--vm3    /FMW/xen_vm3  ext3    defaults        0 0




No comments:

Post a Comment