New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blkdiscard all unpartitioned space #2804
Comments
blkdiscard provides I'm not sure if we want to link blkdiscard for this purpose. It sounds like an unusual use case. |
Linux only automatically trims mounted partitions. If you clone an SSD with Clonezilla, or write an image with dd to an SD card for a Raspberry Pi, any old data not overwritten will never be trimmed. If you delete a partition with gnome-disks or the like, I doubt it would get trimmed. For example, sfdisk can delete partitions, but it does not mention trimming at all. It feels a little silly leaving that opportunity unused. Even creating a partition to cover all empty space will probably not trim it until the global systemd fstrim.timer kicks in, perhaps next week. If blkdiscard could automatically trim unused space and on demand, I am guessing that many people would use it after running dd or the like. Otherwise, most people won't bother, which would be a shame in terms of performance and/or wear leveling. You could argue that you should trim the whole disk beforehand, but trim is often only an afterthought when performance suffers, or you may get the disk from somebody else who didn't. Besides, you may only be writing or shrinking one partition. Do you know of any tool or script to automatically trim unpartitioned space? Even though sfdisk is touted as "script-oriented", it doesn't seem like a 5-minute job. |
What about adding |
I don't really mind which tool. I don't have a good overview anyway. For me, the main thing would be the ability to trim the unpartitioned space. Otherwise, you would have to create and delete partitions just for that purpose, which is a pain, especially if there are holes (several of them). But trimming deleted or newly-created partitions is a good idea too. I just realised that this is not just a thing for real disks or even some SD cards: apparently QEMU also honours TRIM commands and releases space in .qcow2 virtual disk files. |
OK, I'll think about it for the fdisks, including unpartitioned space. |
We currently have blkdiscard(8), but it can be difficult to use for unpartitioned areas or for partitions when working with a whole-disk device. This commit adds BLKDISCARD support to fdisk, so that the user does not have to specify any range, but instead follows the partition table. * The new command "T" (trim) allows for discarding sectors on a partition. * The new command "U" (unpartitioned) allows for discarding sectors on unused areas. Addresses: util-linux#2804 Signed-off-by: Karel Zak <[email protected]>
We currently have blkdiscard(8), but it can be difficult to use for unpartitioned areas or for partitions when working with a whole-disk device. This commit adds BLKDISCARD support to fdisk, so that the user does not have to specify any range, but instead follows the partition table. Addresses: util-linux#2804 Signed-off-by: Karel Zak <[email protected]>
We currently have blkdiscard(8), but it can be difficult to use for unpartitioned areas or for partitions when working with a whole-disk device. This commit adds BLKDISCARD support to fdisk, so that the user does not have to specify any range, but instead follows the partition table. Addresses: util-linux#2804 Signed-off-by: Karel Zak <[email protected]>
We currently have blkdiscard(8), but it can be difficult to use for unpartitioned areas or for partitions when working with a whole-disk device. This commit adds BLKDISCARD support to fdisk, so that the user does not have to specify any range, but instead follows the partition table. Addresses: util-linux#2804 Signed-off-by: Karel Zak <[email protected]>
Could you add an option to TRIM all unpartitioned space on a disk?
Some background information is here:
https://unix.stackexchange.com/questions/97143/utility-to-trim-unallocated-space-on-drive
The text was updated successfully, but these errors were encountered: