Initial remote commit
This commit is contained in:
20
test/check_deleted_orphans.py
Normal file
20
test/check_deleted_orphans.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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}")
|
||||
Reference in New Issue
Block a user