NetBSD-Users archive

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

Re: cannot mount small FFS filesystem?

On Mon, Jun 14, 2010 at 03:48:15PM +0200, Hubert Feyrer wrote:
> I have a storage device that only has 47k space. I'd like to put FFS (v1  
> or v2) with journaling on it. newfs(8) works fine, but mount(8) 
> complains:
>       mount_ffs: /dev/vnd0a on /mnt: incorrect super block
> The commands I give for testing:
> # dd if=/dev/zero of=img bs=512 count=94
> # vnconfig vnd0 img
> # newfs -m 0 -O 1 /dev/rvnd0a
> # mount -o log /dev/vnd0a /mnt
> Full log with output is appended below.
> I've tried adding -m0 and -O1 to newfs, but couldn't mount it, without  
> without logging.
> Is there anything obvious I'm missing?

Foremost you are missing that this is one of those problems which
is really easy to diagnose by some trivial single-stepping.

The problem is that the first superblock attempt is at an offset
greater than your file system's size, so the attempted read fails.
An easy way to fix this is simply to make the file system ignore
the error and try other options.

Index: ffs_vfsops.c
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.258
diff -p -u -r1.258 ffs_vfsops.c
--- ffs_vfsops.c        11 Feb 2010 00:06:16 -0000      1.258
+++ ffs_vfsops.c        14 Jun 2010 14:18:59 -0000
@@ -878,8 +878,7 @@ ffs_mountfs(struct vnode *devvp, struct 
                error = bread(devvp, sblock_try[i] / DEV_BSIZE, SBLOCKSIZE, 
                              0, &bp);
                if (error) {
-                       fs = NULL;
-                       goto out;
+                       continue;
                fs = (struct fs*)bp->b_data;
                fsblockloc = sblockloc = sblock_try[i];


pain-rustique:6:~> newfs -m 0 -O 1 -s 94 -F ffs.img
newfs: Warning: changing optimization to space because minfree is less than 5%
ffs.img: 0.0MB (94 sectors) block size 4096, fragment size 512
        using 1 cylinder groups of 0.05MB, 12 blks, 32 inodes.
super-block backups (for fsck_ffs -b #) at:
pain-rustique:7:~> rump_ffs ffs.img /mnt
rump_ffs: "ffs.img" is a non-resolved or relative path.
rump_ffs: using "/usr/home/pooka/ffs.img" instead.
pain-rustique:8:~> df -h /mnt
Filesystem                   Size       Used      Avail %Cap Mounted on
/usr/home/pooka/ffs.img       15K       512B        14K   3% /mnt

(hmm, there's a bug in puffs with writing to full file systems)

Home | Main Index | Thread Index | Old Index