#!/bin/bash
## get-uuids.sh
## run as root (i.e. sudo sh get-uuids.sh)
# because vol_id and parted commands require root privileges
# but will not alter anything as used in this script
echo
echo extended partitions do not have uuids and are not mountable:
for extended in `cat /proc/partitions | grep -v '[0-9]$' | awk '{print $4}' | grep '^[sh]d'` ; do echo $extended`parted /dev/$extended print | grep extended | awk '{print $1}' 2>/dev/nul` = extended partition ; done
extendeds=$extended`parted /dev/$extended print | grep extended | awk '{print $1}'`
echo
echo swap spaces \(virtual memory\) do have uuids:
for swaps in `cat /proc/swaps | grep [0-9] | awk '{print $1}'` ; do echo UUID \(`echo $swaps | cut -d/ -f 3` =\> swap\) = `vol_id -u $swaps 2>/dev/nul` ; done
echo
echo regular partitions \(primary or logical\) also have uuids:
for partition in `cat /proc/partitions | grep '[0-9]$' | awk '{print $4}' | grep -v $extendeds` ; do ( echo UUID \($partition =\> `df -l -x tmpfs -x usbfs | grep -w $partition | awk '{print $6}'`\) = `vol_id -u /dev/$partition 2>/dev/nul` ) ; done
