parent
6fe273cf8b
commit
51b6bd0fdf
1 changed files with 25 additions and 0 deletions
|
|
@ -319,6 +319,11 @@ class DiskObj():
|
|||
attr_type=self.attr_type, **COLORS))
|
||||
report.extend(sorted(self.nvme_smart_notes.keys()))
|
||||
|
||||
# 4K alignment check
|
||||
if not self.is_4k_aligned():
|
||||
report.append('{YELLOW}Warning{CLEAR}'.format(**COLORS))
|
||||
report.append(' One or more partitions are not 4K aligned')
|
||||
|
||||
# Tests
|
||||
for test in self.tests.values():
|
||||
report.extend(test.report)
|
||||
|
|
@ -422,6 +427,26 @@ class DiskObj():
|
|||
'self_test', {}).get(
|
||||
k, {})
|
||||
|
||||
def is_4k_aligned(self):
|
||||
"""Check if partitions are 4K aligned, returns bool."""
|
||||
cmd = [
|
||||
'sudo',
|
||||
'sfdisk',
|
||||
'--json',
|
||||
self.path,
|
||||
]
|
||||
aligned = True
|
||||
|
||||
# Get partition details
|
||||
json_data = get_json_from_command(cmd)
|
||||
|
||||
# Check partitions
|
||||
for part in json_data.get('partitiontable', {}).get('partitions', []):
|
||||
aligned &= part.get('start', -1) % 4096 == 0
|
||||
|
||||
# Done
|
||||
return aligned
|
||||
|
||||
def safety_check(self, silent=False):
|
||||
"""Run safety checks and disable tests if necessary."""
|
||||
test_running = False
|
||||
|
|
|
|||
Loading…
Reference in a new issue