SD Card Transfer very slow

Solution 1:

Sometimes the default IO scheduler treats these flash drives poorly. One solution that I've found to be useful is to switch the ioscheduler to deadline or noop for just that device. So for example,

$ lsscsi 
[0:0:0:0]    disk    ATA      TOSHIBA THNS128G AGLA  /dev/sda
[1:0:0:0]    cd/dvd  HL-DT-ST DVDRAM GT30N     LT09  /dev/sr0
[7:0:0:0]    disk             Patriot Memory   PMAP  /dev/sdb
sudo tee /sys/block/sdb/queue/scheduler << EOF
deadline
EOF
$ cat /sys/block/sdb/queue/scheduler
noop [deadline] cfq 

and now try your data transfer again, you must do this before you load the device.

Should that work for you a udev rule can be created to automatically set this for all usb hotplug devices. Here's one I wrote a long time ago that's a little crufty, I believe it only scans for usb hotplug devices, not MMC cards, so you would have to examine udev output to determine what class your media is in and adjust accordingly.

PROCEED AT YOUR OWN RISK, IF THIS DOESN'T WORK FOR YOU ITS UP TO YOU TO DEBUG

sudo tee /lib/udev/rules.d/100-usb-scheduler.rules << EOF
# custom udev rule: 28.10.11

# adjust io scheduler for usb block devices: queue/scheduler
# scheme based on "persistent storage rules"

# forward scsi device event to corresponding block device
ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"

ACTION!="add|change", GOTO="persistent_storage_end"
SUBSYSTEM!="block", GOTO="persistent_storage_end"

# skip rules for inappropriate block devices
KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end"

# ignore partitions that span the entire disk
TEST=="whole_disk", GOTO="persistent_storage_end"

# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

# USB storage devices suffer from performance issues unless they use deadline io scehduler
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", \
        RUN="/bin/sh -c 'echo deadline > /sys/$env{DEVPATH}/queue/scheduler'"

LABEL="persistent_storage_end"
EOF
$ sudo chmod +x /lib/udev/rules.d/100-usb-scheduler.rules