I'm trying to recreate file system metadata on a virtual disk. I can save this metadata using e2image, and the e2image man page tells me I can use e2image -I to restore the file system. Unfortunately, the man page doesn't provide any information on how to use this argument. I've tried the following (command results indented for easier reading):
msk $ e2image /dev/nbd1 -I test.qcow2
e2image 1.42.5 (29-Jul-2012)
e2image: Wrong magic number for Ext2 Image Header while trying to open test.qcow2
msk $ sudo e2image /dev/nbd1 -I test.qcow2
e2image 1.42.5 (29-Jul-2012)
e2image: Wrong magic number for Ext2 Image Header while trying to open test.qcow2
msk $ sudo e2image test.qcow2 -I /dev/nbd1
e2image 1.42.5 (29-Jul-2012)
e2image: Wrong magic number for Ext2 Image Header while trying to open /dev/nbd1
My filesystem is in fact ext4, however the man page says the following:
The e2image program will save critical ext2, ext3, or ext4
I used the following command to create the image:
sudo e2image -Q /dev/mapper/nbd0p1 test.qcow2