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

Bug-report to libufs2 concerning ufsutils on Debian GNU/Linux



I have found a portability issue between Linux and *BSD that prevented mkfs.ufs from creating an UFS filesystem anywhere on a Linux box. I have tried to use ufsutils and libufs2 packages from Debian Unstable repository to create a UFS filesystem on different block devices and in files and got the same result:

laptop:/home/dmitriy/ufsutils-7.0# mkfs.ufs /dev/ram0
mkfs.ufs: /dev/ram0: could not find special device

The root cause is connected with the function ufs_disk_fillout_blank() in the file libufs/type.c that uses BSD-specific algorithm to resolve <name> to a real character-device name: 1) Check if <name> points to a character device; if it does, it's what we need 2) If it doesn't and doesn't begin with a '/' character, try prepending '/dev/' to it and retrying 3) Resolve <name> to the device the filesystem on which the file <name> is, and that device is what we need.

However, Linux can make a filesystem and mount it from a block device only, so I needed to change the patch debian/patches/01_libufs.patch (attached) to check it for a block device and also to eliminate resolving a filename to the filesystem because I think it's not a good idea to format a device a filesystem is mounted from.

The patched libufs2 succeeded with making a UFS2 filesystem on my 4MB ramdisk:

laptop:/home/dmitriy/ufsutils-7.0# mkfs.ufs /dev/ram0
/dev/ram0: 4.0MB (8192 sectors) block size 16384, fragment size 2048
        using 4 cylinder groups of 1.02MB, 65 blks, 192 inodes.
super-block backups (for fsck -b #) at:
 160, 2240, 4320, 6400

- check and dump also work fine (attached), but I still can't mount it (using linux-2.6.24.4 without any patches concerning UFS):

laptop:/home/dmitriy/ufsutils-7.0# mount -t ufs -o ufstype=ufs2 /dev/ram0 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/ram0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

laptop:/home/dmitriy/ufsutils-7.0# dmesg | tail
<skipped the lines not related to mounting my UFS>
UFS: failed to set blocksize

It still can mount an UFS image, for example, extracted from an OpenSolaris LiveCD microroot, so I consider it to be mkfs.ufs problem, not the kernel one.
So I attach:
1) The new patch to libufs (not the whole 01_libufs.patch
2) The output of dumpfs.ufs
3) The output of fsck.ufs
4) The gzipped image of the UFS I've created.
Please e-mail me if I forgot to attach anything of those :)

Best regards,
Dmitriy Kryuk
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Attachment: libufs_type_c.patch.gz
Description: GNU Zip compressed data

Attachment: fsdump_output.txt.gz
Description: GNU Zip compressed data

Attachment: fsck_output.txt.gz
Description: GNU Zip compressed data

Attachment: ufs.gz
Description: GNU Zip compressed data


Reply to: