Convert fsarchiver img to VirtualBox vdi

Jul 17, 2023

I had an image of a bootable GNU/Linux system and needed to use it in the VirtualBox. The image was made with fsarchiver. Below I show the steps to convert the image to a vdi file.

Note: You need VirtualBox > 6.1.34 in your system. [more info]

1) Locate the UUID

This UUID is used to store the contents of the fsarchiver img. So you need to have a VirtualBox VM where the img will be saved.

vboximg-mount --list

2) Configure fuse

Edit /etc/fuse.conf and add at the end:

user_allow_other

3) Mount the VM VirtualBox image

$ UUID=Paste the UUID of step 1 here
$ DESTDIR=/tmp/vbox_sysdisk
$ mkdir $DESTDIR
$ vboximg-mount --rw -i $UUID -o allow_root $DESTDIR

4) Map destination partition

$ ls -lh /tmp/vbox_sysdisk/vol*

Choice the destination partition, and as root, run:

# VOL=vol name
# losetup /dev/loop0 /tmp/vbox_sysdisk/$VOL

5) Restore fsarchiver img

Run as root, too:

# FSAFILE=full location of your .fsa file
# fsarchiver restfs $FSAFILE id=0,dest=/dev/loop0 -j 3

Last step) Unmap/unmount

# losetup -d /dev/loop0
# umount /tmp/vbox_sysdisk

Back to talau's home