Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jul 2015 10:53:17 -0700
From:      Dieter BSD <dieterbsd@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: format/newfs larger external consumer drives
Message-ID:  <CAA3ZYrDQwL4PGrg5gFa1mhoTB0VSdedAahKxj2-YzzaC327zUA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
> When building a filesystem (FFS) on these 1/2/3/4TB external USB
> drives, any suggestions?  E.g., changing block sizes?  Cut into
> multiple slices to make fsck's job easier (as well as *recovery*)?

If the average filesize will be large, use large block/frag sizes.
I use 64 KiB / 8 KiB.  And reduce the number of inodes.  I reduce
inodes as much as newfs allows and there are still way too many.
These 2 changes waste less space to filesystem overhead, and fsck
runs a lot faster.  If the disk has 4 KiB sectors, have the frag
size be at least 4 KiB, and have partitions start at a multiple
of 4 KiB.

I recommend soft updates.  When I started using su I magically stopped
losing files.

Have newfs label the filesystem(s).  Then use /dev/ufs/mylabel
in /etc/fstab and the filesystems will get mounted on the right
places regardless of the disk being da0 or da1 or whatever.
Swap can be labeled with glabel(8).

Multiple slices?  Consider the size of whatever media you'll
be using for backups.  Consider making a read-only partition,
as it will not require fscking after a crash.  Consider gpt.
If you decide on one big filesystem you don't need any partitioning,
just newfs the raw drive.

USB specific stuff: There is an off by 1 sector problem, which will
bite you if you switch a drive between using the sata-usb bridge
and connecting the drive directly to a sata controller.  I had to
do a fair bit of hacking on the kernel to deal with this.  (No,
I don't have a nice clean patch to offer, sorry.  Besides, I just
plastered over the problem rather than hunting down and fixing the
root cause, which is what really needs to be done.)  I don't recall
if it is off by one physical sector, or one logical sector.  On a
4 KiB drive it *might* mess up having things be on 4K multiples.
Word is that the disk manufacturers have changed the interface
between the bridge and the drive on recent external drives, making it
difficult-to-impossible to use the drive connected directly to a sata
controller. :-(

Some people believe that drives are binned, and the less-wonderful
drives go into the externals.  This could explain externals being
less expensive, despite having more stuff (enclosure, bridge,
wall-wart, cables).  Given how high the failure rate of internal
drives is, I hate to think how bad the externals must be.

I have yet to see a [ps]ata-to-usb bridge that allows turning
the disk's write cache off.  Having the write cache turned off
is kinda important.  If anyone knows of a bridge that does allow
turning the write cache off I'd love to hear about it,

> Of course, anything external means the user could insert/remove it at
> will -- which complicates how the system will deal with the resource.

If the drive disappears with filesystem(s) mounted. the kernel might
very well panic.  There was a discussion of this problem recently.
I thought that FUSE was suggested as a possible solution, but I
can't find the discussion.  This problem is not limited to users
disconnecting usb drives without unmounting them.  The problem
happens all by itself with internal drives, as the drive, port
multiplier, controller, or device driver decides to go out to lunch,
and the kernel panics.  This happens *far* too often, and *kills*
reliability.  We really need a solution for this.



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