Format filesystem FIXME: some file systems require larger image size than default. * btrfs requires 114,294,784 bytes * xfs requires 300MB Potential improvement later: add option to partially fill a block device. mkfs.fat accepts argument as block size (1024B) mkfs.ntfs acc
(filename, fs_type)
| 112 | |
| 113 | |
| 114 | def format_filesystem(filename, fs_type): |
| 115 | """Format filesystem |
| 116 | |
| 117 | FIXME: some file systems require larger image size than default. |
| 118 | * btrfs requires 114,294,784 bytes |
| 119 | * xfs requires 300MB |
| 120 | |
| 121 | Potential improvement later: add option to partially fill a block device. |
| 122 | mkfs.fat accepts argument as block size (1024B) |
| 123 | mkfs.ntfs accepts argument as sector size (512B) |
| 124 | mkfs.ext4 accepts argument as 1024B blocks or with optional suffix like 5G |
| 125 | """ |
| 126 | base_cmd = FS_FORMAT_COMMANDS[fs_type] |
| 127 | exe_path = _resolve_executable(base_cmd[0]) |
| 128 | if not exe_path: |
| 129 | raise FileNotFoundError(base_cmd[0]) |
| 130 | cmd = (exe_path, *base_cmd[1:], filename) |
| 131 | run_or_die(cmd) |
| 132 | |
| 133 | |
| 134 | def make_dirty(mountpoint): |
no test coverage detected