Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

support for writing file systems on sparse disk images


Yesterday I wanted to write to a file system which was on a sparse
disk image.  Normally I would have just used a rump mount, but since the
file system was not at offset = 0 in the file, this failed.  vnd wasn't
helpful either: it allowed me to mount the image and then I got weird
errors when writing.

I just finished adding disklabel support to the various rump_fs utilities.
Due to them using the option parsing code of the real mount_fs utilities,
I decided to signal the label number with a magic parameter at the end
of the device (yes, this really simplifies things currently).

Let's assume you're looking at wd0.img.  Here's how it works:

=== SNIP ===
golem> disklabel wd0.img
16 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:    719712        63     4.2BSD   1024  8192     0  # (Cyl.      0*-    714*)
 b:     66657    719775       swap                     # (Cyl.    714*-    780*)
 c:    786369        63     unused      0     0        # (Cyl.      0*-    780*)
 d:    786432         0     unused      0     0        # (Cyl.      0 -    780*)

golem> rump_ffs wd0.img%PART:a% /puffs
rump_ffs: "wd0.img" is a non-resolved or relative path.
rump_ffs: using "/usr/home/pooka/wd0.img" instead.
golem> df /puffs
Filesystem                      1K-blocks       Used      Avail %Cap Mounted on
/usr/home/pooka/wd0.img%PART:a%     338471     256211      65337  79% /puffs
=== SNIP ===

So you specify the partition number as %PART:n%, where is n is obviously
the partition number.  Other than that, things work as usual.  No vnconfig
etc. necessary.

  - antti

p.s. once the generic fs-mounting SoC code from this summer is merged,
this can be handled much cleaner, e.g. with -o partition=n or something
like that.

Home | Main Index | Thread Index | Old Index