Solved gmirror - Single Drive

Hi,

USB drives in my case da0, in my understanding I have limited number of read/write by sector. So I was wondering to create 2 partitions with a same size and use gmirror() and use round-robin to mirror them in order to extend the number of read/write.
  1. Is this correct assumption? if not, explanation is appreciated.
  2. How about using gmirror() for the freebsd-boot in a single USB drive?
Thank you,
 
What sort of USB disk is it? If it's a large capacity drive then it is probably a standard SATA 2.5" or 3.5" disk and will be no different to an internal SATA disk. If it's an SSD then it will take care of wear-levelling itself.

The only type of disk where I can see writes being an issue is "usb memory sticks" that are just cheap flash memory.** But then I wouldn't expect reads to be an issue - which is the only thing you are balancing with round-robin. With mirror you'll actually be doubling the number of writes to the drive as every write will go to both partitions, so you're not reducing or spreading out write wear at all.

I personally wouldn't bother with the idea of trying to mirror on a single disk to increase disk life.

**When running a system of a small USB stick or CF card, the old tactic was to mount stuff like /tmp & /var as memory disks and make root read-only. That can be a bit of hassle to get right though; We just keep things simple and use SATA or small SSDs these days.
 
So I was wondering to create 2 partitions with a same size and use gmirror() and use round-robin to mirror them in order to extend the number of read/write.
It still needs to write to the other side of the mirror. So you're actually increasing the number of writes, not reducing them.
 
Thanks SirDice and usdmatt for your input. usdmatt, sorry for not clarifying what type of drive I'm using. It's a USB Memory Stick (32G). So this not a good solution since I'm doubling the number of writes.

I understand that USB Memory Sticks are cheap now, but is it possible to ware-level the number of writes in USB Memory Stick which contains only /boot partition in order to extend the life of it?


Thank you,
 
If it only contains the boot partition then don't worry about it. Pretty much nothing will write to it unless you edit something like loader.conf manually or do an upgrade.
 
These days, fundamentally all hard disks have wear limits (not just flash = SSDs or USB sticks, but also "spinning rust"). I just looked at the most recent Seagate spec, and consumer SATA disks are limited to 180-300 TB/year, enterprise grade disks to 550 TB/year (look for "workload rate limit", and this number applies to writes *and* reads), and only some exotic enterprise drives don't have a limit specification. Other manufacturers are similar. But home use on a single-user or desktop machine is very unlikely to reach these limits. And as SirDice said, by mirroring you are actually doubling the amount of IOs that need to be done. If you want to stretch the lifetime of your disks, you should stripe over multiple drives, but that brings your reliability down (because now the failure of any one disk makes holes in many files, perhaps in the whole file system).
 
Back
Top