21 lines
806 B
Python
21 lines
806 B
Python
print(f"\nOrphaned roots: {len(true_roots)}")
|
|
print(f"{'inode':>12} {'parent':>12} {'status':>12} {'dtime':>12} reason")
|
|
print('-' * 75)
|
|
|
|
with open(DEV, 'rb') as f:
|
|
for inum, parent, reason in sorted(true_roots):
|
|
try:
|
|
idata, slot = read_inode(f, sb, gdt_data, inum)
|
|
status = classify_inode(idata, slot)
|
|
dtime = struct.unpack_from('<I', idata, slot + 20)[0]
|
|
# Format dtime as human readable if set
|
|
if dtime:
|
|
import datetime
|
|
dt = datetime.datetime.fromtimestamp(dtime).strftime('%Y-%m-%d %H:%M:%S')
|
|
else:
|
|
dt = 'never'
|
|
except Exception:
|
|
status, dt = 'unreadable', 'unknown'
|
|
|
|
print(f"{inum:>12} {parent:>12} {status:>12} {dt:>19} {reason}")
|