Creating/mounting hard disk as an .iso file

I have a hard disk (SATA SSD) that was formerly the primary drive in my computer. It had Windows 10 installed. I replaced it, reinstalled Windows on the new drive and now I want to copy files from the old primary drive.

I can attach it through USB and it works fine, but I would prefer to have it available as an .iso file.

I have created and mounted .iso files from DVD’s in the past and that works fine. I use Linux dd if=/dev/cdrom of=file.iso to create the file. I can mount such an .iso in Windows either straight (Windows Explorer) or Virtual Clonedrive. Never had any problems.

Now I tried that with the hard drive and I can’t get the .iso to mount.

What I did:

First I connect the drive to Linux with USB. Being a Windows 10 primary drive, it has three partitions. It has System Reserved, “Drive C”, and Recovery Partition, the first two being readable file systems. So Linux automatically creates four block devices, /dev/sdd, /dev/sdd1, /dev/sdd2, /dev/sdd3.

I first tried dd if=/dev/sdd2 of=file.iso. Tried to mount that in Windows. Explorer says something like the .iso file being corrupt. Virtual Clonedrive does not say anything but does not show any mounted drive in Windows either (but still have to unmount to unlock the .iso file).

Next I tried dd if=/dev/sdd of=file.iso. Same result in Windows.

Using the latter file, I tried mounting it in Linux using the loop device. mount file.iso /media/iso -o loop. Linux says: “mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.”

The Linux is an old Fedora release 20 (Heisenbug) virtual machine.

I am convinced I can make it work with losetup with alot of effort. Losetup has a –partscan that perhaps handles multiple partitions in the .iso file. Using the -o, --sizelimit and mount -t options should handle anything.

So:

How do you mount an .iso file, created from a hard disk containing multiple partitions in Fedora Linux using losetup?

How do you mount such an .iso file in Windows 10?

Any hints?

I can right click the .iso file and open it with 7-Zip File manager.

It shows four files, apparently corresponding to four partition entries named 0.ntfs, 1.ntfs, 2.ntfs, 3

I can extract 0.ntfs, rename it 0.iso and mount it in Linux using losetup and mount -r (without -r it complains about Unclean NTFS), no need to specify mount -t.

I can also open 0.iso again with 7-Zip File Manager and it shows all the files (as it does for regular .iso files).

But I can’t mount 0.iso as a drive in Windows (whether Explorer or Virtual Clonedrive).

How to make it work as a mounted drive in Windows?

Windows is probably interpreting it as an actual ISO file, which is very different from an image of an entire hard drive or partition thereof.

In instance, I don’t think you can make a single ISO out of the entire device (e.g., /dev/sda). I think you’ll have to break it down into partitions and make ISOs out of them (e.g., /dev/sda1) to have a chance of it working.

The problem in Windows could be that there are too many primary partitions. Is there any chance of going back to the original drive, marking the original partitions as logical, and then creating an extended partition around them? You could do all of this from Linux with parted or Gparted.

ETA: It’s been a long time since I messed with primary/extended/logical partitions: you might have to create the extended/logical partitions, then copy into them.

Thanks, I assume you mean Windows interprets it specifically as the binary image of an UDF file system (or maybe alternatively an ISO 9660 file system).

I’m starting to think you’re right.

Does anybody know for a fact that Windows does not have a loop device and mount function for an arbitrary supported file system, but only for certain optical drive file systems?

Thanks, I tried that earlier. It didn’t work on Windows. Didn’t try that directly on Linux but in hindsight it probably would have worked.

So it turns out I can extract those individual partition .isos from my full drive .iso with 7Zip-FM.

I think the resulting .iso is the same as I could have made directly from the Linux partition block device (/dev/sdd1).

And I can mount that normally in Linux.
It further turns out that I can open such an NTFS iso also directly with 7Zip-FM! (I don’t even have to extract it first, I can “Open inside” and it opens the file system in place.)

Truly amazing that they built in a partition decoder and extractor AND a full featured NTFS decoder and extractor into 7Zip-FM, it works really well (it displays all kinds of secret internal NTFS info as well).

This actually works better than mounting the drive as a driver letter in Windows. So problem solved.

Thanks for the suggestion! Sounds rather tricky. I used to play with this low level disk stuff too long ago. It might me possible to turn primary partitions into extended partitions on a binary level by copying sectors to a new drive. Or maybe there are commmercial tools that can do this.

I think the problem with the loop device remains that it would have to make multiple /dev/loop0, /dev/loop1… entries automatically for all the partitions it finds. All mapped automatically with decoded --offset and --sizelimits. Don’t know if it has such capability.