summaryrefslogtreecommitdiffstats
path: root/src/linux/ogOperations.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-04-25 14:03:29 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-05-02 17:31:08 +0200
commitdd999bfe34e7f812d4ce61828f262ee06b5d4fa4 (patch)
tree587d17a5f5226f53892e0413bdd36c0e5c2f1c1d /src/linux/ogOperations.py
parent22dce48d3ec27d0db8f6a069744d44454382bcc4 (diff)
utils: rewrite ogReduceFs
Drop subprocess call to bash function ogReduceFs. Use a native python solution with subprocess calls to the required underlying tools. Use get_filesystem_type to get the filesystem from a partition and call the corresponding supported filesystem shrink function. Filesystem specific functions are declared "_reduce_{filesystem}" and should not be imported elsewhere. In case of NTFS filesystems, the output of 'ntfsresize' is processed directly. This is dirty, but we can expect no changes to the output strings if we read the following comment in the nftsresize.c source code: https://github.com/tuxera/ntfs-3g/blob/edge/ntfsprogs/ntfsresize.c#L12 ntfsresize requires to do previous dry-run executions to confirm that the resizing is possible. If a dry-run fails but a 10% increase in size is still smaller than original filesystem then retry the operation until dry-run reports sucess or the size increase is bigger than original. If resizing to a smaller ntfs filesystem is not possible then ogReduceFs will do nothing.
Diffstat (limited to 'src/linux/ogOperations.py')
0 files changed, 0 insertions, 0 deletions