Part1. Create partition
Сreating file 10 GB for image with the name of Ubuntu11_10Xen.img. It will be placed in the directory of the /var/lib/libvirt/images/.
# dd if=/dev/zero of=/var/lib/libvirt/images/Ubuntu11_10Xen.img bs=512k seek=20480 count=0 |
by parted add this file geometry of a hard disk that it could handle fdisk
# parted /var/lib/libvirt/images/Ubuntu11_10Xen.img GNU Parted 1.8.1 Using /var/lib/libvirt/images/Ubuntu11_10Xen.img Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel msdos (parted) quit |
# fdisk /var/lib/libvirt/images/Ubuntu11_10Xen.img last_lba(): I don't know how to handle files with mode 81a4 You must set cylinders. You can do this from the extra functions menu. Command (m for help): x Expert command (m for help): c Number of cylinders (1-1048576): 1305 Expert command (m for help): r Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1305, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): +240M Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 2 First cylinder (31-1305, default 31): Using default value 31 Last cylinder or +size or +sizeM or +sizeK (31-1305, default 1305): Using default value 1305 Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (31-1305, default 31): Using default value 31 Last cylinder or +size or +sizeM or +sizeK (31-1305, default 1305): Using default value 1305 Command (m for help): t Partition number (1-5): 5 Hex code (type L to list codes): 8e Changed system type of partition 5 to 8e (Linux LVM) Command (m for help): p Disk /var/lib/libvirt/images/Ubuntu11_10Xen.img: 0 MB, 0 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /var/lib/libvirt/images/Ubuntu11_10Xen.img1 1 30 240943+ 3 Linux /var/lib/libvirt/images/Ubuntu11_10Xen.img2 31 1305 10241437+ 5 Extended /var/lib/libvirt/images/Ubuntu11_10Xen.img5 31 1305 10241406 8e Linux LVM Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 25: Inappropriate ioctl for device. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks. |
# parted /var/lib/libvirt/images/Ubuntu11_10Xen.img GNU Parted 1.8.1 Using /var/lib/libvirt/images/Ubuntu11_10Xen.img Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mkfs 1 ext2 Warning: The existing file system will be destroyed and all data on the partition will be lost. Do you want to continue? parted: invalid token: 1 Yes/No? Yes Partition number? 1 File system? [ext2]? (parted) set 1 boot New state? [on]/off? on (parted) unit Unit? [compact]? B (parted) print Model: (file) Disk /var/lib/libvirt/images/Ubuntu11_10Xen.img: 10737418239B Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32256B 246758399B 246726144B primary ext2 boot 2 246758400B 10733990399B 10487232000B extended 5 246790656B 10733990399B 10487199744B logical lvm (parted) quit |
Part II. Create LVM
#losetup -o 246790656 /dev/loop3 /var/lib/libvirt/images/Ubuntu11_10Xen.img |
# pvcreate /dev/loop3 |
Writing physical volume data to disk "/dev/loop3"
Physical volume "/dev/loop3" successfully created
сыв
Дщтп
ваыва
Volume group "UbuPoltawer" successfully created
сыв
Дщтп
# vgcreate UbuPoltawer /dev/loop3 |
ваыва
Volume group "UbuPoltawer" successfully created
# vgdisplay |
VG Name UbuPoltawer
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 9.77 GB
PE Size 4.00 MB
Total PE 2501
Alloc PE / Size 0 / 0
Free PE / Size 2501 / 9.77 GB
VG UUID I5wyHA-07H1-6KNf-3iIH-Vw8Q-ES2m-FrLr4u
Part III. Mount new partition and ran debootstrap
# losetup -o 32256 /dev/loop4 /var/lib/libvirt/images/Ubuntu11_10Xen.img |
# vgchange -a y UbuPoltawer |
# mount -t ext3 -o defaults /dev/UbuPoltawer/root /mnt/PK # mkdir -p /mnt/PK/boot # mount -t ext2 -o defaults /dev/loop4 /mnt/PK/boot # mkdir -p /mnt/PK/usr # mount -t ext3 -o defaults /dev/UbuPoltawer/usr /mnt/PK/usr # mkdir -p /mnt/PK/var # mount -t ext3 -o defaults /dev/UbuPoltawer/var /mnt/PK/var .... # mount -t ext3 -o defaults /dev/UbuPoltawer/tmp /mnt/PK/tmp .... # mount -t ext3 -o defaults /dev/UbuPoltawer/home /mnt/PK/home |
# debootstrap --arch amd64 oneiric /mnt/PK ftp://ubuntu-mirror.telesys.org.ua/ubuntu |
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on ftp://ubuntu-mirror.telesys.org.ua/ubuntu...
I: Retrieving adduser
I: Validating adduser
I: Retrieving apt
I: Validating apt
I: Retrieving apt-utils
I: Validating apt-utils
I: Retrieving base-files
.....
.....
I: Base system installed successfully.
Немає коментарів:
Дописати коментар