Linux PERSISTENT NAMING
Last updated
Was this helpful?
Was this helpful?
UUID=356fdf58-6923-43d5-9a09-349159c7c8a6 /data/disk1 ext4 defaults,noatime 0 0
UUID=3b93fbad-bea2-4cbb-9a76-b4885924d287 /data/disk1 ext4 defaults,noatime 0 0#!/bin/bash
#By Junyangz AT 2018-07-16 16:58:15 for reconfigure fstab with uuid.
timestamp=$(date +"%Y-%m-%d")
cp /etc/fstab /etc/fstab-${timestamp}
for DEV in $( cat /etc/fstab | awk '{print $1}' | fgrep /dev/ )
do
PUREDEV=$( echo $DEV | cut -d/ -f3- )
UUIDIS=$( ls -l /dev/disk/by-uuid/ | fgrep $PUREDEV | awk '{print $9}' )
UUID=$( echo UUID=${UUIDIS} )
sed -i "s|$DEV|$UUID|g" /etc/fstab
done