Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jan 2006 12:49:51 +0000
From:      Brian Candler <B.Candler@pobox.com>
To:        freebsd-stable@freebsd.org
Subject:   Re: newfs_msdos onto an image file
Message-ID:  <20060115124950.GA23753@uk.tiscali.com>
In-Reply-To: <20060115123445.GA14271@uk.tiscali.com>
References:  <20060115123445.GA14271@uk.tiscali.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 15, 2006 at 12:34:46PM +0000, Brian Candler wrote:
> I am trying to prepare an MS-DOS disk image file (for later dd to a USB
> device) but am having difficulties getting newfs_msdos to work in this way.
> This is under 5.4-RELEASE.

P.S. it seems that the total disk size given by -s is in sectors not bytes
(this isn't very clear in the manpage). This doesn't help the simple case:

# newfs_msdos -h 64 -u 32 -s 256000 /dev/md0
newfs_msdos: Cannot get number of sectors, Operation not supported
# newfs_msdos -h 64 -u 32 -s 256000 -S 512 /dev/md0
newfs_msdos: Cannot get number of sectors, Operation not supported

But finally I found an incantation that works:

# newfs_msdos -h 64 -u 32 -s 256000 -f 1440 -a 125 -F 16 -b 4096 -c 8 /dev/md0
/dev/md0: 255728 sectors in 31966 FAT16 clusters (4096 bytes/cluster)
bps=512 spc=8 res=1 nft=2 rde=224 mid=0xf0 spf=125 spt=32 hds=64 hid=0 bsec=256000
# mount -t msdos /dev/md0 /mnt
# df -k | grep md0
/dev/md0       127872       8   127864     0%    /mnt

That was a lot harder work than I was expecting, especially having to use
trial-and-error on the sectors per FAT value.

Is there any chance that newfs_msdos could gain some intelligence and be
able to choose suitable default values?

Furthermore, why do I still have to pretend that the device is a 1440K
floppy disk? If I remove -f 1440 I get:

# newfs_msdos -h 64 -u 32 -s 256000 -a 125 -F 16 -b 4096 -c 8 /dev/md0
newfs_msdos: Cannot get number of sectors, Operation not supported

Regards,

Brian.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060115124950.GA23753>