Linux - mount dd raw img with partitions
Hi, I made a backup of the whole disk including partitions via DD using this tutorial
https://cloud.up4.cz/it/linux-priklady-zalohovani-rsync-tar-rdiff-backup-dd-ftp-ssh-mysql
and when I try to mount it throws me an error:
root@13F4dsf:/
What with this? Probably not quite simply the img with partitions mount mount to any directory classic, right? Is it possible? Thanks
Hi,
mount image created via dd must be done using offset settings for the partition:
1.) If img is compressed, first extract it.
2.) Then find out the partition layout for offset setting:
3.) Mount partition - calculate offset from output fdisk for given partition = 2549760 * 512 = 1305477120
And then mount:
https://cloud.up4.cz/it/linux-priklady-zalohovani-rsync-tar-rdiff-backup-dd-ftp-ssh-mysql
and when I try to mount it throws me an error:
root@13F4dsf:/
mount /tmp/dd/sda.img /mnt/b
mount: /mnt/b: wrong fs type, bad option, bad superblock on /dev/loop2, missing codepage or helper program, or other error.
What with this? Probably not quite simply the img with partitions mount mount to any directory classic, right? Is it possible? Thanks
REPLY
Hi,
mount image created via dd must be done using offset settings for the partition:
1.) If img is compressed, first extract it.
2.) Then find out the partition layout for offset setting:
fdisk -lu /home/dd/sda.img
Disk /home/dd/sda.img: 119,2 GiB, 128035676160 bytes, 250069680 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
Disklabel type: gpt
Disk identifier: 8C4FE13B-79EF-457F-94DB-E07712A77D3F
Device Start End Sectors Size Type
/home/dd/sda.img1 2048 1050623 1048576 512M EFI System
/home/dd/sda.img2 1050624 2549759 1499136 732M Linux filesystem
/home/dd/sda.img3 2549760 250068991 247519232 118G Linux filesystem
3.) Mount partition - calculate offset from output fdisk for given partition = 2549760 * 512 = 1305477120
And then mount:
mount -o loop,offset=1305477120 /home/dd/sda.img /mnt/b