Cannot clone btrfs boot drive with clonezilla

After I ran a balance which resulted in a error message about balancing and read only filesystem, now the filesystem is stuck in read only. A new scan still gives errors:

    ~  sudo btrfs check --repair /dev/sda2                              ✔ 
enabling repair mode
WARNING:

	Do not use --repair unless you are advised to do so by a developer
	or an experienced user, and then only after having accepted that no
	fsck can successfully repair all types of filesystem corruption. Eg.
	some software or hardware bugs can fatally damage a volume.
	The operation will start in 10 seconds.
	Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting repair.
Opening filesystem to check...
Checking filesystem on /dev/sda2
UUID: 17243299-2eab-4c05-9d27-76b0968b95e5
[1/7] checking root items
Fixed 0 roots.
[2/7] checking extents
No device size related problem found
[3/7] checking free space cache
cache and super generation don't match, space cache will be invalidated
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups
Counts for qgroup id: 0/1809 are different
our:		referenced 61069459456 referenced compressed 61069459456
disk:		referenced 61069459456 referenced compressed 61069459456
our:		exclusive 190246912 exclusive compressed 190246912
disk:		exclusive 108769280 exclusive compressed 108769280
diff:		exclusive 81477632 exclusive compressed 81477632
Repair qgroup 0/1809
Repair qgroup status item
found 202921086976 bytes used, no error found
total csum bytes: 187146520
total tree bytes: 3108896768
total fs tree bytes: 2685730816
total extent tree bytes: 204095488
btree space waste bytes: 506857030
file data blocks allocated: 727317250048
 referenced 312141459456
   ~  sudo btrfs rescue chunk-recover -v /dev/sda2                   1 ✘ 
All Devices:
	Device: id = 1, name = /dev/sda2

Scanning: 100533354496 in dev0cmds/rescue-chunk-recover.c:130: process_extent_buffer: BUG_ON `exist->nmirrors >= BTRFS_MAX_MIRRORS` triggered, value 1
btrfs(+0x4eb62)[0x55e9ac8edb62]
btrfs(+0x4f9d7)[0x55e9ac8ee9d7]
/usr/lib/libpthread.so.0(+0x9259)[0x7f3a83017259]
/usr/lib/libc.so.6(clone+0x43)[0x7f3a82f405e3]
zsh: abort      sudo btrfs rescue chunk-recover -v /dev/sda2
   ~  sudo btrfs rescue zero-log /dev/sda2             ABRT ✘  3m 11s  
Clearing log on /dev/sda2, previous log_root 0, level
   ~  sudo btrfs rescue super-recover -v /dev/sda2                                               ✔ 
All Devices:
	Device: id = 1, name = /dev/sda2

Before Recovering:
	[All good supers]:
		device name = /dev/sda2
		superblock bytenr = 65536

		device name = /dev/sda2
		superblock bytenr = 67108864

		device name = /dev/sda2
		superblock bytenr = 274877906944

	[All bad supers]:

All supers are valid, no need to recover
   ~  sudo btrfs rescue fix-device-size /dev/sda2                                              1 ✘ 
No device size related problem found
   ~  sudo mount -w /dev/sda2                                                                 32 ✘ 
    ~  sudo btrfs quota disable /mnt/17243299-2eab-4c05-9d27-76b0968b95e5                         ✔ 
ERROR: quota command failed: Read-only file system

My best guess is that there is still a non recoverable problem with the filesystem, some corruption, that triggers a read only behavior. Have read somewhere that this is normal in such case to prevent further corruption. Bottom line is that my system is most likely non recoverable (hence the warning message at check --repair) and al the hours I have spend solving this problem would be better spend if I did a clean install of 21.1 with inproved btrfs support. Some feedback is still appreciated btw.

p.s. fsarchiver was unsuccessful restoring the image backup…

No I am not trying to image the boot drive from within the booted system. That is clearly said in the first sentences of the opening post. :slight_smile:

I clearly misunderstood something - my apology.

As clonezilla is the topic - have you checked with clonezilla to see if it is a bug?

I just did and with a few keystrokes I got this ticket at clonezilla

It appears to be a problem with clonezilla and btrfs filesystem.

There is an easy way out (i did this already):

  1. Dont do anything rw with the broken btrfs volume

  2. Boot a recovery system (DVD or USB …)

  3. mount your defect btrfs volume as ro (this can be handled already as a snapshot)

  4. List all subvolumes accesible on your volume (take @ or whatever is the subvolume with your data on it. You can browse it ro !!!)

  5. mount a empty backup-btrfs volume rw

  6. transfer the complete btrfs-volume with btrfs send to the new volume.
    This way you won´t loose any data :wink: Best of all, the backup volume can be smaller or larger than the original volume. Only the data actually used has to fit on it

  7. check your backup !
    6.If you think you can fix it. You can try now. But if it fails, you can move on to the next step

  8. reformat the original btrfs volume again with btrfs

  9. mount the backup ro

  10. transfer the backup back with btrfs send

btrfs send only transmits the data that is used and is therefore faster than most other backup programs
Tips for the future:

  • If you are afraid that your data may have been corrupted: use btrfs scrub
  • Please use btrfs balance very sparingly. This is mostly unnecessary and only loads the system. If, btrfs balance, then use it with limits e.g. 50%
  • Take automatic snapshots (e.g. with snapper) every hour if possible. At btrfs it doesn’t cost anything. Snapper can also automatically remove these snapshots after some time.

You can find good information at btrfs at kernel-org and in the arch-wiki

Viel Erfolg :sunglasses:

1 Like

Cool feature. How would the command look like in my case? We are are not trying it from a snapshot right? Those are the only tutorials I could find.

Yess have read multiple posts on that forum. Yesterday I tried to delete old snapshots. No luck because read only…

Ok another update.

I’ve decided to perform a clean install of 21.1. There was no insurance that things will keep on functioning correctly if I would have tried to repair it (assuming that I would get it working again). After almost a year it was time for a fresh start. Did a precausionary full error test with gnome disks utility and a full format of the boot ssd. Things are running fine now and I am have made a backup with clonezilla succesfully after snapshotting with timeshift. Thanks everybody for the help :smiley: