Re: newfs fast, but newfs_msdos and newfs_ext2fs very slow
Thanks, I will experiment with a correctly partitioned USB stick and with different block sizes. But could you please clarify the following: I don't think there's really much you can do. There's no "quick format" option for newfs_msdos like there is on Windows. I thought the difference between quick format and slow format was that the latter overwrites the whole disk and the former only writes as much as necessary to get a working filesystem. But it looks to me that newfs_msdos actually doesn't write a lot. I did the following experiment (didn't verify it with the USB stick yet): I generated a binary file with a pattern of all bytes from 0 to 255 repeated 256 times. For the resulting 64K file, I configured a device with vnconfig. Then I called newfs_msdos on the corresponding raw device. Hexdump on the original file shows that only the bytes before 0x4600 were overwritten, after that, the pattern is still there. So I'm confused about how this is different from quick format. Best regards Stanislav Syekirin
Re: newfs fast, but newfs_msdos and newfs_ext2fs very slow
As last resort, if you are one that lives with usb sticks indipendent hardware duplicators like those from startech.com have a quick format option (almost my old version of it has) further than other useful functionalities. -Dan Apr 10, 2024 10:34:38 Stuart Henderson : >> 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.
Re: newfs fast, but newfs_msdos and newfs_ext2fs very slow
On Wed, Apr 10, 2024 at 08:31:26AM -, Stuart Henderson wrote: > On 2024-04-09, Stanislav Syekirin > 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. > On a side note: when using newfs with ffs1 it does a full write of all the (empty) inode tables and is also much slower than ffs2. In the ffs2 case (default since quite a while) a lazy approach is used; only the superblocks and a small set of inodes is initialized, the rest is done while the fs is being used and there is need for more inodes. -Otto
Re: newfs fast, but newfs_msdos and newfs_ext2fs very slow
On 2024-04-09, Stanislav Syekirin 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.
newfs fast, but newfs_msdos and newfs_ext2fs very slow
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 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. How can I speed the creation of a FAT32 or Ext2 file system up? Best regards Stanislav Syekirin