Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a DD image taken from the raw HDD image (/dev/sdb). This image file contains an XFS filesystem that I need to mount. It is much too large to restore to disks (2.6TB img file) so I would like to mount it using loopback.

However, the partition table becomes a problem. I tried to determine the partitions offset using both parted and fdisk -lu. Parted returns "unrecognized disk label", fdisk -lu shows me a blank partition table.

How would you recommend finding the partition start so that I can mount it with -o loop

share|improve this question
    
sfidsk does not show me the partition table. "No partitions found" I used head -c 15000 sdb.img in order to see what I was looking at. I then did some researcha nd saw that it is a LVM volumegroup meta data. Contains things like dev_size, pe_start, pe_count. etc –  coderego Apr 18 '11 at 19:42
    
how are you using those tools? –  Keith Apr 18 '11 at 20:05
    
I am using the tools through bash with sudo. –  coderego Apr 18 '11 at 21:04

5 Answers 5

up vote 6 down vote accepted

The kpartx command will do all the work for you of detecting where the partitions exist and setting up loop devices with the appropriate offsets.

# kpartx -l /dev/ganderData/example-sysdisk
ganderData-example--sysdisk-1 : 0 497952 /dev/ganderData/example-sysdisk 63
ganderData-example--sysdisk-2 : 0 62412525 /dev/ganderData/example-sysdisk 498015

# kpartx -a /dev/ganderData/example-sysdisk
# mount /dev/mapper/ganderData-example--sysdisk-2 /mnt/tmp
share|improve this answer

See if testdisk can find your partition labels. You can try and see if kpartx can find and enable it first:

# kpartx -a -v image

Also remember to try those two things on a copy of the image. You don't want to destroy your backup image with tests.

share|improve this answer

You can use sfdisk to dump the partition table of the image. Pretty well any of the *fdisk variants will do so, but some complain more than others. This will enable you to calculate the offset of the partition.

share|improve this answer

Run file - </dev/sdb to see what you actually have on the disk, since it doesn't seem to be an image of a disk with a PC partition system.

Given your comment, you probably have an LVM physical volume. So first associate a block device to it with losetup, then register the loop device as a physical volume and go on from there.

losetup -fv /path/to/image/file
pvs  # will show /dev/loop99 (for some value of 99) as a physical volume
vgs  # will show the VG(s) on /dev/loop99
lvs  # will show the LV(s) on the VG(s) on /dev/loop99
mount /dev/mapper/groupname-volumename /mnt
…
vgchange -an groupname
losetup -u /dev/loop99
share|improve this answer

kpartx was mentioned twice and you should use it! This post will give you some pratice with kpartx &Co.: Can I "atomically" swap a raid5 drive in Linux software raid?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.