mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
daemon: inspect: Resolve Ubuntu 22+ /dev/disk/by-uuid/ in fstab
Ubuntu 22= uses /dev/disk/by-uuid/ followed by a filesystem UUID in fstab entries. Resolve these to mountables. A typical fstab entry looks like this: # /boot was on /dev/vda2 during curtin installation /dev/disk/by-uuid/b4e56462-5a64-4272-b76d-f5e58bd8f128 /boot ext4 defaults 0 1 The comment is generated by the installer and appears in the fstab. This entry would be translated to /dev/sda2.
This commit is contained in:
committed by
rwmjones
parent
6fb268997e
commit
7a1ffd744b
@@ -394,6 +394,19 @@ and resolve_fstab_device spec md_map os_type =
|
||||
resolve_diskbyid part default
|
||||
)
|
||||
|
||||
(* Ubuntu 22+ uses /dev/disk/by-uuid/ followed by a UUID. *)
|
||||
else if String.is_prefix spec "/dev/disk/by-uuid/" then (
|
||||
debug_matching "diskbyuuid";
|
||||
let uuid = String.sub spec 18 (String.length spec - 18) in
|
||||
try
|
||||
(* Try a filesystem UUID. Unclear if this could be a partition UUID
|
||||
* as well, but in the Ubuntu guest I tried it was an fs UUID XXX.
|
||||
*)
|
||||
Mountable.of_device (Findfs.findfs_uuid uuid)
|
||||
with
|
||||
Failure _ -> default
|
||||
)
|
||||
|
||||
else if PCRE.matches re_freebsd_gpt spec then (
|
||||
debug_matching "FreeBSD GPT";
|
||||
(* group 1 (type) is not used *)
|
||||
|
||||
Reference in New Issue
Block a user