TRIM/DISCARD for usb drives?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a SanDisk Extreme USB Flash Drive
(http://www.sandisk.com/products/usb/drives/extreme/), which does NOT
support UASP so is running under "usb-storage".

According to `hdparm`, it seems to supports TRIM; and according to
`sg3_opcodes`, it seems to support ATA Pass-Through (12/16). However,
all TRIM/DISCARD related ioctl doesn't work with it at all.

So my question is, is TRIM/DISCARD possible at all in linux for usb
drives? If so, what are the requirements? If not, is it just not
implemented yet or an inherit problem of usb which cannot be fixed?

P.S. Although there's an SG_IO error, ATA Secure Erase seems to works
according to hexdump, and the drive is NOT bricked after many trials.

[tom@localhost ~]$ sudo blkdiscard /dev/sdc
blkdiscard: /dev/sdc: BLKDISCARD ioctl failed: Operation not supported
[tom@localhost ~]$ sudo blkdiscard -s /dev/sdc
blkdiscard: /dev/sdc: BLKSECDISCARD ioctl failed: Operation not supported
[tom@localhost ~]$ sudo mount /dev/sdc1 /mnt/
[tom@localhost ~]$ sudo fstrim /mnt/
fstrim: /mnt/: the discard operation is not supported
[tom@localhost ~]$ sudo hdparm -I /dev/sdc

/dev/sdc:

ATA device, with non-removable media
    Model Number:       SanDisk pSSD
    Serial Number:      0a1e4434c
    Firmware Revision:  3
    Transport:          Serial, ATA8-AST, SATA Rev 2.6
Standards:
    Used: ATA-8-ACS revision 2d
    Supported: 8 7 6 5
Configuration:
    Logical        max    current
    cylinders    16383    16383
    heads        16    16
    sectors/track    63    63
    --
    CHS current addressable sectors:   16514064
    LBA    user addressable sectors:   61282631
    LBA48  user addressable sectors:   61282631
    Logical  Sector size:                   512 bytes
    Physical Sector size:                   512 bytes
    device size with M = 1024*1024:       29923 MBytes
    device size with M = 1000*1000:       31376 MBytes (31 GB)
    cache/buffer size  = unknown
    Form Factor: 1.8 inch
    Nominal Media Rotation Rate: Solid State Device
Capabilities:
    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 1    Current = 1
    Advanced power management level: disabled
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled    Supported:
       *    SMART feature set
            Security Mode feature set
       *    Power Management feature set
            Write cache
            Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    NOP cmd
       *    DOWNLOAD_MICROCODE
            Advanced Power Management feature set
       *    48-bit Address feature set
       *    Device Configuration Overlay feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    SMART error logging
       *    SMART self-test
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    64-bit World wide name
       *    WRITE_UNCORRECTABLE_EXT command
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    Gen3 signaling speed (6.0Gb/s)
       *    Native Command Queueing (NCQ)
       *    Software settings preservation
       *    DEVICE CONFIGURATION SET/IDENTIFY DMA commands
       *    Data Set Management TRIM supported (limit 8 blocks)
       *    Deterministic read ZEROs after TRIM
Security:
    Master password revision code = 65534
        supported
    not    enabled
    not    locked
    not    frozen
    not    expired: security count
    not    supported: enhanced erase
    2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5001b400e4a14c43
    NAA        : 5
    IEEE OUI    : 001b40
    Unique ID    : 0e4a14c43
Checksum: correct
[tom@localhost ~]$ sudo sg_opcodes /dev/sdc
  SanDisk   Extreme           0001
  Peripheral device type: disk

Opcode  Service    CDB    Name
(hex)   action(h)  size
-----------------------------------------------
 00                  6    Test Unit Ready
 03                  6    Request Sense
 04                  6    Format Unit
 08                  6    Read(6)
 0a                  6    Write(6)
 12                  6    Inquiry
 15                  6    Mode select(6)
 1a                  6    Mode sense(6)
 1b                  6    Start stop unit
 1d                  6    Send diagnostic
 1e                  6    Prevent allow medium removal
 23                 10    Read Format capacities
 25                 10    Read capacity(10)
 28                 10    Read(10)
 2a                 10    Write(10)
 2f                 10    Verify(10)
 35                 10    Synchronize cache(10)
 3b                 10    Write buffer
 3c                 10    Read buffer
 43                 10    Read TOC/PMA/ATIP
 55                 10    Mode select(10)
 5a                 10    Mode sense(10)
 85                 16    ATA pass-through(16)
 88                 16    Read(16)
 8a                 16    Write(16)
 8f                 16    Verify(16)
 91                 16    Synchronize cache(16)
 9e       10        16    Read capacity(16)
 a0                 12    Report luns
 a1                 12    ATA pass-through(12)
 a2                 12    Security protocol in
 a3        c        12    Report supported operation codes
 a8                 12    Read(12)
 aa                 12    Write(12)
 af                 12    Verify(12)

[tom@localhost ~]$ sudo hdparm --security-set-pass wipe /dev/sdc
security_password: "wipe"

/dev/sdc:
 Issuing SECURITY_SET_PASS command, password="wipe", user=user, mode=high
[tom@localhost ~]$ sudo hdparm --security-erase wipe /dev/sdc
security_password: "wipe"

/dev/sdc:
 Issuing SECURITY_ERASE command, password="wipe", user=user
SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 40 00 0a 00 00 00
00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux