Loop

Create disk in file

    • dd if=/dev/zero of=myVirtualDisk bs=1024 count=30720 to create a 30MB disk file (zero-filled) called virtualfs in the root (/) directory

    • mkfs.ext3 myVirtualDisk

    • mkdir mountPoint

    • mount -o loop myVirtualDisk mountPoint

Convert disk image to VMWARE disk

    • qemu-img convert -f raw myVirtualDisk -O vmdk myVirtualDisk.vmdk

Crypt virtual disk

    • sudo losetup /dev/loop0 myVirtualDisk

    • sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/loop0

    • sudo cryptsetup luksOpen /dev/loop0 myCryptedDisk

    • sudo dmsetup ls

    • sudo mkfs.ext3 -j /dev/mapper/myCryptedDisk

test GRUB in QEMU

sudo dd if=/dev/zero of=disk.img bs=1024 count=1048576 sudo parted disk.img mklabel msdos sudo parted disk.img mkpart primary ext2 0 954 sudo parted disk.img mkpart extended 954 1069 sudo parted disk.img mkpart logical linux-swap 954 1069 sudo parted disk.img set 1 boot on sudo parted disk.img mkfs 1 ext2 sudo mkdir mnt sudo mount -o loop,offset=16384 -t ext2 disk.img mnt sudo mkdir mnt/grub sudo cp /boot/grub/stage1 mnt/grub sudo cp /boot/grub/stage2 mnt/grub sudo cp /boot/grub/e2fs_stage1_5 mnt/grub sudo echo "device (hd0) disk.img" > grub.input sudo echo "root (hd0,0)">> grub.input sudo echo "setup (hd0)">> grub.input sudo echo "quit">> grub.input sudo grub --device-map=/dev/null < grub.input sudo rm grub.input sudo echo "splashimage /boot/grub/parkeon.xpm.gz" >> mnt/grub/menu.lst sudo cp parkeon.xpm.gz mnt/grub/