Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Use img file as block device

I created an img file using dd (sudo dd if=/dev/zero of=/home/danialbehzadi/dong.img bs=1000K count=32) and now I want it to be used as a block device, so I can restore a filesystem saved by fasrachiver into it.

I already tried restoring directly to file:

oper_restore.c#152,convert_argv_to_strdicos(): "dong.img" is not a valid block device

and mounting it and restoring there:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

oper_restore.c#152,convert_argv_to_strdicos(): "/mnt" is not a valid block device

Is there a way to make it apperad in /dev directrory as a storage device?

>Solution :

You have to configure loopback device by losetup as follows:

sudo losetup /dev/loop0 ~/dong.img

and then you’ll be able to see this image file as a raw disk at /dev/loop0:

$ sudo fdisk -l /dev/loop0 
Disk /dev/loop0: 31.26 MiB, 32768000 bytes, 64000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

To detach device use sudo losetup -d /dev/loop0.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading