disk-unmount-daemon is a universal systemd service + shell script that automatically stops ongoing processes and unmounts selected disk partitions before shutdown, reboot, or halt.
It prevents:
- β Filesystem corruption
- β Bad sectors
- β Lost data during power cuts
Works with any filesystem: ext4, NTFS, FAT32, exFAT, Btrfs, etc.
- π‘ Automatically unmounts drives before shutdown
- π Works on any filesystem / OS partition
- π Logs all unmount attempts to
/var/log/unmount-windows-drives.log - π§Ή Log trimmed to last 10 entries
- β‘ Forces unmount with
umount -f - π§ Minimal, reliable, and easy to customize
| File | Description |
|---|---|
safe-unmount.sh |
Script to unmount drives and log actions |
safe-unmount.service |
systemd service for auto-unmount |
safe-unmount-setup.sh |
Optional interactive setup installer |
sudo cp safe-unmount.sh /usr/local/bin/
sudo chmod +x /usr/local/bin/safe-unmount.sh
sudo cp safe-unmount.service /etc/systemd/system/ _ _ _ _ _
__| (_)___| | __ _ _ _ __ _ __ ___ ___ _ _ _ __ | |_ __| | __ _ ___ _ __ ___ ___ _ __
/ _` | / __| |/ /____| | | | '_ \| '_ ` _ \ / _ \| | | | '_ \| __|____ / _` |/ _` |/ _ \ '_ ` _ \ / _ \| '_ \
| (_| | \__ \ <_____| |_| | | | | | | | | | (_) | |_| | | | | ||_____| (_| | (_| | __/ | | | | | (_) | | | |
\__,_|_|___/_|\_\ \__,_|_| |_|_| |_| |_|\___/ \__,_|_| |_|\__| \__,_|\__,_|\___|_| |_| |_|\___/|_| |_|