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.
master
OpenGnSys Support Team 2024-05-06 18:07:41 +02:00
parent 170d7e1be9
commit f42e2ba201
1 changed files with 11 additions and 2 deletions

View File

@ -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)