# loop mounting a single partition on imaged drive [SOLVED]

## don quixada

Hi, I followed the instructions here for creating an image of an NTFS partitioned hard-drive. Namely:

```
# dd if=/dev/hda conv=sync,noerror bs=64K | gzip -c  > ./backup.img.gz

```

I kept the bs=64K because they seemed to recommend it. 

I also saved the "extra info" as they recommended it:

```
# fdisk -l /dev/sdi > backup_fdisk.info

Disk /dev/sdi: 298.1 GiB, 320072933376 bytes, 625142448 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: dos

Disk identifier: 0x5a660aa0

Device    Boot     Start       End    Blocks  Id System

/dev/sdi1           2048  29362175  14680064  27 Hidden NTFS WinRE

/dev/sdi2 *     29362176  29566975    102400   7 HPFS/NTFS/exFAT

/dev/sdi3       29566976 625139711 297786368   7 HPFS/NTFS/exFAT

```

Now I want to mount the third partition starting on block 29566976 but when I follow the instructions according to here I get the following error message: 

```
# losetup /dev/loop0 backup.img.gz -o $((29566976 * 512))

losetup: backup.img.gz: Warning: file does not fit into a 512-byte sector; the end of the file will be ignored.

```

I'm not sure what to do about this. Is it because the image is compressed? 

If I run fdisk -lu on the image file itself I get:

```
fdisk -lu backup.img.gz

Disk backup.img.gz: 232.2 GiB, 249369201152 bytes, 487049221 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

```

I'm not sure if that is useful. Any help would be appreciated. Thanks.

dqLast edited by don quixada on Thu Nov 27, 2014 5:38 am; edited 1 time in total

----------

## SDNick484

I've never tried this method before, but it looks interesting.  If I had to guess your issue, the problem may be related to the fact that your backup is compressed (gzip -c) and the offset your pointing (-o 29566976) is not.  If you have the space, perhaps try to decompress the image via gunzip and use the same losetup command on the decompressed file (i.e. backup.gz).

----------

## don quixada

Yes, that was it. It took forever to gunzip it but once I did I was able to mount no problem! Incidentally, I also tried 'partimage' on one partition of the hard drive but I haven't figured-out how to mount it either...

dq

----------

