+ -

Pages

Monday, September 2, 2013

LOGICAL VOLUME MANAGER

http://vishalthakur.com

Creating Logical Volumes

Step 1. Create a physical volume.

Use this cmd to create a physical volume: pvcreate
Example:
# pvcreate /dev/sdb2
  Physical volume "/dev/sdb2" successfully created

Step 2. Create a Logical Volume Group.

Example:
# vgcreate my_grp /dev/sdb2
  Volume group "my_grp" successfully created

Step 3. Create a Logical Volume:

Example:
# lvcreate -n my_vol -l 100%FREE my_grp
  Logical volume "my_vol" created

Step 4. Create a filesystem on the newly created Logical Volume:

First check if it has been created successfully by running this command –
# lvs
  LV     VG     Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  my_vol my_grp -wi-a---- 10.21g 
Now that you’ve confirmed that, create a file system on it:
# mkfs.ext3 /dev/my_grp/my_vol
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
670432 inodes, 2677760 blocks
133888 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2743074816
82 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
               32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

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

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

Step 5. Now you can go ahead and mount the system:

Example:
# mount /dev/my_grp/my_vol /kvm
Check if it has been mounted:
# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3             16274852  10021100   5427028  65% /
tmpfs                   959328       228    959100   1% /dev/shm
/dev/sda1               297485     37250    244875  14% /boot
/dev/sda4             41280908   4004924  35179036  11% /kvm
/dev/sdb1             10088520    153596   9422456   2% /kvm2
/dev/sr0                989180    989180         0 100% /media/Oracle_Solaris-11_1-Live-X86
/dev/mapper/my_grp-my_vol                      10542696    157348   9849796   2% /kvm

Step 6. If you want to give a name to the new volume, do this:

# tune2fs -L logical_vol /dev/my_grp/my_vol
tune2fs 1.41.12 (17-May-2010)
Check if the label has been applied:
# dumpe2fs /dev/my_grp/my_vol | less
Filesystem volume name:   logical_vol
All done!
5 RakshaTec: LOGICAL VOLUME MANAGER http://vishalthakur.com Creating Logical Volumes Step 1. Create a physical volume. Use this cmd to create a physical volume: pvcreate...

No comments:

Post a Comment

< >