[EMAIL PROTECTED] wrote:
On Thu, Dec 01, 2005 at 04:30:45PM -0500, Matt Price wrote:
[...]
Then tried investigating thusly:
sudo mount -t ext2 -o loop soundserver.img /mnt/soundserver/
but it won't mount, giving a "wrong fs" error of the kind I've
sometimes seen when forgetting to add "-t iso9660" while attempting to
mount a cd. so not sure whether I'm doing something wrong, or whether
perhaps you use a special fs (reiser?)
You shouldn't need to specify the filesystem type; I'll bet what you
have is actually not a partition image, but a disk image. This is
different: the disk image has a partition table in front of it, not
a filesystem. You need to instruct mount to seek to the appropriate
partition within the disk image using the "offset" option. First, do
this:
/sbin/fdisk -l soundserver.img
and see if you get a partition table. If you do, then the above
diagnosis is correct. In that case, here's a dirty little perl snippet
I have used to mount the first partition in a disk image. You will have
to modify it if you want to specify a different partition.
#!/usr/bin/perl -w
@ARGV == 2 || die "$0: bad usage\n";
$f = shift;
$d = shift;
-f $f && -r $f || die "$0: $f: $!\n";
-d $d || die "$0: $d: $!\n";
$ptable = qx(sfdisk -d "$f") || die "$0: sfdisk failed\n";
$ptable =~ m/^\s*${f}1\s+:\s+start=\s*(\d+)/m || die "$0: bad sfdisk output?";
# ^
# The partition to mount is hard-coded to "1" here.
$offset = $1 * 512;
exec "mount -o loop,offset=$offset $f $d";
ooh thankyou! I knew there must have been a way of doing it! you have
saved me a lot of hassle (e.g. having to manage multiple images for
people). I was worrying about that. I found this so useful I think ill
print it and stick it on my wall...
(for those that are interested) And the image file I provided has its
root fs on the first partition, so no modification of this script whould
be needed in order to mount it.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]