Snapshot is invalid

So having upgraded to 10.13 beta 1 (10.13 Beta (17A264c)) I'm seeing invalid snapshot errors during fsck / boot


Booting single user results in fsck barfing with error 8 and a message about in invalid unecrypted file


Recovery mode does something similar


Running Disk Repair results in this


Verifying file system.

Volume could not be unmounted.

Using live mode.

Performing fsck_apfs -n -l -x /dev/rdisk1s1

Checking volume.

Checking the container superblock.

Checking the EFI jumpstart record.

Checking the space manager.

Checking the object map.

Checking the APFS volume superblock.

Checking the object map.

Checking the fsroot tree.

Checking the snapshot metadata tree.

Checking the extent ref tree.

Checking the snapshots.

Snapshot is invalid.

The volume /dev/rdisk1s1 could not be verified completely.

File system check exit code is 0.

Restoring the original state found as mounted.

Operation successful.



This is a 10.12 upgraded to 10.13 iBin (Late 2013) Mac Pro

Post not yet marked as solved Up vote post of jmorby Down vote post of jmorby
39k views

Answers

I see the same thing

Me too...

Running the command fsck_apfs -n -l /dev/disk1s1 from Terminal (from SU), I found a bad block which is probably originating the error 8...


sh-3.2# fsck_apfs -n -l /dev/disk1s1

fletcher64_init:58: Selecting AVX2 implementation of fletcher64

** Checking volume.

** Checking the container superblock.

** Checking the EFI jumpstart record.

** Checking the space manager.

** Checking the object map.

** Checking the APFS volume superblock.

** Checking the object map.

** Checking the fsroot tree.

** Checking the snapshot metadata tree.

** Checking the extent ref tree.

** Checking the snapshots.

error: fext_val : object (oid 0x14): Bad phys_block_num+len for physical file extent record, phys_block_num 2508084 len 8192

Snapshot is invalid.

** The volume /dev/disk1s1 could not be verified completely.

This seems to be related to/caused by local Time Machine snapshots. Using 'tmutil deleteLocalSnapshots <snapshot_date>' to delete all the local snapshots, I no longer get 'Snapshot is invalid.' So Apple has apparently (and so far, poorly) integrated features for TM directly into APFS. TM, however, seems to be working fine regardless.


Still, even with the local snapshots deleted (and automatic backups disabled to prevent new snapshots from being created), I get the same the same 'error 8' in SU or Recovery mode. As far as I can tell, fsck_apfs (so by extension, Disk Utility and diskutil) isn't able do any repairs right now because it thinks the APFS drive is perpetually mounted. Even booting the 10.13 installer from a flash drive, for the life of me, I couldn't get fsck_apfs to even attempt to repair anything. Seemingly no matter what I did, it would say the drive as a whole (ie /dev/rdisk1) was mounted with write access even with the drive completely ejected. Targeting the main partition (/dev/rdisk1s1), it'd say that live repairs weren't supported yet.


Finally, I'm getting a similar error to what albugna is getting which I have a feeling is related to this https://forums.developer.apple.com/message/232795#232795.

You need to boot in single mode (CMD+S) and then run "fsck_apfs -y /dev/disk..." - don't run anything else before (like fsck_apfs -n) or it will fail.

Indeed! Thank you!

I did just that and still get an error about being able to validate the volume. Any other Ideas?

Did you delete all the local snapshots? Use 'tmutil listLocalSnapshotDates /' and then 'tmutil deleteLocalSnapshots <snapshot_date>' to delete them one by one. For me anyway, fsck_apfs repaired the snapshot count on the first run (from 1 to 0) and then came up clean on the second run (while remaining oblivious to the fact that the freespace on my drive is now off by almost 100GB).


Also, and I don't know if it really matters, but fsck recommends always using the raw device so eg. /dev/rdisk1 instead of /dev/disk1.

Thanks Global,


That worked for me... 🙂

Exactly same problem.

Thanks, Global Odey: By deleting all the snapshots, now I can pass the fsck_apfs test successfully!

Interestingly, this is now happening on 10.13 + Supplemental update. Deleting local snapshots does not solve the problem. Concerned that TM backups may be corrupted.

Sadly, it didn't work for me (running 10.13.2 Beta (17C79a) on a MacBook Pro (Retina, 15-inch, Mid 2014)). I did

tmutil listLocalSnapshotDates /
and it did find one local snapshot, which I deleted as per instructions; then I tried to run
fsck_apfs
again (in SU mode), and it failed at the exact spot with the same error message. This time, however,
tmutil listLocalSnapshotDates /
didn't show anything; by contrast,
tmutil listLocalSnapshots /
gives
com.apple.TimeMachine.2017-11-16-003459 (dataless)
, but I have no way to delete that (assuming it's even possible to do so). Time Machine automatic backups are shut down.

I wonder if the only way out is going the way of reformatting the SSD disk with HFS+...


I'm also exploring a bit with DaisyDisk, and finding lots of interesting garbage to delete (note that I've been progressively upgrading Mac OS X since... 2000. Of course not on the same machine, but I've been keeping settings from machine to machine, and old stuff gets to accumulate...), but I don't think it will find (and delete/fix) hidden snapshots.


Also, I'm a fan of Onyx, which usually fixes almost everything and always recovers a lot of disk space, but, this time, even Onyx gets stumped.