Skip to content

Instantly share code, notes, and snippets.

@kamawanu
Created December 26, 2010 11:01
Show Gist options
  • Save kamawanu/755352 to your computer and use it in GitHub Desktop.
Save kamawanu/755352 to your computer and use it in GitHub Desktop.
append fstab from current mount
#!/bin/bash -x
# https://gist.github.com/755352
for DEV in $( mount | awk '{print $1}'|fgrep /dev/ )
do
PUREDEV=$( echo $DEV | cut -d/ -f3- )
UUIDIS=$( ls -l /dev/disk/by-uuid/ | fgrep $PUREDEV | awk '{print $8}' )
fgrep $UUIDIS /etc/fstab || (
echo $UUIDIS
echo UUID=$UUIDIS $( mount | fgrep $PUREDEV | awk '{print $3,$5}') defaults,noatime 0 0 | sudo tee -a /etc/fstab
)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment