Unified filesystem names by using get_mount_fs_type() function before .format() is called
This commit is contained in:
parent
bb37dae16b
commit
8fae958571
|
|
@ -281,6 +281,9 @@ class Partition:
|
|||
if path is None:
|
||||
path = self.path
|
||||
|
||||
# This converts from fat32 -> vfat to unify filesystem names
|
||||
filesystem = get_mount_fs_type(filesystem)
|
||||
|
||||
# To avoid "unable to open /dev/x: No such file or directory"
|
||||
start_wait = time.time()
|
||||
while pathlib.Path(path).exists() is False and time.time() - start_wait < 10:
|
||||
|
|
@ -296,7 +299,7 @@ class Partition:
|
|||
raise DiskError(f'Could not format {path} with {filesystem} because: {mkfs}')
|
||||
self.filesystem = filesystem
|
||||
|
||||
elif filesystem == 'fat32':
|
||||
elif filesystem == 'vfat':
|
||||
options = ['-F32'] + options
|
||||
|
||||
if (handle := SysCommand(f"/usr/bin/mkfs.vfat {' '.join(options)} {path}")).exit_code != 0:
|
||||
|
|
@ -331,7 +334,7 @@ class Partition:
|
|||
raise DiskError(f"Could not format {path} with {filesystem} because: {handle.decode('UTF-8')}")
|
||||
self.filesystem = filesystem
|
||||
|
||||
elif filesystem == 'ntfs':
|
||||
elif filesystem == 'ntfs3':
|
||||
options = ['-f'] + options
|
||||
|
||||
if (handle := SysCommand(f"/usr/bin/mkfs.ntfs -Q {' '.join(options)} {path}")).exit_code != 0:
|
||||
|
|
|
|||
Loading…
Reference in New Issue