Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fstrim

259 views
Skip to first unread message

Rob

unread,
Oct 18, 2013, 3:28:51 AM10/18/13
to
I have a number of slightly differently configured Raspberry Pi
systems. On most of them, when I type "fstrim -v /" I get something
like this:

fstrim -v /
/: 122716160 bytes were trimmed

This command tells the SD card which blocks have been written to but
are no longer used, so that it can erase them for future use.
I normally put this command in /etc/rc.local and/or a weekly cron job.

Yesterday I got a new Pi, loaded it with 2013-09-25-wheezy-raspbian.img
and on this one I get:

fstrim -v /
fstrim: /: FITRIM ioctl failed: Operation not supported

I looked around an saw references to the kernel not supporting it,
problems with encrypted filesystems, volume manager etc.
But this Pi has neither of them, and I have others that are running
Raspbian as well with the same latest kernel.

What can be the reason for this?
Can it be related to the particular SD card in use?
(it is a Transcend 16GB)

Rob Morley

unread,
Oct 18, 2013, 10:57:23 AM10/18/13
to
On 18 Oct 2013 07:28:51 GMT
Rob <nom...@example.com> wrote:

> fstrim -v /
> fstrim: /: FITRIM ioctl failed: Operation not supported
>

>
> What can be the reason for this?
> Can it be related to the particular SD card in use?
> (it is a Transcend 16GB)

Is it using a file system that doesn't support fstrim?

Rob

unread,
Oct 18, 2013, 11:19:05 AM10/18/13
to
No. It is a plain download of the Raspbian image.
It uses ext4 as always.

Jonathan

unread,
Oct 19, 2013, 5:28:40 AM10/19/13
to
This is a Debian bug. Turns out the Debian kernel package managers are
idiots and didn't build the ext4 module with FITRIM support. It's not
fixed in Sid either, I'm running it on my laptop and just tested fstrim.
I wouldn't worry about it either way, sheer unreliability will kill most
SD cards long before fstrim would start extending the life of the media.

Rob

unread,
Oct 19, 2013, 11:59:47 AM10/19/13
to
It must be recently introduced then?
I have several Raspberries running and none of them show this problem.
However, this is the first one that I installed myself from a
Raspbian image I downloaded.

Richard Kettlewell

unread,
Oct 19, 2013, 12:53:22 PM10/19/13
to
I’m skeptical about that explanation, since:
(i) the ext4 FITRIM implementation is not conditional
(ii) the error code corresponds to the underlying block device lacking
discard support (unimplemented ioctls yield EINVAL)
(iii) it works perfectly well when I try it on a device that does
support ATA TRIM
(iv) Ben’s really not an idiot

Perhaps you’d care to quote the bug number.

--
http://www.greenend.org.uk/rjk/

Theo Markettos

unread,
Oct 20, 2013, 9:31:06 AM10/20/13
to
Richard Kettlewell <r...@greenend.org.uk> wrote:
> (ii) the error code corresponds to the underlying block device lacking
> discard support (unimplemented ioctls yield EINVAL)

I wonder if that's it. Were all SD cards accessed through the native Pi SD
slot? The SD card protocol does support explicit erase operations and it
appears the Linux MMC driver does use that for TRIM.

Questions: are we talking the same card here? Some cards handle erase in
nonstandard ways which might not be supported. And were any used in a USB
reader? Many USB readers don't support erases (I'm not sure if the USB Mass
Storage standard implements them - SCSI does, but I think it's a recent
addition).

Theo

Rob

unread,
Oct 20, 2013, 12:54:14 PM10/20/13
to
The card is in the standard slot of a Pi.
It is a Transcend SDHC 16GB class-10 card.

I have another one of those cards, I will see if that has the same
problem. Did others see this problem with that card?

I'm certain that the similarly labeled 4GB card does not have this
problem.

Jonathan

unread,
Oct 20, 2013, 2:26:55 PM10/20/13
to
So it turns out I'm an idiot and I was attempting to run fstrim on
rotational storage. Never mind.
0 new messages