NetBSD-Users archive

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

Re: newfs_msdos says vnconfiged device read-only, newfs doesn't say so



mayuresh%acm.org@localhost (Mayuresh) writes:

>    4 partitions:
>    #        size    offset     fstype [fsize bsize cpg/sgs]
>     a:   4194304         0     4.2BSD      0     0     0  # (Cyl.      0 -   2047)
>     d:   4194304         0     unused      0     0        # (Cyl.      0 -   2047)
>    disklabel: boot block size 0
>    disklabel: super block size 0

>newfs_msdos says it's read-only:

>    # newfs_msdos -F 32 /dev/rvnd0a
>    /dev/rvnd0a: 4186096 sectors in 523262 FAT32 clusters (4096 bytes/cluster)
>    MBR type: 11
>    bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=32 hds=64 hid=0 bsec=4194304 bspf=4088 rdcl=2 infs=1 bkbs=2
>    newfs_msdos: /dev/rvnd0a: Read-only file system


Only the 'label sector' that would carry the BSD disklabel is write protected.
This is not a problem for ffs as it doesn't use the first sectors, but the
FAT filesystem does.

For regular hard drive images, this isn't a problem either, these use the
first sectors (usually the first track) for MBR and bootloaders, and
the BSD disklabel goes either there or into the first blocks of the
"NetBSD MBR partition".

But if you want to create an unpartitioned "super floppy" that only stores
the FAT filesystem, you cannot avoid the collision. I.e. you must never
write a disklabel, and you need to enable writes to the label sector with
something like:

disklabel -W vnd0

# newfs_msdos vnd0a
/dev/rvnd0a: 20424 sectors in 2553 FAT12 clusters (4096 bytes/cluster)
MBR type: 1
bps=512 spc=8 res=1 nft=2 rde=512 sec=20480 mid=0xf0 spf=8 spt=32 hds=64 hid=0
newfs_msdos: /dev/rvnd0a: Read-only file system
# disklabel -W vnd0
# newfs_msdos vnd0a
/dev/rvnd0a: 20424 sectors in 2553 FAT12 clusters (4096 bytes/cluster)
MBR type: 1
bps=512 spc=8 res=1 nft=2 rde=512 sec=20480 mid=0xf0 spf=8 spt=32 hds=64 hid=0


Without partitioning (and the proper partition type) you need to
specify the filesystem type when mounting.

# mount /dev/vnd0a /mnt
mount_ffs: /dev/vnd0a on /mnt: incorrect super block
# mount -t msdos /dev/vnd0a /mnt


N.B. enabling writes on the label sector is not persisent. Depending on
the filesystem layout, it can be possible to mount without writes being
enabled but subsequent filesystem operations may fail.

It's usually easier to use a partitioned hard disk image.



Home | Main Index | Thread Index | Old Index