Skip to content

Instantly share code, notes, and snippets.

@bruvv
Created December 6, 2019 18:12
Show Gist options
  • Save bruvv/d9edd4ad6d5548b724d44896abfd9f3f to your computer and use it in GitHub Desktop.
Save bruvv/d9edd4ad6d5548b724d44896abfd9f3f to your computer and use it in GitHub Desktop.
Synology BTRFS repair
btrfs fi show -d
(/dev/mapper/vg1000-lv)
syno_poweroff_task -d
(or: umount /volume1)
(or2: umount /volume1 -f -k)
Check to see if all us unmounted:
df -h
mdadm --stop /dev/vg1000/lv
btrfsck /dev/vg1000/lv
btrfs check --repair /dev/vg1000/lv
btrfs rescue super-recover -v /dev/vg1000/lv
vgchange -ay
e2fsck -nvf -C 0 /dev/vg1000/lv
fsck.ext4 -pvf -C 0 /dev/vg1000/lv
(or: e2fsck -pvf -C 0 /dev/vg1000/lv -C O)
(do not do this: -C fd)
@ThoBekMic
Copy link

If btrfs check --repair errors out with "couldn't open RDWR because of unsupported option features", you can try clearing the space cache with btrfs check --clear-space-cache v2 or btrfs check --clear-space-cache v1, and retrying the btrfs check --repair.

YMMV. If you break it, you own the pieces, and by the time you need --repair chances are that it broke beyond repair already :-)

I've been battling this issue for literally weeks. Clearing the space caches and doing a repair fixed my issue with no data loss!

Thank you SO much!

@Invisi
Copy link

Invisi commented May 20, 2024

Greetings from 2024 with a DS1819+ running DSM 7.2.1-69057 Update 3.
Had some corrupted leaves and managed to get btrfs check /dev/mapper/cachedev_0 running by unmounting via synostgvolume --unmount -p /volume1 as mentioned in this xpenology thread and above. It did not shut down SSH for me.

Additionally, I couldn't run btrfs on /dev/vg1000/lv or /dev/md2, only /dev/mapper/cachedev_0 worked properly for unknown reasons. Good luck to you all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment