Trim doesn't work with lvm and dm-crypt
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Util-Linux-ng |
New
|
Undecided
|
Unassigned | ||
cryptsetup |
New
|
Undecided
|
Unassigned | ||
lvm2 |
New
|
Undecided
|
Unassigned | ||
lvm2 (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I want to use fstrim together with lvm and dm-crypt but it doesn't work (see test procedure below). The problem seems to be somewhere in the lvm layer. Is there any fix or workaround for this?
My configuration:
`cat /etc/crypttab`
sda3_crypt UUID=[...] none luks,discard
and
`cat /etc/lvm/lvm.conf`
# [...]
devices {
# [ ... ]
# [ ... ]
}
# [...]
The SSD is a Samsung 840 Pro.
Here is the output of `sudo dmsetup table`
lubuntu-
lubuntu-
sda3_crypt: 0 499222528 crypt aes-xts-plain64 000000000000000
Here is my `/etc/fstab`:
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/
# /boot was on /dev/sda2 during installation
UUID=
# /boot/efi was on /dev/sda1 during installation
UUID=2296-2E49 /boot/efi vfat defaults 0 1
/dev/
# tmp
tmpfs /tmp tmpfs nodev,nosuid,
Testing procedure:
yes | dd iflag=fullblock bs=1M count=1 of=trim.test
filefrag -s -v trim.test
Filesystem type is: ef53
File size of trim.test is 1048576 (256 blocks, blocksize 4096)
ext logical physical expected length flags
0 0 2224384 256 eof
trim.test: 1 extent found
df trim.test
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/
sudo dd bs=4096 skip=2224384 count=256 if=/dev/
00000000 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a |y.y.y.y.y.y.y.y.|
*
256+0 records in
256+0 records out
1048576 bytes (1,0 MB) copied, 0,00328209 s, 319 MB/s
00100000
rm trim.test
sync
sudo fstrim -v /
/: 695181312 bytes were trimmed
sync
sudo dd bs=4096 skip=2224384 count=256 if=/dev/
00000000 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a |y.y.y.y.y.y.y.y.|
*
256+0 records in
256+0 records out
1048576 bytes (1,0 MB) copied, 0,00166157 s, 631 MB/s
00100000
I.e. the y pattern persists which indicates that TRIM doesn't work. See also my post on unix-stackexchange: http://
ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: lvm2 2.02.95-6ubuntu4
ProcVersionSign
Uname: Linux 3.8.0-27-generic x86_64
ApportVersion: 2.9.2-0ubuntu8.3
Architecture: amd64
Date: Sun Aug 18 14:31:46 2013
InstallationDate: Installed on 2013-08-03 (14 days ago)
InstallationMedia: Lubuntu 13.04 "Raring Ringtail" - Release amd64 (20130423.1)
MarkForUpload: True
SourcePackage: lvm2
UpgradeStatus: No upgrade log present (probably fresh install)
Status changed to 'Confirmed' because the bug affects multiple users.