extract image file

If you have a question about a file system (for example xfs, reiserfs, ...)

Moderator: feffer

Post Reply
athar
Posts: 2
Joined: Sat Aug 01, 2009 12:31 pm

extract image file

Post by athar » Sat Aug 01, 2009 12:33 pm

is it possible to extract the image files created by partimage so you can browse the file that were originally in the partition. also is it possible to convert the xfs partimage into ntfs or something else??

feffer
Posts: 126
Joined: Tue Mar 17, 2009 4:30 am

Post by feffer » Sun Aug 02, 2009 7:54 pm

is it possible to extract the image files created by partimage so you can browse the file that were originally in the partition.
Not sure why you would want to do this. An image of a partition will have everything that the original partition has. Are you trying to restore a single file or directory from an image? Partimage is designed to save/restore entire partitions. If you want the ability to restore single files, there are better tools, like rsync, rdiff-backup etc. On the other hand, if you are trying to see if the image you saved is valid/uncorrupted, the best way to do this is simply restore it to an empty partition and try booting to it.
is it possible to convert the xfs partimage into ntfs or something else??
Not directly. The image must be restored to the same filesystem it came from. If you want to move a system to a different filesystem, it is probably better to start fresh: format a drive/partition, install to it, then move data over with cp, scp, rsync etc. If this doesn't answer your question, please elaborate on what you are trying to do.

Regards,
feffer

athar
Posts: 2
Joined: Sat Aug 01, 2009 12:31 pm

Post by athar » Sat Aug 08, 2009 4:29 pm

the image i am trying to backup is corrupted and i cant browse it normally.

feffer
Posts: 126
Joined: Tue Mar 17, 2009 4:30 am

Post by feffer » Sat Aug 08, 2009 5:04 pm

athar wrote:the image i am trying to backup is corrupted and i cant browse it normally.
I think you're out of luck, sorry.

yoda
Posts: 1
Joined: Fri Jun 10, 2011 9:56 am

Post by yoda » Fri Jun 10, 2011 11:14 am

I've found a fairly easy way to extract individual files from a partimage image file. These are the steps (Linux):

1. create a target image file using dd, e.g.

Code: Select all

dd if=/dev/zero of=image bs=1024 count=3774771
where 3774771 is the number of 1K blocks. You can use "fdisk -l" on the original system to obtain the exact amount. However, I suppose you can obtain the rounded amount from partimage imginfo command and use an overestimated value;

2. associate this image with a loopback device, e.g.

Code: Select all

losetup /dev/loop0 image
where loop0 has to be replaced with a higher numbered device (loop1, loop2, etc.) if loop0 is already in use (you can also use the -f option to use the next one available);

3. create a mount point, e.g.

Code: Select all

mkdir mnt
4. mount the image from the loopback device, e.g.

Code: Select all

mount -o ro /dev/loop0 mnt
5. and that is! You can now browse the files in the mnt directory.

Note that steps 2-4 have to be done as superuser (root).

Regards,
Rodrigo Ventura

Hartmut
Posts: 26
Joined: Thu Aug 26, 2010 10:06 am

Post by Hartmut » Mon Jun 27, 2011 6:26 am

yoda wrote:I've found a fairly easy way to extract individual files from a partimage image file. These are the steps (Linux):

1. create a target image file using dd, e.g.

Code: Select all

dd if=/dev/zero of=image bs=1024 count=3774771
where 3774771 is the number of 1K blocks. You can use "fdisk -l" on the original system to obtain the exact amount. However, I suppose you can obtain the rounded amount from partimage imginfo command and use an overestimated value;

2. associate this image with a loopback device, e.g.

Code: Select all

losetup /dev/loop0 image
where loop0 has to be replaced with a higher numbered device (loop1, loop2, etc.) if loop0 is already in use (you can also use the -f option to use the next one available);

3. create a mount point, e.g.

Code: Select all

mkdir mnt
4. mount the image from the loopback device, e.g.

Code: Select all

mount -o ro /dev/loop0 mnt
5. and that is! You can now browse the files in the mnt directory.

Note that steps 2-4 have to be done as superuser (root).

Regards,
Rodrigo Ventura
Hello Yoda

I think there is one step missing, because:
1) create an empty file
2) connect it to a loop device
3) create mountpoint
4) mount loop device/file to the mountpoint
-> 5) you see an empty filesystem :wink:

So between 2) and 4) one has to restore the partimage image to this filesystem... right?

CU
Hartmut

nouvo09
Posts: 1
Joined: Sat Jun 25, 2011 5:48 pm
Location: PARIS - (FR)

Post by nouvo09 » Tue Sep 13, 2011 9:27 am

Don't think so. Look:
DESCRIPTION
losetup is used to associate loop devices with regular files or block devices, to detach loop devices and to query the status of a loop device. If only the loopdev argument is given, the status of the corresponding loop device is shown.
(man losetup)

This means that once losetup is done, just invoke the loop shows the image associated. There is no need to restore the filesystem.

aeroigni
Posts: 1
Joined: Sat Sep 24, 2011 6:27 pm

Post by aeroigni » Sat Sep 24, 2011 6:43 pm

I've several partimage files on my HDD:bios, sda, sda1.first_sectors, sda1.000, sda1.001 sda1.002 .... sda2,sda2.first_sectors, sda2.000,sda2.001,....sda3, sda3.first_sectors, sda3.000, sda3.000 ... sda3.008 etc.

HDD had 3 partitions with ntfs

files like sda3.000 with compression bzip2 (c.a. 700mb per file)


Code: Select all

losetup /dev/loop0 sda3.000
mkdir mnt
mount -o ro /dev/loop0 mnt (with error - select type of partition)
i've tried

Code: Select all

mount -t ntfs -o ro /dev/loop0 mnt
but there is no header of NTFS
I don't want to restore whole disk or partition. I need only some small file from this image (sda3). It's important to me.
Thnx

Post Reply