Bootable Linux USB stick: Difference between revisions

Jump to navigation Jump to search
Line 135: Line 135:
This is sensible to do after deleting large amounts of data from the USB stick, and before saving and compressing an image of it. It also seems to result in faster writes afterwards i.e. it may be a way to restore the write speed of the stick.  
This is sensible to do after deleting large amounts of data from the USB stick, and before saving and compressing an image of it. It also seems to result in faster writes afterwards i.e. it may be a way to restore the write speed of the stick.  


A better method that does not wear the stick (flash media support a limited number of writes!) is to use TRIM. The SANdisk Extreme supports TRIM, as <code>hdparm -I</code> shows. However, neither the <code>fstrim</code> command nor the <code>discard</code> mount option work for USB sticks (at least not the ones that I tested), presumably because the USB bridge and controller do not pass the ATA trim command to the device.  
A better method that does not wear the stick (flash media support a limited number of writes!) is to use TRIM. The SANdisk Extreme supports TRIM, as <code>hdparm -I</code> shows. However, neither the <code>fstrim</code> command nor the <code>discard</code> mount option work for USB sticks (at least not the ones that I tested), presumably because the usb-storage kernel module does not pass the ATA trim command through the USB bridge and controller to the device.  


The workaround I found is to use the <code>wiper.sh</code> script which is part of the <code>hdparm</code> package. For me, this works beautifully, as verified with the [https://sites.google.com/site/lightrush/random-1/checkiftrimonext4isenabledandworking test_trim.sh] script. Use it on your own risk!
The workaround I found is to use the <code>wiper.sh</code> script which is part of the <code>hdparm</code> package - this uses <code>hdparm</code> directly. For me, this seems to work, as verified with the [https://sites.google.com/site/lightrush/random-1/checkiftrimonext4isenabledandworking test_trim.sh] script. Use it on your own risk!


For initializing the whole stick or a specific partition, [http://unix.stackexchange.com/questions/97143/utility-to-trim-unallocated-space-on-drive <code>blkdiscard</code>] may work - I have not yet checked it. I do believe that <code>hdparm</code>'s (ENHANCED) SECURITY ERASE should work - again, I have not yet tried it.
For initializing the whole stick or a specific partition, [http://unix.stackexchange.com/questions/97143/utility-to-trim-unallocated-space-on-drive <code>blkdiscard</code>] may work - I have not yet checked it. I do believe that <code>hdparm</code>'s (ENHANCED) SECURITY ERASE should initialize the whole stick - again, I have not yet tried it.
1,328

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu