I'd like to understand some technical details about how fstrim, file
systems, and block devices work.
Do ext4 and btrfs keep a list of blocks that have already been reported as unused or do they have to report all unused blocks to the block device
layer everytime the fstrim command is issued?
Does LVM keep information on every block about its usage or does it always have to pass trim operations to the lower layer?
And does software RAID, i.e. /dev/md* keep this information on every block? Can RAID skip unused blocks from syncing in a RAID-1 array when I replace a disk?
Steve
I guess ZFS users might
have a different view of how useful lvm aware mdraid is :-)
In the default, iscsi, md, lvm, ext2 do not keep this information. Don't
know if it's configurable sonewhere but I suspect not. Don't know about btrfs.
Some of this data is cached, but not between reboots.
The raid rebuild is a particular pain point IMO. It's important to do a discard after a failed disk rebuild otherwise every block is 'in use' on
the underlying storage.
After a rebuild I always create a LV with all the free space and then
discard it.
Tim Woodall <debianuser@woodall.me.uk> writes:
The raid rebuild is a particular pain point IMO. It's important to do a
discard after a failed disk rebuild otherwise every block is 'in use' on
the underlying storage.
Hmm, does a RAID rebuild really always copy the whole new disk, even
the unused space? But what kind of info is then kept in the first
128 MiB of /dev/md0, if not a flag for every block telling whether it's
used or not?
After a rebuild I always create a LV with all the free space and then
discard it.
:(
I currently have RAID only on a server with HDDs which don't support
TRIM anyway. I have only needed twice to rebuild the RAID-1 with 2
disks and I seem to remember that not the whole disk was copied, but I
might be wrong on that.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 156:57:39 |
Calls: | 10,384 |
Calls today: | 1 |
Files: | 14,056 |
Messages: | 6,416,474 |