MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / format_filesystem

Function format_filesystem

tests/TestWipePath.py:114–131  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

112
113
114def 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
134def make_dirty(mountpoint):

Callers 1

wipe_helperFunction · 0.85

Calls 2

_resolve_executableFunction · 0.85
run_or_dieFunction · 0.85

Tested by

no test coverage detected