Skip to content

4. Flash Disk Hotplug

Mehran Ahadi edited this page Oct 14, 2015 · 1 revision

Why?

It's recommended to use flash disks as download target to extend the lifetime of main system storage, e.g. SD Card in Raspberry Pi. As you know, it would not be easy to mount/unmount the flash disk. You have to run sudo umount /dev/sda1 && sudo mount /dev/sda1 every time you plug out the disk and plug a new one in. Also, when you plug it out, aria2 daemon won't stop downloading because it won't pay attention to write errors and you'll waste your bandwidth without saving any downloaded data. The goal is to minimize the actions that need human interaction and automate the process.

Using Hotplug feature, you can unplug/plug Flash disk while you are downloading on it. System will automatically unmount and pause download progress on plugging out and then remount and continue downloading whenever it gets plugged back in. This way you can easily disconnect flash disk to free up it's disk space using your PC or even use another one for new downloads and be sure that everything is going on right.

Setting up

You won't need to define anything on /etc/fstab file. Creating a mount point directory like /media/FlashDisk would be necessary. It will do the mounting automatically.

To enable this feature, you should create a mount directory and introduce the path in DOWNLOAD_HOTPLUG option in configuration.sh:

DOWNLOAD_HOTPLUG="/media/FlashDisk"

And obviously select a download directory in the flash disk. For instance:

DOWNLOAD_DIR="/media/FlashDisk/Downloads"

Notes

  • It will automatically handle disks that are connected at boot time.
  • Please do not plug in more than one disk at a time. You may experience unexpected behavior
  • Embedded devices usually have weak CPUs. Give some time between plugging/unplugging to let the OS unmount and detect device changes. About 5 seconds can be enough.
  • This functionality was first implemented using udev events, but then it reimplemented using polling-style detection because of a bug in FUSE filesystems and udev events causing transport endpoint errors.
You can’t perform that action at this time.