Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have installed one SSD disk (Micron C400-MTFDDAC128MAM) in an external usb 3.0 enclosure. Now I want use this disk as second disk in my laptop with Ubuntu 12.04. Disk is working, but I want to use TRIM suppport which is not working as expected.

Check for trim support:

user@server:~$ sudo hdparm -I /dev/sdc | grep -i TRIM
       *    Data Set Management TRIM supported (limit 8 blocks)
       *    Deterministic read data after TRIM

Disk was mounted with following options:

/dev/sdc1 on /media/MICRON type ext4 (rw,nosuid,nodev,uhelper=udisks)

But when I run the trim command manually I get an error:

user@server:~$ sudo fstrim -v /media/MICRON/
fstrim: /media/MICRON/: FITRIM ioctl failed: Operation not permitted

I used this disk before as an internal disk and trim was working, please assist me thank you.

here some USB details:

[ 1039.248050] usb 4-1: new SuperSpeed USB device number 4 using xhci_hcd
[ 1039.265597] scsi8 : usb-storage 4-1:1.0
[ 1041.547879] scsi 8:0:0:0: Direct-Access     C400-MTF DDAC128MAM       0509 PQ: 0 ANSI: 5
[ 1041.549134] sd 8:0:0:0: Attached scsi generic sg2 type 0
[ 1041.550511] sd 8:0:0:0: [sdc] 250069680 512-byte logical blocks: (128 GB/119 GiB)
[ 1041.550778] sd 8:0:0:0: [sdc] Write Protect is off
[ 1041.550785] sd 8:0:0:0: [sdc] Mode Sense: 23 00 00 00
[ 1041.552520] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1041.552528] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1041.554029] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1041.554035] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1041.678373]  sdc: sdc1
[ 1041.679982] sd 8:0:0:0: [sdc] No Caching mode page present
[ 1041.679991] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1041.679997] sd 8:0:0:0: [sdc] Attached SCSI disk

How to find out if the mass storage device using the UASP (USB Attached SCSI Protocol) which should support TRIM?

Kind regards

Luckyrings

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

Your SSD reports to hdparm to support TRIM (hdparm -I = Request identification info directly from the drive).

TRIM however, is controlled by the drive controller.

It is quite likely that the USB3 harddiskcontroller of the external HDD closure doesn't support TRIM (most external controllers don't).

In that case you won't get any TRIM capabilities even if your SSD does support it.

share|improve this answer
    
USB3 has brought a new protocol: UASP (USB Attached SCSI Protocol) for communication with external mass storage devices over USB. The old protocol BOT (Bulk Only Transport) does not support TRIM. UASP supporting TRIM and NCQ.Question is how can I find out that the OS is using UASP with the external drive? –  Luckyrings Mar 8 '13 at 23:37
    
@Luckyrings Please ask a new question and Link to this question if it helps provide conetxt. –  Uri Herrera Mar 8 '13 at 23:48
add comment

This is a software issue, Linux does not seem to currently support TRIM through USB. The problem is that USB storage devices employ the SCSI command set, whereas the SSD drive implements the ATA command set. The USB enclosure has to provide a translator between these command sets. The operation called TRIM in ATA is called UNMAP in SCSI and DISCARD in the Linux kernel. When Linux receives the command to trim a device, it looks up the correct command to be sent to the device. As USB storage devices look like SCSI disks, Linux tries to use UNMAP or a couple of other possible SCSI commands. In principle, the translator in the USB enclosure could often translate UNMAP requests to the corresponding ATA TRIM, although there are probably tricky cases. In practice, the enclosures don't do this, and they indicate instead that the device does not support UNMAP. However, many enclosures implement a SCSI command to issue ATA commands directly to the device. It is called ATA passthrough. There is a standard command to do this, but some enclosures have a proprietary command instead. In fact, hdparm -I uses ATA passthrough to get information from the device. The same passthrough could be used to issue TRIMs directly to the device, but the Linux driver does not currently do that. It would have to detect that a SCSI disk is actually a SCSI-to-ATA translator that supports ATA passthrough and use the passthrough for DISCARDs instead of the native SCSI commands.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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