Tuesday, June 23, 2015

extra laptop storage - hdd in optical slot, notes: external usb, thunar

Backups are a pain. They can be managed more easily in a laptop by purchasing a $10 drive caddy (photo) into which a backup SATA HDD can be placed.
Once the HDD is in the caddy, the laptop's DVD drive is removed, and the caddy (with the HDD drive) goes into its place.

software steps

First, determine the names of drives in your system. This is easily done with, say, fdisk -l. Using the name of drive, add a line for it in fstab:
# fdisk -l
[suppose result is "sdb1" for caddy drive]

# nano /etc/fstab
/dev/sdb1 /home/media ext3 rw,relatime 0 1

Now the drive will automatically mount each time the system is booted. Once mounted, the drive is an available repository for back-ups. Files can be transferred between the drives using a file manager, or a user might implement a backup schema or program (such as Rsync, eg. with chron).

Note: if you decide to put the optical drive back in the slot, comment the fstab entry for the removed HDD before rebooting, otherwise, it will seek the drive and take several minutes to boot.

external (usb) drives

For the setup above, no special applications are necessary. However, if one is going to use a USB stick or drive, the typical rule applies: you will need to install udisks2, fuser, gvfs or similar bullsh*t, if you don't want to deal with manually mounting these or moving in and out of root. Such applications cause a permission kludge, and may have memory hogging notification daemons that continually poll your system (I dislike .gvfs, notification-daemon is slightly better),but there's little doubt some permutation of these is necessary you're copying to a thumb drive or other USB block device regularly, and want to use a GUI file manager in user-space, without sudoing-up and some CLI skills. In Arch, I use udisks2 in tandem with udiskie (for userspace). Taken together, these are 20Mb:
# pacman -S udisks2 ntfs-3g parted dosfstools udiskie
With these, I can mount any format USB drive, including HFS (Mac).

udisk2 and udiskie note

Links: manual policykit/udiskie config :: systemctl udiskie config
This is a useful app for avoiding fuser, samba, .gvfs, and some others, not needed on stand-alone systems, but it requires configuring. First be sure you're in group "storage" then, for udisks2:
# nano /etc/polkit-1/rules.d/50-udisks.rules
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
var permission = {
// only required for udisks2:
"org.freedesktop.udisks2.filesystem-mount": YES,
"org.freedesktop.udisks2.filesystem-mount-system": YES,
"org.freedesktop.udisks2.encrypted-unlock": YES,
"org.freedesktop.udisks2.eject-media": YES,
"org.freedesktop.udisks2.power-off-drive": YES,
};
if (subject.isInGroup("storage")) {
return permission[action.id];
}
});
Then, for udiskie, somewhere near the end of .xinitrc, but ahead of dbus activation:
$ nano .xinitrc
udiskie &

Thunar note

Supposing this is your file manager for and you've connected a USB drive, you'll also need to install thunar-volman, and to set the permissions (see below) for Thunar to display it.


Select at least the two mounting options I've checked above. The path to this dialog box is: Edit, Preferences, Advanced (tab), Configure.

Finally, if you did install .gvfs, don't forget to exclude it from any dynamic backups or you're in for a world of pain.

No comments: