From f42e2ba201c33d36a9e528ec2f3f217d02a8184b Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Mon, 6 May 2024 18:07:41 +0200 Subject: live: partprobe breaks with mounted partitions partprobe requires that all disk partitions are unmounted. partprobe needs to be called to report the OS that the partition table has changed, otherwise ogclient reports incorrect partition information. iterate over the partition list and mount cache after partprobe is called. --- src/live/ogOperations.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index a72a842..86470aa 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -346,7 +346,6 @@ class OgLiveOperations: cxt.add_partition(pa) cxt.write_disklabel() - subprocess.run(['partprobe', f'/dev/{diskname}']) for part in partlist: if part["filesystem"] == 'EMPTY': @@ -358,10 +357,20 @@ class OgLiveOperations: partition = int(part["partition"]) if fs == 'cache': mkfs('ext4', int(disk), partition, label='CACHE') - init_cache() else: mkfs(fs, int(disk), partition) + ret = subprocess.run(['partprobe', f'/dev/{diskname}']) + logging.info(f'partprobe /dev/{diskname} reports {ret.returncode}') + + for part in partlist: + if part["filesystem"] == 'EMPTY': + continue + + fs = part["filesystem"].lower() + if fs == 'cache': + init_cache() + logging.info('Partition setup command OK') result = self.refresh(ogRest) -- cgit v1.2.3-18-g5258