New LVM
You’ve worked out how to create a new disk with OVM (honestly, it could be easier!!!) The placement of options seems non intuitive for me. Why can’t I be on my virtual machine and say “new disk”?
Highlight server pools, then goto repositories tab. Click the repository that you want to add to, choose Virtual Disks and add… (CRAZY!)
Then once this is done, goto your virtual machine, edit it and assign the disk. Ensure that the order is correct.
Boot your VM and you’ll see the new disk with fdisk –l
See what disks you are dealing with
[root@e1web2 ~]# fdisk -l
Disk /dev/xvda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 13 104391 83 Linux
/dev/xvda2 14 1305 10377990 83 Linux
/dev/xvda3 1306 1566 2096482+ 82 Linux swap / Solaris
Disk /dev/xvdb: 30.0 GB, 30000000000 bytes
255 heads, 63 sectors/track, 3647 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/xvdb doesn't contain a valid partition table
Create your physical volume
[root@e1web2 ~]# pvcreate /dev/xvdb
Create your volume group (vgu01), remember that this can be over as many physicals volumes as you like
[root@e1web2 ~]# vgcreate vgu01 /dev/xvdb
Volume group "vgu01" successfully created
Create your logical volume, remember that this can be any size from the volume group
[root@e1web2 ~]# vgdisplay
--- Volume group ---
VG Name vgu01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 27.94 GB
PE Size 4.00 MB
Total PE 7152
Alloc PE / Size 0 / 0
Free PE / Size 7152 / 27.94 GB
VG UUID 0W9kEx-CnVq-jxOp-y5AM-qRho-oU65-Fi8LlH
Create your logical volume
[root@e1web2 ~]# lvcreate -l +100%FREE vgu01
Logical volume "lvol0" created
Display logical volumes
[root@e1web2 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/vgu01/lvol0
VG Name vgu01
LV UUID 3mkbqZ-Fgmk-WuH0-2UUM-f196-E1dm-l82GDd
LV Write Access read/write
LV Status available
# open 0
LV Size 27.94 GB
Current LE 7152
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Scan volume groups
[root@e1web2 ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vgu01" using metadata type lvm2
Activate the volume group
[root@e1web2 ~]# vgchange -ay
1 logical volume(s) in volume group "vgu01" now active
Format the filesystem (ext3 in my case)
[root@e1web2 ~]# mkfs.ext3 /dev/vgu01/lvol0
Create the mount point
[root@e1web2 ~]# mkdir –p /u01
Mount the logical volume (name from lvdisplay)
[root@e1web2 /]# mount /dev/vgu01/lvol0 /u01
Add perm record in fstab
vi /etc/fstab
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-VM swap swap defaults 0 0
/dev/vgu01/lvol0 /u01 ext3 defaults 0 0
No comments:
Post a Comment