Thursday, January 27, 2011

Creating Soft Partitioning in Linux

Order :
  1. Create an image file
  2. Create a loopback device for the file
  3. Run pvcreate on the loopback device
  4. Run vgcreate on the "physical" volume
  5. Run lvcreate on the volume group
  6. Create a filesystem on the logical volume
  7. Mount the logical volume



1) Create an image file
===============
#dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G

2)Create a loopback device for the file
===========================
#losetup -f /FAW/vms/linux_vm/disk2.img


# losetup -a
/dev/loop0: [fd01]:49160 (/FAW/vms/linux_vm/disk2.img)

3) Run pvcreate on the loopback device
===============================
# pvcreate /dev/loop0 (initialise disk created)
Physical volume "/dev/loop0" successfully created

4)Run vgcreate on the "physical" volume
===============================
#vgcreate xen-vm /dev/loop0
Volume group "xen-vm" successfully created

5) Run lvcreate on the volume group
============================
#lvcreate -L450G -nxen_prov xen-vm

Logical volume "xen_prov" created

6)Create a filesystem on the logical volume
===================================
#mkfs.ext3 /dev/xen-vm/xen_prov
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58982400 inodes, 117964800 blocks
5898240 blocks (5.00%) reserved for the super user
First data block=0
......................
.........................................


7) Mount the logical volume
========================

mount /dev/xen-vm/xen_prov /FMW/xen_vm


No comments:

Post a Comment