0

I just have 4.6GB VDI image. I have to copy it into a FAT32 Filesystem. I cannot use VMDK format and only VDI images.

How can I split the VDI into smaller VDI chunks so I can copy it into a USB.

Hennes
  • 64,768
  • 7
  • 111
  • 168
user907810
  • 103
  • 3
  • 1
    Do you need to run it from the FAT32 FS, or just store it there (temporarily)? If it's just storage, you could use any number of archive formats that support splitting. Also, why can't you use VMDK? That's the de facto standard way of running from a split image. – Bob Sep 04 '13 at 12:54
  • What is a reason for using FAT32? – week Sep 04 '13 at 12:55
  • http://superuser.com/questions/334254/is-it-possible-to-split-virtualbox-hard-drive-to-multiple-volumes may help you – BlueBerry - Vignesh4303 Sep 04 '13 at 12:56
  • 1
    @Vignesh4303 Unfortunately, that question's answers all recommend VMDK. Which is why I'm asking why that restriction exists. It's possible that VDI images simply *cannot* be split (because no one bothered to implement that because VMDK could already do it), which means the easier/only way would be to break the VMDK restriction. Until we know *why* it's restricted, we can't help with that. – Bob Sep 04 '13 at 12:58
  • You arent planning on running it? just storing it? Then why not Zip it? – Keltari Sep 04 '13 at 13:11
  • why should you copy it to a FAT32 partition while all current OSes support NTFS? Convert that to NTFS is the easiest solution. Or if FAT32 is a must and that partition is only for transfering data then you can use winrar, 7z or some other compressor to split the file – phuclv Sep 04 '13 at 13:13
  • 1
    If you cannot archive the file nor use the VMDK file format your options are limited to `none`. The file is to large to place on a FAT32 volume. – Ramhound Sep 04 '13 at 14:12

1 Answers1

3

Do you just need it split into chunks small enough to fit on a FAT32 filesystem so that you can transport or copy it? If that is the case, you can:

  • Use split to split a file into pieces.
  • Or use dd to do the same.
  • Or archive it (e.g. multi-part RARs or multi-part ZIP files).

If you need the VM to actually run from the pen drive:

  • Change the filesystem. FAT32 is limited to 4GiB or smaller files, simply because that is a limit of that filesystem.
  • Or change to a file format which can be split. (Why are VMDKs not an option?).
  • Or go all out ugly with a loop-back filesystem, RAIDing multiple 4GiB files files on the FAT32 formatted pendrive into a single partition large enough to handle, and use a different filesystem on that.


Edit 25-5-2014: Adding more information on the third option.

Creating the ≤4GiB files using dd:

dd if=/dev/null of=/mnt/myPenDrive/RAID_part_1.diskimage bs=1M count=3072
dd if=/dev/null of=/mnt/myPenDrive/RAID_part_2.diskimage bs=1M count=3072

Explanation:

  • Read 1M chunks from /dev/null, which provides an endless source of zero's.
  • Do this 3072 times.
  • Write the resulting 3TiB of zeros to a file called RAID_part_1.diskimage

Note the file can be almost any size, but since we are writing to a FAt32 filesystem they need to be smaller than 4GiB. So do not increase count to more than 4095.


Next we tell the OS that we want to see these files as a block device.

losetup /dev/loop0 /mnt/myPenDrive/RAID_part_1.diskimage
losetup /dev/loop1 /mnt/myPenDrive/RAID_part_2.diskimage

We can now access these files as a regular disk. E.g. run fdisk on then, format them in any way we want and mount the formatted volumes.

Once more: We can format this loopback device in an other format that FAT32. So the FAT32 limits no longer apply. Since or fake 'disk' is less than 4GiB the disk will still get full if we try to create a 6GiB file though. So lets expand the disk.

We can do this by concatenating multiple devices. Think of it as a paper notebook where you can glue two notebook together. The last page of the first notebook to the first page of the second notebook. Now you have turned two smaller notebooks (disk) into on large notebook.

A much more detailed and thorough description of that can be found here on our sister site.

For Linux you probably want to use mdadm.

First make sure you have mdadm available (e.g. try to run it, if not found try the relevant command of your distribution to install it. E.g. apt-get install mdadm for Ubuntu, or yum install mdadm for RedHat, or emerge mdadm for Gentoo).

mdadm --create /dev/md0 --level=linear --raid-devices=2 /dev/loop0 /dev/loop1 

You should now have a new, 6GiB block device called /dev/md0. Format and mount it as desired.

Hennes
  • 64,768
  • 7
  • 111
  • 168
  • @Thanks. The problem was, I just had a USB stick of 8GB and all I could work with was the FAT32 System. I was using a modified VirtualBox which didn't recognise VMDK chunks. Thanks for all your answers – user907810 Sep 09 '13 at 07:53