summaryrefslogtreecommitdiffstats
path: root/src/utils/disk.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/disk.py')
-rw-r--r--src/utils/disk.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/disk.py b/src/utils/disk.py
index 6955560..d7706fe 100644
--- a/src/utils/disk.py
+++ b/src/utils/disk.py
@@ -95,3 +95,14 @@ def get_disk_id(disk_index):
if proc.returncode != 0:
raise OgError(f'failed to query disk UUID for {disk_path}')
return proc.stdout.strip()
+
+
+def get_filesystem_id(disk_index, part_index):
+ device = get_partition_device(disk_index, part_index)
+ cmd = f'blkid -s UUID -o value {device}'
+ proc = subprocess.run(shlex.split(cmd),
+ stdout=subprocess.PIPE,
+ encoding='utf-8')
+ if proc.returncode != 0:
+ raise OgError(f'failed to query filesystem UUID for {device}')
+ return proc.stdout.strip()