Wednesday 11 December 2013

/dev/loopN on fedora

for some reason loop module is not compiled in and systemd doesn't create nodes for loop devices.
if you need to mount/dump some partition on some image, let say on dump of mmcblk0 from embedded device, there is a way to do it:


  • create loop device (must be repeated before any additional file processed by kpartx):

'losetup -f'

  • create "looped" partitions

'kpartx -av some_dump_file'

  • now you can do whatever you want on disk image and partitions like:

'sgdisk -p /dev/loopN'or
'dd if=/dev/mapper/loopNpNN of=dump_of_partition'

  • when finished remove maps:

'kpartx -dv some_dump_file'