[svlug] mounting a partition in the middle of a device dumped to a file
Marc MERLIN
marc_news at merlins.org
Tue Aug 13 22:43:17 PDT 2002
On Tue, Aug 13, 2002 at 02:56:31PM -0700, Tim wrote:
> > So, I have a disk that is dded to a file:
> > Disk ./wholedisk: 0 heads, 0 sectors, 0 cylinders
> > Units = cylinders of 1 * 512 bytes
> >
> > Device Boot Start End Blocks Id System
> > ./wholedisk1 * 64 8391600 4195768+ b Win95 FAT32
>
> You can specify an offset into the file using losetup, but I don't know
> if it will work properly.
Oh, I so forgot about that. Waay back when loop devices were introduced, you
were forced to use losetup before you could mount a file. Soon after mount
introduced -o loop and I haven't used losetup since then. It's been more
than 6 or 7 years now :-)
Thanks for the pointer.
> Anyway, to mount the first partition, if this offset (64*512) is right,
> you can do this:
>
> losetup -o 32768 /dev/loop0 ./wholedisk
> mount /dev/loop0 /mnt/mnt
Unfortunately, I was having problems finding the offset, until, I popped up
my trusty mc, and opened the file in hexa mode (F3 + hexa)
(it helps to have the "signature" of what you're looking for)
00007E00 EB 58 90 4D ? 53 57 49 4E ? 34 2E 31 00 ? 02 04 20 00 ?X.MSWIN4.1... .
00007E10 02 00 00 00 ? 00 F8 00 00 ? 3F 00 F0 00 ? 3F 00 00 00 .....?..?.?.?...
moremagic:~# bc
(...)
obase=10
ibase=16
7E00
32256
I guess the first cylinder is 1, and not 0, which means that cylinder 64 is
an offset of 63*512=32256
gargamel:/net/gargamel/auto/dshelf2/backup/disk# mount -t vfat /dev/loop0 /mnt/mnt
gargamel:/net/gargamel/auto/dshelf2/backup/disk# ls /mnt/mnt
Documents and Settings boot.ini comused.dbg io.sys pcdrdos
Dos bootlog.prv config.sys lotuslnk support
Install bootlog.txt discover msdos.sys syslevel.ibm
Program Files bootsect.dos hiberfil.sys ntdetect.com thinkpad
Recycled cfgsafe ibmtools ntldr winnt
autoexec.bat comreads.dbg icons pagefile.sys
Thanks much for the help
Marc
PS: BTW, if you're curious, I have the disk image because I dded a drive that
was dying and dded chunks out of it until I got a copy minus a few blocks.
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | Finger marc_f at merlins.org for PGP key
More information about the svlug
mailing list