There are some subtleties here and some issues that I need to bottom out. For example in a test I do a
Code: Select all
VDI=/var/images/VirtualBox/VDIs #
VBoxManage -nologo createhd -filename dest.vdi -size 1920 -format VDI
mkdir s sp d dp
./vdfuse -f $VDI/src.vdi s
ls -l s
then
s correctly shows up with permissions
dr-xr-x---. The reason for this is that you clearly can't create new partitions in
s by writing to it. Also the files in s (
Partition1 etc.) are not block mounted files so if you try to do a
dd if=s/EntireDisk of=d/EntireDisk bs=512 count=1, this will fail because dd will try to create a new file. However you can clone a disk structure as the following terminal extract shows:
Code: Select all
> mkdir s sp d dp
> ./vdfuse -f $VDI/source.vdi s
> ./vdfuse -f $VDI/dest.vdi d
> ls s
EntireDisk Partition1 Partition2 Partition3
> ls d
EntireDisk
>
> cat copyMBR.pl
# Note that this only copies the MBR so doesn't work for extented partitions
open INMBR, shift or die;
open OUTMBR, '+<'.shift or die;
binmode INMBR; binmode OUTMBR;
sysread INMBR,$buf,512,0;
syswrite OUTMBR,$buf,512,0;
exit;
> perl copyMBR.pl s/EntireDisk d/EntireDisk
>
># Need to unmount and remount dest.vdi to reread the partition table
>
> sudo umount d
> ./vdfuse -f dest.vdi d
> ls d
EntireDisk Partition1 Partition2 Partition3
> sudo mount s/Partition1 sp -t ext3 -o loop=/dev/loop0
> mkfs.ext3 -F d/Partition1
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
75840 inodes, 302896 blocks
15144 blocks (5.00%) reserved for the super user
First xdata block=0
Maximum filesystem blocks=310378496
10 block groups
32768 blocks per group, 32768 fragments per group
7584 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
> mkswap d/Partition2
Setting up swapspace version 1, size = 440741 kB
no label, UUID=c4470a25-0ab3-4762-b2af-1aadb1e1a1d3
> mkfs.ext3 -F d/Partition3
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
80960 inodes, 323568 blocks
16178 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
40 block groups
8192 blocks per group, 8192 fragments per group
2024 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
and I have now configured the VDI from the host! Unfortunately the next step which is to clean copy the system partition:
Code: Select all
sudo mount s/Partition1 sp -t ext3 -o loop=/dev/loop0,ro
sudo mount d/Partition1 dp -t ext3 -o loop=/dev/loop1
cd dp; sudo mkdir sys proc dev
cd ../sp; sudo cp -a $(ls | egrep -v '^sys|^proc|^lost|^dev') ../dp
usually hangs the PC in such a way that I need to reboot! I haven't bottomed this out yet, but I have posted an updated version of source and Ubuntu-x64 binary here:
http://files.ellisons.org.uk/VBox/vdfuze_TE_20.tar.gz
Upwards on onwards