This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
extract-fs-img [2014/04/04 04:46] maxx created |
extract-fs-img [2014/04/04 04:47] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== How to extract a filesystem from a disk image ====== | ====== How to extract a filesystem from a disk image ====== | ||
+ | <code> | ||
# sfdisk -l -uS image-file | # sfdisk -l -uS image-file | ||
Disk image-file: 0 cylinders, 0 heads, 0 sectors/track | Disk image-file: 0 cylinders, 0 heads, 0 sectors/track | ||
Line 12: | Line 12: | ||
image-filep3 4267680 142253279 137985600 83 Linux | image-filep3 4267680 142253279 137985600 83 Linux | ||
image-filep4 0 - 0 0 Empty | image-filep4 0 - 0 0 Empty | ||
+ | </code> | ||
Now, suppose you want to extract partition number 3. You can see that it starts at block 4267680 and is 137985600 blocks long. This translates into: | Now, suppose you want to extract partition number 3. You can see that it starts at block 4267680 and is 137985600 blocks long. This translates into: | ||
+ | <code> | ||
# dd if=image-file of=partition3-file skip=4267680 count=137985600 | # dd if=image-file of=partition3-file skip=4267680 count=137985600 | ||
+ | </code> | ||
Now, peeking into the contents of the partition is as easy as: | Now, peeking into the contents of the partition is as easy as: | ||
+ | <code> | ||
# mount -t ext3 -o loop partition3-file /mnt/hack | # mount -t ext3 -o loop partition3-file /mnt/hack | ||
+ | </code> |