Tag Archives: systemd

Automatically mount/dismount USB hdd with lvm

So I got me a 4TB external HDD so I can use Docker on my work laptop without running into a panicked state of being out of disk space every month or so.

I set up an lvm using pvcreate / vgcreate / lvcreate as detailed on my devops/sysadmin wiki.

Since this is a laptop I can’t really keep the HDD connected at all time. Just pulling the cord results in nasty I/O errors, or so I’ve heard. >_>;;;

Don’t do that.

I prepared a matching pair of bash files to detach and attach the volumes.



To have these scripts run when my computer suspends and wakes up, respectively, I need to add a file to /lib/systemd/system-sleep/


Ok. Almost there. I also want an easy way to run these scripts when I wanna take the laptop to a meeting. I added launcher icons to my window manager, and added the following in my sudoers file: