RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 980790 - fstrim returns error "FITRIM ioctl failed: Inappropriate ioctl for device"
Summary: fstrim returns error "FITRIM ioctl failed: Inappropriate ioctl for device"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 980788
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-03 08:54 UTC by bfan
Modified: 2015-03-05 13:42 UTC (History)
3 users (show)

Fixed In Version: libguestfs-1.28.1-1.1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 980788
Environment:
Last Closed: 2015-03-05 13:42:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0303 0 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-03-05 17:34:44 UTC

Description bfan 2013-07-03 08:54:04 UTC
+++ This bug was initially created as a clone of Bug #980788 +++

Description of problem:
fstrim returns error "FITRIM ioctl failed: Inappropriate ioctl for device" in rhel6, through its help output,

"If this support isn't
    present it may give an error or even appear to run but do nothing"

we are not sure, whether it's not support or it's a bug


Version-Release number of selected component (if applicable):
libguestfs-1.20.9-6.el6.x86_64
kernel: 2.6.32-358.el6.x86_64
qemu-kvm-0.12.1.2-2.375.el6.x86_64


How reproducible:
100%


Steps to Reproduce:
[root]# qemu-img create -f qcow2 test.qcow2 100M
[root]# guestfish -a test.qcow2

><fs> run
><fs> mkfs ext2 /dev/sda
><fs> mount /dev/sda /
><fs> df
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                    98036         0     98036   0% /run
/dev                    241996       128    241868   1% /dev
/dev/sda                 99150      1550     92480   2% /sysroot

><fs> fstrim /
libguestfs: error: fstrim: fstrim: /: FITRIM ioctl failed: Inappropriate ioctl for device


Actual results:
fstrim give an error


Expected results:
fstrim works well


Additional info:
in rhel7, fstrim does not give error but do nothing,

><fs> df
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs              97952    76     97876   1% /run
/dev              243196     0    243196   0% /dev
/dev/sda           99150  1550     90432   2% /sysroot

><fs> fstrim /
><fs> df
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs              97952    76     97876   1% /run
/dev              243196     0    243196   0% /dev
/dev/sda           99150  1550     90432   2% /sysroot

Comment 1 Richard W.M. Jones 2014-03-12 14:28:54 UTC
fstrim was in fact broken:

https://github.com/libguestfs/libguestfs/commit/5e105e06be4cc6c88b5d3fc5cf79acb48947e197

Comment 3 RHEL Program Management 2014-03-22 06:44:56 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 6 yuliu 2014-11-10 08:14:24 UTC
Version: libguestfs-1.28.1-1.9.el7.x86_64

Steps:
1. guestfish -a $Guest run : mount /dev/sda1 / : uplaod /raw.img /raw.img
2. check the disk size
guestfish <<EOF
add-drive $Guest format:$Guest_format discard:enable
run
mount-options noatime $mount_device /
rm /raw.img
fstrim /
EOF

3. check the disk size again, and the size is smaller than before.

Verified as above.

Comment 8 errata-xmlrpc 2015-03-05 13:42:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0303.html


Note You need to log in before you can comment on or make changes to this bug.