3

I have installed Ubuntu 16.04 on a 32GB pen drive, because my hard disk stopped working. It runs okay from the pen drive, but it sometimes hangs for a few seconds during write operations (and maybe sometimes read operations too) on the pen drive. This frequently causes applications to become unresponsive for around 5 to 15 seconds (they usually turn grey during this time).

Probably enabling write-back caching will help. Does anyone know how to enable caching so that I don't suffer from occasional extremely high write (and maybe read) times?

I realize that this question is a duplicate of How can I change the cache mode of an USB drive?. An answer there says:

You can try remounting the partition with different options, example

sudo mount -o remount,rw,relatime,data=writeback /dev/sda1 /

Another option is to pass the argument via Grub.

Executing the above command gives this error message (in dmesg):

EXT4-fs (sdb1): Cannot change data mode on remount

I don't know how to pass this argument via Grub.

Update:

Here is my /etc/fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdc1 during installation
UUID=75f3da54-9738-4180-8f48-fcef12d8c1ca /               ext4    errors=remount-ro 0       1
/dev/disk/by-label/DELLUTILITY /mnt/DELLUTILITY auto nosuid,nodev,nofail,noauto 0 0
/dev/disk/by-label/Recovery /mnt/Recovery auto nosuid,nodev,nofail,noauto 0 0
/dev/disk/by-label/win7 /mnt/win7 auto nosuid,nodev,nofail,noauto 0 0
/dev/disk/by-label/SPARE /mnt/SPARE auto nosuid,nodev,nofail,noauto 0 0
/dev/disk/by-label/GoFlex /mnt/GoFlex auto nosuid,nodev,nofail,noauto,x-gvfs-show,umask=002,uid=1000,gid=1000 0 0
  • /dev/sda is my non-functional hard disk
  • /dev/sdb is my pen drive.
1
  • Please edit your question and add the content of your /etc/fstab file on the drive you boot from.
    – Byte Commander
    Aug 30, 2016 at 14:07

1 Answer 1

3

If you're using USB 2.0 (I hope you're not) the speed will be much less than that of a typical HDD. Anyway, since you've asked the settings are in /etc/udisks2/IDENTIFIER.conf where IDENTIFIER is the concatenated (and hyphenated) value of disk MODEL and SERIAL.

1. Find the configuration file

You can get the MODEL and SERIAL of your disk by using the command

udisksctl status

It will report something like this

MODEL                     REVISION  SERIAL               DEVICE
--------------------------------------------------------------------------
WDC WD1600BEVT-22ZCT0     11.01A11  WD-WXE808S69993      sda     
HL-DT-ST DVDRAM GSA-T20N  EV02      M2L87NG3612          sr0     

To form the file name, I'll first replace the spaces with - in model. It's now WDC-WD1600BEVT-22ZCT0. And then concatenate the serial with -. The result is WDC-WD1600BEVT-22ZCT0-WD-WXE808S69993. So, in my case the settings file is in /etc/udisks2/WDC-WD1600BEVT-22ZCT0-WD-WXE808S69993.conf

2. Edit configuration file

In that file there should be ini file like entries and Section. Under [ATA] section, create an entry with this key-value WriteCacheEnabled=true.

# See udisks(8) for the format of this file.
[ATA]
WriteCacheEnabled=true

Save the file. The settings should take effect after a reboot.

8
  • I am using USB 2.0. I don't have any USB 3.0 ports. Aug 31, 2016 at 12:12
  • That's making the problem i think. however check the settings
    – Anwar
    Aug 31, 2016 at 12:50
  • /etc/udisks2 is an empty directory (I also checked for hidden files). Aug 31, 2016 at 12:55
  • Then create the files with name suggested and put the settings line in
    – Anwar
    Aug 31, 2016 at 12:57
  • I did that. After reboot, there is no noticeable improvement in firefox. Maybe there is a small improvement in Thunderbird. I'll check out vim soon when I code and tell you if I see an improvement there. These are probably the 3 applications I use the most. Aug 31, 2016 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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