Monday, May 9, 2011

How To Create Linux LVM

Create Linux LVM

  1. Login with root user ID and try to avoid using sudo command for simplicity reason.
     
  2. fdisk /dev/hdb

    At the Linux fdisk command prompt,
    1. press n to create a new disk partition,
    2. press p to create a primary disk partition,
    3. press 1 to denote it as 1st disk partition,
    4. press ENTER twice to accept the default of 1st and last cylinder – to convert the whole secondary hard disk to a single disk partition,
    5. press t (will automatically select the only partition – partition 1) to change the default Linux partition type (0×83) to LVM partition type (0x8e),
    6. press L to list all the currently supported partition type,
    7. press 8e (as per the L listing) to change partition 1 to 8e, i.e. Linux LVM partition type,
    8. press p to display the secondary hard disk partition setup. Please take note that the first partition is denoted as /dev/hdb1 in Linux,
    9. press w to write the partition table and exit fdisk upon completion.

     
  3. pvcreate /dev/hdb1 
  4. vgcreate -s 1024M vg0 /dev/hdb1
  5. lvcreate -L 1024M -n lvol0 vg0 or lvcreate -l 100%FREE -n MWLV MWVG
  6. mkfs -t ext3 -v /dev/vg0/lvol0 
  7. mkdir /apps
  8. mount -t ext3 /dev/vg0/lvol0 /mnt/vfs
  9. change /etc/fstab to mount the file system automatically
  10. df -h

No comments:

Post a Comment