To Create a logocal volume

  1. First log on to rails or sgd-virt for vm's
  2. >ssh admin@rails
  3. Make sure you have plenty of space
  4. >df -h
  5. Create the volume
  6. >sudo lvcreate --size 50G --name vm08 vg02
  7. Then run mkfs to make the vol usable
  8. >mkfs.ext3 /dev/mapper/vg02-vm07
    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
    786432 inodes, 3145728 blocks
    157286 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=3221225472
    96 block groups
    32768 blocks per group, 32768 fragments per group
    8192 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 34 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
  9. Now you can display the volumes on the server that you just made
  10. >lvdisplay --- Logical volume --- LV Name /dev/vg02/vm07 VG Name vg02 LV UUID V1oPhh-9Mq1-FyP5-00Ks-87A3-fesV-UFuVkJ LV Write Access read/write LV Status available # open 1 LV Size 50.00 GiB Current LE 9600 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1
  11. to remove a volume use the LV name:
  12. >lvremove /dev/vg02/vm07
    Do you really want to remove active logical volume vm03? [y/n]: y
      Logical volume "vm07" successfully removed
  13. make sure you run fsck on the new volume to check for integrity
  14. >fsck /dev/mapper/vg02/vm07
    e2fsck 1.41.12 (17-May-2010)
    /dev/mapper/vg02-vm07: clean, 11/786432 files, 89841/3145728 blocks
  15. then mount it on /vm07
  16. >mount /dev/mapper/vg02-vm07 /vm07
  17. to resize a volume: this is possible to do on a live volume
  18. >lvextend +10g /dev/vg02/vm03 ## then you need to run the mkfs.ext3 on it again and the fsck
  19. To remove a volume no longer needed
  20. >lvremove /dev/vg02-vm04