Accessing partitions in drive images (was: drive recovery of dual-boot system)
Michael ODonnell
michael.odonnell at comcast.net
Thu Jan 26 10:08:59 EST 2012
> Filesystems (and therefore "fsck" targets) reside on partitions
> of the disk, something like "/dev/sdc3", rather than the entire
> device (or an image of it). This is inherent in the design of the
> system and is independent of the types of filesystems or how they
> are mixed.
Picking nits here: most filesystems do normally reside on partitions
but that's not actually inherent in the design of the system,
it's just a very sensible convention. It's certainly possible
to write a filesystem onto (say) /dev/sdc (the whole disk rather
than a partition thereof) and then mount /dev/sdc somewhere; in my
experience everything Just Works. That violates the Principle Of
Least Astonishment these days, though, so use partitions unless you
have a clear need to do otherwise. And, certainly, in the OP's case
where his dd'd image was pulled from a partitioned device, an fsck
run against that entire image (instead of one of its partitions)
is guaranteed to fail.
> In order to access partitions within an image file, you want
> the "kpartx" utility:
>
> http://linux.die.net/man/8/kpartx
A very handy tool. Before kpartx I'd compute offsets of partitions
by hand when rummaging around inside partitioned images, using loop
devices to access them. Fun...
More information about the gnhlug-discuss
mailing list