Trying to set the cache type as "write back" through "echo "write back" > /sys/class/scsi_disk/<disk>/cache_type" does not work. Few logs : #> usb 2-1.4: new high speed USB device using ehci-sdp and address 5 usb 2-1.4: New USB device found, idVendor=152d, idProduct=2339 usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=5 usb 2-1.4: Product: USB to ATA/ATAPI Bridge usb 2-1.4: Manufacturer: JMicron usb 2-1.4: SerialNumber: 3446184AA01C scsi1 : usb-storage 2-1.4:1.0 scsi 1:0:0:0: Direct-Access SAMSUNG HM501IX PQ: 0 ANSI: 2 CCS sd 1:0:0:0: [sda] 976773168 512-byte logical blocks: (500 GB/465 GiB) sd 1:0:0:0: [sda] Write Protect is off sd 1:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sda: #> echo "write back" > /sys/class/scsi_disk/1\:0\:0\:0/cache_type sd 1:0:0:0: [sda] Sense Key : 0x5 [current] sd 1:0:0:0: [sda] ASC=0x20 ASCQ=0x0 #> usb 2-1.4: new high speed USB device using ehci-sdp and address 4 usb 2-1.4: New USB device found, idVendor=0bc2, idProduct=2300 usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 2-1.4: Product: Portable usb 2-1.4: Manufacturer: Seagate usb 2-1.4: SerialNumber: 2GHW02GR scsi0 : usb-storage 2-1.4:1.0 #> #> scsi 0:0:0:0: Direct-Access Seagate Portable 0130 PQ: 0 ANSI: 4 sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] No Caching mode page present sd 0:0:0:0: [sda] Assuming drive cache: write through sd 0:0:0:0: [sda] No Caching mode page present sd 0:0:0:0: [sda] Assuming drive cache: write through sda: sda1 sda2 sda3 sda4 sd 0:0:0:0: [sda] No Caching mode page present sd 0:0:0:0: [sda] Assuming drive cache: write through sd 0:0:0:0: [sda] Attached SCSI disk #> echo "write back" > /sys/class/scsi_disk/0\:0\:0\:0/cache_type sd 0:0:0:0: [sda] No Caching mode page present sd 0:0:0:0: [sda] Assuming drive cache: write through #> #> usb 2-1.4: new high speed USB device using ehci-sdp and address 7 usb 2-1.4: New USB device found, idVendor=1058, idProduct=070a usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 2-1.4: Product: My Passport 070A usb 2-1.4: Manufacturer: Western Digital usb 2-1.4: SerialNumber: 575832314132304534373635 scsi3 : usb-storage 2-1.4:1.0 scsi 3:0:0:0: Direct-Access WD My Passport 070A 1032 PQ: 0 ANSI: 4 scsi 3:0:0:1: CD-ROM WD Virtual CD 070A 1032 PQ: 0 ANSI: 4 scsi 3:0:0:2: Enclosure WD SES Device 1032 PQ: 0 ANSI: 4 sd 3:0:0:0: [sda] 623769600 512-byte logical blocks: (319 GB/297 GiB) sd 3:0:0:0: [sda] Write Protect is off sd 3:0:0:0: [sda] No Caching mode page present sd 3:0:0:0: [sda] Assuming drive cache: write through sd 3:0:0:0: [sda] No Caching mode page present sd 3:0:0:0: [sda] Assuming drive cache: write through sda: sd 3:0:0:0: [sda] No Caching mode page present sd 3:0:0:0: [sda] Assuming drive cache: write through sd 3:0:0:0: [sda] Attached SCSI disk #> cat /sys/class/scsi_disk/3\:0\:0\:0/cache_type write through #> echo "write back" > /sys/class/scsi_disk/3\:0\:0\:0/cache_type #> #> echo "write back" > /sys/class/scsi_disk/3\:0\:0\:0/cache_type #> #> #> cat /sys/class/scsi_disk/3\:0\:0\:0/cache_type write through Regards, Amit Sahrawat On Thu, Oct 6, 2011 at 1:38 AM, James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote: > On Thu, 2011-10-06 at 01:21 +0530, Amit Sahrawat wrote: >> > The best we could probably offer is an interface to turn on the WCE bit >> > in software (technically, you can do this today >> > in /scsi/class/scsi_disk/<disk>/cache_type, it's just that it will try >> > to commit the change as a MODE_SELECT which will presumably fail). >> Thanks James, is this related with SCSI command MODE_SELECT? and this >> is to be passed when there is some failure? >> or simply doing an "echo <value>" to >> /scsi/class/scsi_disk/<disk>/cache_type? can you please elaborate a >> little > > You tell me since you have the device. What that echo does is that it > does try to make the change permanent with a mode select ... that likely > won't work and the cache change only takes if the revalidated disk says > the write back has been enabled (which I really think it won't). So I > think you need an additional software bit to flip for the case where the > device lies. > > James > > > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html