Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: fstrim: FITRIM ioctl failed: Bad file descriptor

  1. #1

    Question fstrim: FITRIM ioctl failed: Bad file descriptor

    Code:
    # fstrim -v /win
    fstrim: /win: FITRIM ioctl failed: Bad file descriptor
    The mount options for this ntfs-3g partition are:

    Code:
    ro,noatime,permissions,uid=myusername,gid=users,fmask=177,dmask=077,locale=en_US.UTF-8,windows_names        0 0
    What is the reason for trimming not to work? Other (ext4) partitions on this SSD drive trim fine.

  2. #2
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,866

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    1 was it mounted? I note you have nofail

    2) if NTFS is associated Windows set not to have fast boot?

  3. #3

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    Quote Originally Posted by gogalthorp View Post
    1 was it mounted?
    Yes.

    2) if NTFS is associated Windows set not to have fast boot?
    I don't understand this sentence. Could you please clarify?

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,233

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    Couldn't it be that fstrim has no idea what to do with a non-Linux file system like NTFS?

    People seem to think that non-Linux file systems are supported by all tools as if they were Linux file systems.

    While there is mount (including attaching fake ownership/permissions) and read/write support, I think you should be glad with that. Use those file systems only for exchanging data with non-Linux operating systems. All the rest, like creating and managing them should be done on the operating system they are native to.
    Henk van Velden

  5. #5

    Smile Solved

    Removed 'ro' option and now trim works.

    I guess the question remains then: considering I noticed this message in journalctl first - why is Linux attempting to trim a 'ro' mount at all. Is that a bug?

  6. #6
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,866

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    Since trim is a low level block command I'd expect it to be file system agnostic.

    Don't know if ro fail is a bug but it could use a better error message.

    I suspect if you set something ro you really expect it to be read only and fstrim definitely is a write operation

  7. #7

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    Quote Originally Posted by gogalthorp View Post
    Since trim is a low level block command I'd expect it to be file system agnostic.

    Don't know if ro fail is a bug but it could use a better error message.

    I suspect if you set something ro you really expect it to be read only and fstrim definitely is a write operation
    I agree. I have filed a bug report.

    I also don't know why there is an attempt to trim that partition at all. I have:

    Code:
    # cat /etc/cron.daily/trim
    #!/bin/sh
    LOG=/var/log/trim.log
    echo "*** $(date -R) ***" >> $LOG
    fstrim -v / >> $LOG
    but I have never set any trimming for that /win mount. Why does the system do it at all? As noted in the bug report I have noticed these attempts are with dates after updating to Leap 15.

  8. #8
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,866

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    Maybe it just follows the directory tree

  9. #9

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    Quote Originally Posted by gogalthorp View Post
    Maybe it just follows the directory tree
    If that was so it would show every day in the journal but that is not the case.

    I have just received a reply in the bug report:

    "There is fstrim.timer to be executed once a week."

    which I suppose may be something new to Leap 15. I checked:

    Code:
    grep -i "execstart" /usr/lib/systemd/system/fstrim.service
    ExecStart=/usr/sbin/fstrim -av
    '-a' means all. So this is what is calling it.

  10. #10
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    28,563
    Blog Entries
    15

    Default Re: fstrim: FITRIM ioctl failed: Bad file descriptor

    Quote Originally Posted by heyjoe View Post
    If that was so it would show every day in the journal but that is not the case.

    I have just received a reply in the bug report:

    "There is fstrim.timer to be executed once a week."

    which I suppose may be something new to Leap 15. I checked:

    Code:
    grep -i "execstart" /usr/lib/systemd/system/fstrim.service
    ExecStart=/usr/sbin/fstrim -av
    '-a' means all. So this is what is calling it.
    Hi
    Been around for awhile (I see on Leap 42.3), just use to be a weekly cron job (well on btrfs because that's what I use)...
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •