A few years ago I installed Ubuntu 10.04 with LVM + LUKS on a system with SSD, TRIM was not enabled. Now I want to install Ubuntu 12.04 on the same SSD.

I have found a guide explaining how to enable TRIM on Ubuntu 12.04 with LVM + LUKS, but before installing the new system, I want to clean out all the "marked for deletion" data generated under Ubuntu 10.04, to make the disk fast as new.

My plan is to boot a Ubuntu 12.04 LiveCD and create a new ext4 filesystem on the SSD, then mount the filesystem and run fstrim on it. After rebooting the LiveCD I will install the system as normal, and enable TRIM. Can anybody say if this will work?


If you are going to format the filesystem anyhow, you may just use the -E discard switch to mke2fs to have it trim the unused portions of the disk. e2fsck also supports the same option so you can trim the fs while checking it rather than formatting it.

sudo mke2fs -E discard -T ext4 /dev/sdaX
sudo e2fsck -E discard /dev/sdaX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.