Mounting Hard Drive Image Help

Hello,

I am not sure where I should have posted this question but here it is any way.

I am trying to mount a hard drive image I made of my old openSUSE 10.2 x86-64 system (reiserfs). When I try to mount it I get this error:

sudo mount /dev/mapper/loop0p2 atlasImg
mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop0p2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

Output from dmesg:

8551.410398] REISERFS (device dm-2): found reiserfs format “3.6” with standard journal
8551.410468] REISERFS (device dm-2): using ordered data mode
8551.410472] reiserfs: using flush barriers
8551.410705] REISERFS (device dm-2): journal params: device dm-2, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
8551.411955] REISERFS (device dm-2): checking transaction log (dm-2)
8551.412080] REISERFS warning (device dm-2): journal-837 _update_journal_header_block: IO error during journal replay
8551.412088] REISERFS warning (device dm-2): reiserfs-2006 journal_init: Replay Failure, unable to mount
8551.412395] REISERFS warning (device dm-2): sh-2022 reiserfs_fill_super: unable to initialize journal space

so I ran a reiserfsck of the image:

sudo /sbin/reiserfsck --check /dev/mapper/loop0p2
reiserfsck 3.6.21 (2009 www.namesys.com)
Will read-only check consistency of the filesystem on /dev/mapper/loop0p2
Will put log info to ‘stdout’

###########
Replaying journal: Done.
Reiserfs journal ‘/dev/mapper/loop0p2’ in blocks [18…8211]: 0 transactions replayed
Checking internal tree… finished
Comparing bitmaps…finished
Checking Semantic tree:
finished
No corruptions found
There are on the filesystem:
Leaves 80016
Internal nodes 547
Directories 44574
Other files 322872
Data block pointers 8385626 (386230 of them are zero)
Safe links 0
###########

which says everything is OK. I am not sure where to go from here, so any help or guidance will be appreciated. Thank you in advance.

Note: Current System is openSUSE 11.3 x86-64
Image made with ddrescue of entire hard drive
-3 partitions NTFS, reiserfs, linux-swap
-can mount NTFS partition
-sudo /sbin/losetup /dev/loop0 sansDigital/HD-IMG/adsAtlasII092610.img
-sudo /sbin/kpartx -a /dev/loop0

Hello adsrc and welcome to the community!:wink:

You could try this command:

mount -o loop file.img /mnt

If it fails it’s most likely that the image is compressed.
It could be one of many compression methods, but I think that gzip is most common.

And could you tell us with which program and how you made the image?

Best of luck!:wink:

Hello Edward_lii,

Thank you for responding. I do not believe the image is compressed nor do I think “mount -o loop file.img /mnt” will work as the image is of a whole disk and not just a partition ( /dev/sda vs /dev/sda1).

The program used to make the image was ddrescue using a command like:
ddrescue -v /dev/sda imagefilename.img logfile.log

Typically to get to the image you would first setup a loopback device to the whole disk image:
losetup /dev/loopx imagefilename.img
where x is the next available loopback device available, if no loopback devices are in use typical loop0 is used.

You can not mount that loopback device as is because it is of a whole disk and would be like trying to mount /dev/sda.

To get to the individual partitions kpartx is used:
kpartx -a /dev/loopx
where x is the loopback device you setup using losetup. This will create loopback devices to the individual partitions in the whole disk image within the /dev/mapper directory in the form of loopxpy where where x is the loopback device you setup using losetup and y is the partition number.

For my setup in specific from the /mnt directory:
sudo /sbin/losetup /dev/loop0 sansDigital/HD-IMG/adsAtlasII092610.img
sudo /sbin/kpartx -a /dev/loop0
ls /dev/mapper/
control loop0p1 loop0p2 loop0p3

loop0p1 was my sda1 in my old system (NTFS)
loop0p2 was my sda2 (reiserfs)
loop0p3 was my sda3 (linux swap)

Hello adsrc,

I wasn’t aware of that, thanks for explaining.

Anyway, back to the problem.
You could try this command:

mount -t reiser**4** /dev/<DEVICE> /mnt/

Not sure about the version, I don’t use reiserfs myself.

Another reason for this problem could be that reiserfs isn’t supported in your kernel.
To check this run this command:

cat /proc/filesystems

Best of luck!:wink:

Hello Edward_lii,

Thank you again for your suggestions. I tried to mount using the “-t reiser4” switch:

sudo mount -t reiser4 /dev/mapper/loop0p2 atlasImg
mount: unknown filesystem type ‘reiser4’

using “-t reiserfs” produces the usual:

sudo mount -t reiserfs /dev/mapper/loop0p2 atlasImg
mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop0p2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

My system is formatted using reiserfs:

cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev cpuset
nodev tmpfs
nodev devtmpfs
nodev debugfs
nodev securityfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev devpts
ext3
ext2
nodev ramfs
nodev hugetlbfs
iso9660
nodev mqueue
nodev usbfs
reiserfs
nodev fuse
fuseblk
nodev fusectl

I tried to mount this image using Knoppix 6.2.1 and it was able to mount so I don’t know why I can’t mount it from openSUSE 11.3 x86-64. I guess something must be set incorrectly on my system.

On 2010-10-11 18:06, adsrc wrote:

> I am trying to mount a hard drive image I made of my old openSUSE 10.2
> x86-64 system (reiserfs). When I try to mount it I get this error:
>
> sudo mount /dev/mapper/loop0p2 atlasImg
> mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop0p2,
> missing codepage or helper program, or other error
> In some cases useful info is found in syslog - try dmesg | tail or so
>
> Output from dmesg:
>
> 8551.410398] REISERFS (device dm-2): found reiserfs format “3.6” with standard journal
> 8551.410468] REISERFS (device dm-2): using ordered data mode
> 8551.410472] reiserfs: using flush barriers
> 8551.410705] REISERFS (device dm-2): journal params: device dm-2, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

It is really attempting to mount.

> 8551.411955] REISERFS (device dm-2): checking transaction log (dm-2)
> 8551.412080] REISERFS warning (device dm-2): journal-837 _update_journal_header_block: IO error during journal replay

That’s the error. There is a input/output error, which typically would mean the image is read-only.
To avoid that I would try to mount read-only in the command line - but if the journal is dirty, it
would not work.

I could perhaps also point to a read error in the original disk, which might be interfering :-? I
doubt it, but perhaps.

> 8551.412088] REISERFS warning (device dm-2): reiserfs-2006 journal_init: Replay Failure, unable to mount
> 8551.412395] REISERFS warning (device dm-2): sh-2022 reiserfs_fill_super: unable to initialize journal space
>
> so I ran a reiserfsck of the image:

Not needed, I think.

> sudo /sbin/reiserfsck --check /dev/mapper/loop0p2
> reiserfsck 3.6.21 (2009 www.namesys.com)
> Will read-only check consistency of the filesystem on
> /dev/mapper/loop0p2
> Will put log info to ‘stdout’

Read only, it says :-?

…]

I see you got it working with another system. Interesting.

If the image was indeed read-only, I think I read somewhere that write ops could be redirected to
somewhere else. I think it is a system used for live systems, no idea if it could be used here.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Thank you Carlos E. R.

The drive the image is located on was mounted as read only. Once I mounted the drive as read/write I was able to mount the image. It would be nice to mount the drive with my images as read only to protect myself from, well, myself. If there is a way to mount this image while the disk containing the image is mounted as read only, I would love to find out.

You can mount the filesystem R/O to prevent yourself from making changes to it at the filesystem level, but the image file must still be writable for the sake of the journal, as you have seen.

Anyway, you have a backup of the image, no?

Yeah, backup of the images, right. That is something I should do. The images are on a RAID 1 array to protect against hard drive failure, but I have no complete backup. I have over 1TBs of images, but that is no excuse as hard drives are cheap.

Getting back to the idea of having the drive with the images as read only could UnionFS or Aufs be used to redirect writes to a different location or is this asking for trouble.

I seem to recall reiserfs allows the journal to be kept somewhere else, but I haven’t used it for quite a while now.

Why not copy the data off reiserfs onto a filesystem that is really R/O like ISO9660?

On 2010-10-13 04:36, adsrc wrote:
>
> Thank you Carlos E. R.
>
> The drive the image is located on was mounted as read only. Once I
> mounted the drive as read/write I was able to mount the image. It would
> be nice to mount the drive with my images as read only to protect myself
> from, well, myself. If there is a way to mount this image while the
> disk containing the image is mounted as read only, I would love to find
> out.

Once the journal is played out, and the loop umounted properly, so that the journal is written to
the image, then it should be possible to mount it read-only. I routinely mount DVD recorded as XFS
or reiserfs, which both have a journal, and the DVD is obviously read-only.

I soon learnt that the images had to be cleanly umounted, but I think I managed to mount one of
those that wasn’t clean. I think it was xfs. It complained, but it worked.

I wonder if the method that is used on live linux CDs to write data, which is to write to memory or
HD instead, could be used in this case. I’m curious, too, but here it is 5 AM and I don’t remember
the key word to search for this in the wikipedia.

(Watching in TV how the first miner is rescued in Atacama, Chile, in the Fenix capsule, right now.
70 days underground - wow)


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

On 2010-10-13 05:06, ken yap wrote:
>
> I seem to recall reiserfs allows the journal to be kept somewhere else,

Not doable for an existing image, which you want to keep safe.

> Why not copy the data off reiserfs onto a filesystem that is really R/O
> like ISO9660?

Once the image is closed properly, you can reopen it RO. My guess is that the image was created “live”.

adsrc:

UnionFS, yes, that’s the name I did not remember. I can’t vouch for it, but it would be interesting
to investigate.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Yeah, but who know how much longer reiserfs support will continue to work properly in the kernel, whereas you are pretty safe with ISO9660.

On 2010-10-13 06:36, ken yap wrote:
>
> Carlos E. R.;2237263 Wrote:
>>
>>> Why not copy the data off reiserfs onto a filesystem that is really
>> R/O
>>> like ISO9660?
>>
>> Once the image is closed properly, you can reopen it RO. My guess is
>> that the image was created “live”.
>
> Yeah, but who know how much longer reiserfs support will continue to
> work properly in the kernel, whereas you are pretty safe with ISO9660.

It has several shortcomings. One, filesize limit, I bumped into it. Two, you can not simply change
it to r/w, add a file, and put it back to ro. Three, if you try to copy a reiserfs that had millions
of very small files, it will not be able to cope with it.

Also, the image, in this case, is an exact copy of the original HD partition, so it can not be
changed to anything, that’s the whole point of being RO.

To have such an image RO and mountable, it simply has to be closed properly at least once: either
make it from an umounted filesystem, or if made from a live, mount it once r/w, close it, and change
to r/w. Changing the properties of the image file is enough.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Filesize limits, yes. But up to him to evaluate it.

R/O, isn’t that the whole point? that the OP seems to want to snapshot the filesystem and never change it again, unless I misunderstood him.

On 2010-10-13 15:06, ken yap wrote:
>
> Carlos E. R.;2237361 Wrote:
>> It has several shortcomings. One, filesize limit, I bumped into it. Two,
>> you can not simply change
>> it to r/w, add a file, and put it back to ro. Three, if you try to copy
>> a reiserfs that had millions
>> of very small files, it will not be able to cope with it.
>
> Filesize limits, yes. But up to him to evaluate it.

It is easy to hit it. I think it was just 2 gigs.

> R/O, isn’t that the whole point? that the OP seems to want to snapshot
> the filesystem and never change it again, unless I misunderstood him.

You can not snapshot a filesystem writing it to a different filesystem. You are making an exact
photo, can’t alter anything at all. If it was 12 bit FAT it will be 12 bit FAT, like it or not. It
is an image, not a normal backup.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Can’t you use sync command to force the journal to complete all transactions?

On 2010-10-13 18:36, gogalthorp wrote:
>
> Can’t you use sync command to force the journal to complete all
> transactions?

Not needed.
Just umount the filesystem, then make the imaging.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

C’mon, you know what I mean, make a copy of all the files on it, not replicate the original filesystem. Perhaps I should have said snapshot the files in the filesystem, is that easier for you?

On 2010-10-14 01:06, ken yap wrote:
>
> Carlos E. R.;2237461 Wrote:

>> You can not snapshot a filesystem writing it to a different filesystem.
>> You are making an exact photo, can’t alter anything at all. If it was
>> 12 bit FAT it will be 12 bit FAT, like it or not. It is an image,
>> not a normal backup.
>
> C’mon, you know what I mean, make a copy of all the files on it, not
> replicate the original filesystem. Perhaps I should have said snapshot
> the files in the filesystem, is that easier for you?

Yes, of course, I understand that. It can be used for backup, but an exact image has other uses.
Faster backup, faster restore, for example. Forensics. Repairs.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)