Created
January 17, 2018 15:06
-
-
Save stbuehler/ba92524598f97847e5250126b133e76e to your computer and use it in GitHub Desktop.
Use UUID instead of block device paths in /etc/fstab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for bdev in $(blkid -o device); do | |
if [ ! -b "${bdev}" ]; then | |
echo >&2 "Not a block device: ${bdev}" | |
continue | |
fi | |
uuid=$(blkid -o value -s UUID -- "${bdev}") | |
# echo "Found UUID '${uuid}' for '${bdev}'" | |
# block device names hopefully don't contain special shit -.- | |
sed -i -e "s#^${bdev}\b#UUID=${uuid}#g" /etc/fstab | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment