If file system is dirty, can I safely delete files in .Trashes folder of an external HDD to speed up fsck?

0

I got a brand new HDD, formatted in exFAT, I was moving folders to it and it happened that something got corrupted when I opened more threads to copy files there.

I know the directory that faulted (it got stucked, maybe for hundred thousands files in it). I tried to remove it (was moved on .Trash folder on mac).

But could not erase files. So I unplugged the HDD, thinking no process was running.

Now:

sudo fsck_exfat -q /dev/disk1s2

reports file system dirty

sudo fsck_exfat -gd /dev/disk1s2

I see that it goes through the long list of files listed in the ./Thrashes/

folder of the external HDD

I wonder if I could do:

rm -r ./Thrashes/*

to remove all files in thrash, and run again fsck to make the process faster.

Or is it better to avoid and let fsck complete, since file system is dirty ?

I also occasionally see lines:

Read      offset = 0x000005200000  length = 0x040000

Does it mean is an error, or simply an information ?

this is the log I got:

sudo fsck_exfat -gd /dev/disk1s2
Opening /dev/rdisk1s2
(S,"Checking volume.",0)
(S,"Checking main boot region.",0)
7813556224 total sectors; 512 bytes per sector
FAT starts at sector 32768; size 131072 sectors
15260532 clusters starting at sector 163840; 262144 bytes per cluster
Root directory starts at cluster 11
Read      offset = 0x000001000000  length = 0x001000
(S,"Checking system files.",0)
Read      offset = 0x000005240000  length = 0x040000
(S,"Volume name is %1$@.",1)
luigi4T
Found active bitmap; first cluster 2, length 1907567
(S,"Checking upper case translation table.",0)
Read      offset = 0x000005200000  length = 0x040000
Found upcase table; starting cluster 10, length 5836
(S,"Checking file system hierarchy.",0)
Directory /
File      /._.Trashes
Directory /.Trashes
Directory /.fseventsd
Directory /.Spotlight-V100
Directory /.TemporaryItems
Directory /20190318 BackUp
File      /.com.apple.timemachine.donotpresent
File      /._.com.apple.timemachine.donotpresent
File      /._.TemporaryItems
File      /.apdisk
File      /._.apdisk
Read      offset = 0x000005280000  length = 0x040000
Directory /.Trashes/501
File      /.Trashes/._501
Read      offset = 0x000005300000  length = 0x040000
File      /.fseventsd/fseventsd-uuid
File      /.fseventsd/0000000002073ca7
File      /.fseventsd/0000000002089d5c
...
# files I'd like to remove from Thrashes folder, *before* running a files system check again
...
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm2219_9_Assassinio_per_cause_naturali.jpg
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm2219_imm_Assassinio_per_cause_naturali.jpg
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm221_0_Accordi_sul_palcoscenico.jpg
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm221_10_Accordi_sul_palcoscenico.jpg
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm221_1_Accordi_sul_palcoscenico.jpg
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm221_2_Accordi_sul_palcoscenico.jpg
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm221_3_Accordi_sul_palcoscenico.jpg
File      /.Trashes/501/WatchDiscovery 10.01.36 AM/backup Jan 21, 2012/Posters_cleaned/mm221_4_Accordi_sul_palcoscenico.jpg

.... ....


If matters, mac OS version 1.9.5

user305883

Posted 2019-03-20T21:54:43.343

Reputation: 121

Didn't fsck fix the errors when it finished running? Are these new errors that keep showing up? If none of the data on the drive is important, I don't see a reason to not try deleting stuff even if the filesystem is a little messed up, the worst that can happen is deleting everything anyway – Xen2050 – 2019-03-20T22:03:03.503

Answers

1

If a filesystem was unmounted dirty, there's no way to know exactly what, if anything, might have been left inconsistent/corrupt about the filesystem's data structures, so it is considered unsafe to mount it read/write at all until it has been fsck'd and fixed. So, no, it's not considered safe to in any way modify a dirty-unmounted filesystem before it's been fsck'd, even if you're just deleting files that you had previously moved to the trash.

Spiff

Posted 2019-03-20T21:54:43.343

Reputation: 84 656

Thank you @Spiff. Test finished with Read offset = 0x0000051c0000 length = 0x040000 0 clusters were marked used, but not referenced 0 clusters were marked used and CLUST_BAD 0 clusters were marked free, but referenced (S,"Rechecking main boot region.",0) (S,"Rechecking alternate boot region.",0) (S,"The volume %1$@ appears to be OK.",1) Is volume OK or not? (See exit code 1). I ejected the disk with diskutil; unplugged; plugged it again; ps aux | grep disk1 I see mac launches automatically /System/Library/Filesystems/exfat.fs/Contents/Resources/./fsck_exfat -y /dev/rdisk1s2 – user305883 – 2019-03-21T08:40:38.677