Creating disk to be used with VM for Xen:
I have a /FMW which is 1 terrabyte I want to allocate 500GB for a Virtual Disk for xen.
Below is the process I follow to create a 500 GB disk.
$[root@adcdap11 linux_vm]# cd /FMW
$[root@adcdap11 FMW]# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 1.1T 24G 1019G 3% /FMW
[root@adcdap11 FMW]#
$cd /FMW/vms/linux_vm
$[root@adcdap11 linux_vm]# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/DomUVol-Linux_vm
50G 21G 26G 45% /FMW/vms/linux_vm
Creating a 500 GB File:
Below file can be created anywhere irrespective of space counts, you should have the required space where you mount it.
$[root@adcdap11 linux_vm]# dd if=/dev/zero of=/FMW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G
1024+0 records in
1024+0 records out
1024 bytes (1.0 kB) copied, 0.002059 seconds, 497 kB/s
Creating File System Type:
$[root@adcdap11 linux_vm]# mke2fs disk2.img (i think this is not needed since we will creating a filesystem after LVM creation).
mke2fs 1.39 (29-May-2006)
disk2.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65536000 inodes, 131072000 blocks
6553600 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
4000 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, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@adcdap11 linux_vm]#
Create a dir for mounting under /FMW which is 1 terabyte.
$mkdir /FMW/xen_vm
Mounting the image to 1 Terrabyte Filesystem
$[root@adcdap11 linux_vm]# mount -o loop disk2.img /FMW/xen_vm/
Df output :
df -h will list below
[root@adcdap11 xen_vm]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.7G 5.7G 3.5G 63% /
/dev/sda1 190M 45M 136M 25% /boot
/dev/sdb1 1.1T 24G 1019G 3% /FMW
tmpfs 257M 0 257M 0% /dev/shm
/dev/mapper/DomUVol-Linux_vm
50G 29G 18G 62% /FMW/vms/linux_vm
/FMW/vms/linux_vm/disk2.img
493G 70M 468G 1% /FMW/xen_vm
[root@adcdap11 xen_vm]#
/FMW/vms/linux_vm/disk2.img
493G 70M 468G 1% /FMW/xen_vm
Now to be recognised by LVM Partition should be /dev/...
[root@adcdap11 ~]# losetup -f /FMW/vms/linux_vm/disk2.img
[root@adcdap11 ~]# losetup -a
/dev/loop0: [fd01]:49160 (/FMW/vms/linux_vm/disk2.img)
[root@adcdap11 ~]# pvcreate /dev/loop0 (initialise disk created)
Physical volume "/dev/loop0" successfully created
[root@adcdap11 ~]# vgcreate xen-vm /dev/loop0 (create a volume group for disk)
Volume group "xen-vm" successfully created
[root@adcdap11 ~]# lvcreate -L450G -nxen_prov xen-vm (creating a logical volume with 450 gig space).
Logical volume "xen_prov" created
[root@adcdap11 ~]# lvscan (see now if it shows up)
ACTIVE '/dev/DomUVol/lvol0' [200.00 GB] inherit
ACTIVE '/dev/DomUVol/Linux_vm' [50.00 GB] inherit
ACTIVE '/dev/xen-vm/xen_prov' [450.00 GB] inherit
Now creating ext3 filesystem :
[root@adcdap11 ~]# 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
Maximum filesystem blocks=0
3600 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, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: 75/3600
I have a /FMW which is 1 terrabyte I want to allocate 500GB for a Virtual Disk for xen.
Below is the process I follow to create a 500 GB disk.
$[root@adcdap11 linux_vm]# cd /FMW
$[root@adcdap11 FMW]# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 1.1T 24G 1019G 3% /FMW
[root@adcdap11 FMW]#
$cd /FMW/vms/linux_vm
$[root@adcdap11 linux_vm]# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/DomUVol-Linux_vm
50G 21G 26G 45% /FMW/vms/linux_vm
Creating a 500 GB File:
Below file can be created anywhere irrespective of space counts, you should have the required space where you mount it.
$[root@adcdap11 linux_vm]# dd if=/dev/zero of=/FMW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G
1024+0 records in
1024+0 records out
1024 bytes (1.0 kB) copied, 0.002059 seconds, 497 kB/s
Creating File System Type:
$[root@adcdap11 linux_vm]# mke2fs disk2.img (i think this is not needed since we will creating a filesystem after LVM creation).
mke2fs 1.39 (29-May-2006)
disk2.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65536000 inodes, 131072000 blocks
6553600 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
4000 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, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@adcdap11 linux_vm]#
Create a dir for mounting under /FMW which is 1 terabyte.
$mkdir /FMW/xen_vm
Mounting the image to 1 Terrabyte Filesystem
$[root@adcdap11 linux_vm]# mount -o loop disk2.img /FMW/xen_vm/
Df output :
df -h will list below
[root@adcdap11 xen_vm]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.7G 5.7G 3.5G 63% /
/dev/sda1 190M 45M 136M 25% /boot
/dev/sdb1 1.1T 24G 1019G 3% /FMW
tmpfs 257M 0 257M 0% /dev/shm
/dev/mapper/DomUVol-Linux_vm
50G 29G 18G 62% /FMW/vms/linux_vm
/FMW/vms/linux_vm/disk2.img
493G 70M 468G 1% /FMW/xen_vm
[root@adcdap11 xen_vm]#
/FMW/vms/linux_vm/disk2.img
493G 70M 468G 1% /FMW/xen_vm
Now to be recognised by LVM Partition should be /dev/...
[root@adcdap11 ~]# losetup -f /FMW/vms/linux_vm/disk2.img
[root@adcdap11 ~]# losetup -a
/dev/loop0: [fd01]:49160 (/FMW/vms/linux_vm/disk2.img)
[root@adcdap11 ~]# pvcreate /dev/loop0 (initialise disk created)
Physical volume "/dev/loop0" successfully created
[root@adcdap11 ~]# vgcreate xen-vm /dev/loop0 (create a volume group for disk)
Volume group "xen-vm" successfully created
[root@adcdap11 ~]# lvcreate -L450G -nxen_prov xen-vm (creating a logical volume with 450 gig space).
Logical volume "xen_prov" created
[root@adcdap11 ~]# lvscan (see now if it shows up)
ACTIVE '/dev/DomUVol/lvol0' [200.00 GB] inherit
ACTIVE '/dev/DomUVol/Linux_vm' [50.00 GB] inherit
ACTIVE '/dev/xen-vm/xen_prov' [450.00 GB] inherit
Now creating ext3 filesystem :
[root@adcdap11 ~]# 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
Maximum filesystem blocks=0
3600 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, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: 75/3600
No comments:
Post a Comment