On 2024-04-09, Stanislav Syekirin <stanislav.syeki...@studium.fernuni-hagen.de> 
wrote:
> Hi,
>
> I'm trying to figure out the best way to format a USB stick as FAT32. 
> This is what I've tried:
>
> $ time doas newfs_msdos /dev/rsd1c
> /dev/rsd1c: 60007944 sectors in 7500993 FAT32 clusters (4096 
> bytes/cluster)
> bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=63 hds=255 hid=0 bsec=60125184 
> bspf=58602 rdcl=2 infs=1 bkbs=2
>       20m08.34s real  0m00.35s user   0m12.81s system
>
> As you can see, it takes many minutes, and the elapsed time is much 
> larger than the CPU time. Looking at top while the command runs shows 
> that newfs_msdos has PRI -5, its CPU usage fluctuates around 0.5%, 
> STATE is mostly "sleep" with WAIT being "physio".
>
> The same happens if I call newfs_ext2fs -I.
>
> For comparison, `newfs /dev/rsd1c` is almost instantaneous: 0m00.88s 
> real 0m00.06s user 0m00.16s system. It doesn't work if the disk is 

IIUC newfs_msdos has to wrote a lot more than FFS2 newfs.
And writes to USB drives are not particularly quick on OpenBSD.

> already formatted as FAT32, though: I have to call `fdisk -e sd1`, and 
> reinit, otherwise I get a "can't rewrite disk label" error; I'm not 
> sure why newfs cares and newfs_msdos doesn't, maybe I'm doing it wrong 
> somehow.

sd1c shouldn't be used for filesystems. It is a special device node for
"the entire disk". See disklabel(8). For a single filesystem on a drive,
use either a BSD disklabel with an 'a' partition, or a DOS/GPT partition
(whuch you can setup with fdisk) and the 'spoofed' partition letter
(/dev/sd1i for the first one).

> How can I speed the creation of a FAT32 or Ext2 file system up?

Maybe increasing block size will help. If not, I don't think there's
really much you can do. There's no "quick format" option for newfs_msdos
lile there is on Windows.


-- 
Please keep replies on the mailing list.

Reply via email to