forked from jetsonhacks/bootFromUSB
-
Notifications
You must be signed in to change notification settings - Fork 23
/
partUUID.sh
executable file
·36 lines (33 loc) · 1.15 KB
/
partUUID.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Copyright (c) 2016-2021 Jetsonhacks
# MIT License
# print out the PARTUUID of the given disk partition
# PARTUUID is a partition table level UUID for the partition, a feature of GPT partitioned disks
# UUID is a file system UUID which is retrieved from the filesystem metadata inside a partion
PARTITION_TARGET="/dev/sda1"
function usage
{
echo "usage: ./partUUID.sh [partition [-p partition ] | [-h]]"
echo "-p | --partition ; default /dev/sda1"
echo "-h | --help This message"
}
# Iterate through command line inputs
while [ "$1" != "" ]; do
case $1 in
-p | --partition ) shift
PARTITION_TARGET=$1
;;
-h | --help ) usage
exit
;;
* )
;;
esac
shift
done
PARTUUID_STRING=$(sudo blkid -o value -s PARTUUID $PARTITION_TARGET)
echo PARTUUID of Partition: $PARTITION_TARGET
echo $PARTUUID_STRING
echo
echo Sample snippet for /boot/extlinux/extlinux.conf entry:
echo 'APPEND ${cbootargs} root=PARTUUID='$PARTUUID_STRING rootwait rootfstype=ext4