How to open image files? (Solved)

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
Snail
Posts: 43
Joined: Wed Jul 27, 2022 1:13 am
Has thanked: 16 times

How to open image files? (Solved)

Post by Snail »

I have DD copied my Windows 7 C: drive from the HDD in my desktop to an image file in a partition in a USB HDD device. The partition is formatted NTFS and the partition inside the image is also NTFS. The image is 466GB in size.

After a bit of internet searching, I tried to view the image file by mounting it as shown below. I ran the command from a terminal inside /mnt. NewDir is an empty directory, also in /mnt. I was running from a USB stick using Fossapup 9.5 in Pupmode 5.

Code: Select all

mount-FULL -o loop sdc2/imgW7Aug1522.WinC /NewDir

This failed, as shown:

Code: Select all

mount-FULL: /NewDir: failed to setup loop device for sdc2/imgW7Aug1522.WinC.

Am I on the right track? How can I view this file?

imgW7Aug1522.WinC

EDIT I have learnt a bit about the mount command in the discussion below. However I have just noticed that the Rox-rightclick menu for files with the .img suffix to their name has, prominently at the top of that menu, the item [Disk Image Mounter]. So that's the easy Rox way. :oops:

Last edited by Snail on Sat Aug 27, 2022 9:04 am, edited 1 time in total.
Burunduk
Posts: 244
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 6 times
Been thanked: 122 times

Re: How to open image files

Post by Burunduk »

Snail wrote: Tue Aug 16, 2022 3:08 am

I ran the command from a terminal inside /mnt. NewDir is an empty directory, also in /mnt.

Code: Select all

mount-FULL -o loop sdc2/imgW7Aug1522.WinC /NewDir

/NewDir is not inside the /mnt directory. It starts with '/' and that means it's an absolute path.

From inside /mnt it should be: mount sdc2/imgW7Aug1522.WinC NewDir
Or with absolute paths from anywhere: mount /mnt/sdc2/imgW7Aug1522.WinC /mnt/NewDir

-o loop is OK but optional.

-----
It seems the "how to" in the title of this subforum still sounds ambiguously.

User avatar
puddlemoon
Posts: 189
Joined: Sun Sep 06, 2020 9:26 pm
Location: In between
Has thanked: 89 times
Been thanked: 64 times

Re: How to open image files

Post by puddlemoon »

Hi @Snail
Close.. you need to assign the img to a loop first with losetup like so:
losetup --show -f -p *.img that will show the loop that is assigned e.g /dev/loop8
you can then see the partitions with lsblk and mount them each in their own dir.
I had this query a few months back and eventually came to writing a pair of scripts that will mount the .img in a directory per partition. I made it to travel with jackalpup image file but below is a version that will mount an image file, each partition in it's own directory, in the current directory. So place the scripts in a directory alongside the .img with no other .img file. Just click mount to mount then unmount to... unmount (remove the fake .txt extension first)

Ironically, just after deciphering how to do this, I found a similar script from BarryK that does the same thing but differently, (better?) it opens the partitions in their own rox window, then closes it all up on the second run. needs to be run in terminal with the .img path.

here's the link download/file.php?id=9778
and his next version that defaults to read only viewtopic.php?p=60550#p60550

There is still some value in having the mount directories in with the image so here's those.

mount-image.txt
(306 Bytes) Downloaded 30 times
unmount-image.txt
(174 Bytes) Downloaded 26 times

enjoy (:

williams2
Posts: 1023
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 288 times

Re: How to open image files

Post by williams2 »

In most Puppys, mount is a script.
What the script does, is use mount-FULL for fat32 and ext2/3/4 file systems,
and uses ntfs-3g (fuse) for ntfs file systems.

Mount has the ntfs driver builtin, but using it might damage your ntfs file system. to the point that the file system might need re-formating. All data in the ntfs file system would be lost.

Using the mount script to mount an ntfs file system would be something like:

mount -t ntfs -o loop /mnt/sdc2/imgW7Aug1522.WinC /NewDir

Did you want to use /NewDir as a mount point?
Or did you want to use ./mnt/NewDir ?
Either will work, but you may need to create the dir, like this:

mkdir /mnt/NewDir

I don't use mount, or mount-FULL. I use ntfs-3g, like this.

intfs-3g /dev/sda4 /mnt/home -o umask=0022,no_def_opts,noatime,rw,silent

which mounts the file system in my hard drive partition /dev/sda4 on mount point /mnt/home/
To mount the file system in a file, you need to add the -o loop option,
which uses losetup automatically to make the file appear as a block device in /dev/loop4 (your loop will probably not be 4)

If you have a kernel newer than 5.15 and support for the new ntfs3 driver supported by the kernel, you could try:

mount-FULL -t ntfs3 -o loop /mnt/sdc2/imgW7Aug1522.WinC /mnt/NewDir

Again, you need to get the paths right.)

Burunduk
Posts: 244
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 6 times
Been thanked: 122 times

Re: How to open image files

Post by Burunduk »

The simple mount command works with a plain file system in a file. But when I put 2 partitions inside it, the command fails (as well as with only 1 partition). puddlemoon is right, use:
losetup --partscan --find --show file.img -> lsblk /dev/loopNN -> mount /dev/loopNNp1 /mnt/newdir

Snail
Posts: 43
Joined: Wed Jul 27, 2022 1:13 am
Has thanked: 16 times

Re: How to open image files

Post by Snail »

Thank you everyone for all your help. I tried the simplest fix, suggested by Buruduk:

Code: Select all

mount sdc2/imgW7Aug1522.WinC NewDir

It works! At least as far as I need and can see. I was able to read down into the user documents and everything looks OK. I just needed to check that my DDing actually worked!

Lots of other interesting info in these replies. I will try the other approaches, once I have gained a bit more understanding. Obviously, I am a complete ignoramus here, blundering about and utterly dependent on help from the forum. I would like to get better. To that end, can anyone suggest a site with good study material? My Googling so far gets me to forums like this, which are great for solving my immediate needs, but I would like to get more basic knowledge, so I can bother the forums less.

A bit off-topic: I was surprised to learn that Fossapup was still using NTFS-3G, since I understood that kernels from 5.15 on had an all-dancing all-singing new NTFS3 module.

https://www.theregister.com/2021/10/13/ ... ly_made_it

But then I discovered:

https://lore.kernel.org/lkml/da20d32b-5 ... rse.net/T/

So the Puppy developers are right to keep the 3G version, I guess. (of course they are :))

Post Reply

Return to “Users”