An SSD command that tells the drive which blocks of memory are no longer in use, allowing it to erase blocks containing deleted data.
Questions tagged [trim]
53 questions
90
votes
2 answers
Trim audio file using start and stop times
I have an FFmpeg command to trim audio:
ffmpeg -ss 01:43:46 -t 00:00:44.30 -i input.mp3 output.mp3
The problem I have with this command is that option -t requires a duration (in seconds) from 01:43:46. I want to trim audio using start/stop times,…
whitewings
- 2,377
- 7
- 32
- 53
35
votes
2 answers
SSD: how often should I do fstrim?
There are different sources and different practices are suggested. I found the following proposals how often one should run fstrim.
run weekly by cron
run daily by cron
run at each boot
What is the optimal option and why? Ubuntu 14.04 uses the…
marmistrz
- 2,732
- 4
- 23
- 30
24
votes
3 answers
Trim with LVM and dm-crypt
I tried to setup TRIM with LVM and dm-crypt on ubuntu 13.04 following this tutorial:
http://blog.neutrino.es/2013/howto-properly-activate-trim-for-your-ssd-on-linux-fstrim-lvm-and-dmcrypt/
See the notes about my configuration and my testing…
student
- 17,875
- 31
- 103
- 169
19
votes
3 answers
How do I trim bytes from the beginning and end of a file?
I have a file, that has trash (binary header and footer) at the beginning and end of the file. I would like to know how to nuke these bytes. For an example, let's assume 25 bytes from the beginning. And, 2 bytes from the end.
I know I can use…
Evan Carroll
- 28,578
- 45
- 164
- 290
17
votes
3 answers
Utility to TRIM unallocated space on drive
I have a drive (SD card) with a few ext4 partitions but also some unallocated space. The fstrim utility can only work within a filesystem. Before I reinvent the wheel and write one, is there another utility that can TRIM the unallocated space (or…
Jason C
- 1,341
- 3
- 13
- 29
13
votes
4 answers
independently verify that TRIM indeed works on SSD
I have a LUKS partition /dev/sda1 which I luksOpen with --allow-discards:
cryptsetup --allow-discards luksOpen /dev/sda1 root
I then mount the ext4 filesystem with discard option:
grep /dev/mapper/root /proc/mounts
/dev/mapper/root / ext4…
Martin Vegter
- 69
- 66
- 195
- 326
9
votes
3 answers
How can I tell if a Linux block device is trimmable or not?
fstrim requires the Linux block device to be mounted, and it is not very verbose. blkdiscard could tell, but also that would require a write operation.
Can I somehow tell if a block device supports trimming/discarding, without actually trying to…
peterh
- 9,488
- 16
- 59
- 88
9
votes
3 answers
Will formatting my drive TRIM my SSD?
Will a standard fresh linux (Ubuntu 11.10 to be exact) install and drive re-format (full) successfully TRIM my SSD, or do I need to do something extra?
I know that ext4 will TRIM blocks on erase when I specify the discard option, but I want to…
Stephen
- 925
- 3
- 10
- 16
9
votes
1 answer
fstrim trims more than half of partition size even though partition mounted with discard
When I installed my SSD I just mounted with discard and didn't sweat it. However today I was reading about the pros and cons of using fstrim instead and decided to run the program to get an idea of how long it would actually take (still with my…
Graeme
- 33,607
- 8
- 85
- 110
7
votes
3 answers
How do I check if my ssd supports fstrim?
I'm working with a linux server and wanted to know if there is a way that I can find out that my SSD supports fstrim or not. I tried hdparm -I /dev/sda, but it's not available and I can't install it. Is there any other way I can do it? Any help is…
Yong zhu
- 71
- 1
- 2
7
votes
2 answers
Should the 'discard' option be used for mounting a swap file?
The Arch Wiki says that defaults,discard can be used in the fstab file for a swap partition. However it is not clear about a swap file, nor is the man page.
If the swap file resides in a filesystem which itself is mounted with the discard option…
Marc.2377
- 1,072
- 1
- 17
- 41
6
votes
2 answers
Unix: how to read line's original content from file
I have a data file, the content is as follows:
department: customer service section: A
department: marketing section: A
department: finance section: A
When I read each line, I would extract the department name using cut command.…
Newbiee
- 85
- 1
- 4
6
votes
1 answer
Do Linux swap partitions support trimming?
The question appears if we want to use a swap partition on an SSD drive. I think, it would be better (for the SSD) if the deallocated swap space could be trimmed, because trimming the not used blocks enables the underlying SSD electronics to tune…
peterh
- 9,488
- 16
- 59
- 88
6
votes
2 answers
How do I check TRIM?
I have Linux installed on a Dell XPS 9343 with an Samsung PM851 SSD.
I recently read that many SSDs don't support TRIM operations.
So I'd like to check if discard option effectively works on my system.
At first step, I tried to simply run sudo…
mattia.b89
- 3,142
- 2
- 14
- 39
6
votes
2 answers
jpegtran - losslessly crop left portion of image
I have a 1400x1400 image in which I want to trim 4 pixels to the left, 1 at the bottom and, to keep square proportions, 3 from the top. The problem is, whenever I perform a crop with jpegtran, pixels get removed from the bottom-right, no matter what…
Jeffrey Lebowski
- 397
- 3
- 15