I have an extremely critical set of circumstances. I installed snapper on my Fedora 20 box. It created around 20 snapshots. My btrfs partition is now full of snapper subvolumes. My partition became unwritable (it's full). The OS is now unbootable (even to runlevel 1).

I tried (while OS was still bootable)

  • Kill snapper, delete files
    • Space not recovered due to snapshots.
  • Reboot to runlevel 3
    • Fail (boot hang)
  • Reboot to runlevel 1, issue snapper delete N
    • Fail (Snapper requires dbus)
  • OS becomes unbootable.

Then I tried:

  • Make a Fedora 20 live stick and mount from that
    • Try to rm and true > file files
      • Fail. Files are duplicated in snapshot
    • Try to delete in snapshot
      • Fail. Snapshots are read-only
    • Try to btrfs subvolume delete snapshots (.snapshots/N/snapshot)
      • Fail. It says "No space left on device"
    • Try to btrfs subvolume delete parent subvolume (".snapshots")
      • Fail. It says "Directory not empty"
    • Try btrfs fi balance . -dusage=5
      • Fail. says it's deprecated
    • Try btrfs balance start .
      • Fail. It says "No space left on device"
    • Try btrfs balance start . -dusage=5
      • Fail. Says "Done, had to relocate 0 out of 90 chunks", but nothing has changed.

The Filesystem is also possibly corrupt. btrfsck returns mostly minor errors.

I'm almost out of hope. The system is important to me, and it seems lost. Can I save it by some miracle?

I have multiple computers, hard drives, usb sticks, and as much time as it takes.

  • Can you mount read only? Get a spare drive, and transfer your data off it, then reinstall. – Zoredache Jan 15 '14 at 9:27
  • With BTRFS it's crucial to use a current version, especially for rescue scenarios like this one, so don't use an old boot disk that you've found somewhere. Download a fresh live system like Arch (which is usually pretty up to date). Or Fedora, which comes with a graphical desktop. Or Parted Magic. – basic6 Nov 14 '15 at 16:08

If you have a spare hard drive with more storage than your current drive you can try to:

  1. Boot from a LiveCD (Fedora or something with at least same btrfs version support would be great)
  2. Copy the btrfs filesystem to the new hard drive
  3. Detect the new filesystem
  4. Use btrfs filesystem resize to increase the amount of space in the storage pool.
  5. With increased space there should be "space left on device", delete as many snapshots as you don't mind.

If you can't still manage to get enough space, or you don't have a single hard drive with more storage, but you have two drives with at least the same storage capabilities, you can try to:

  1. Copy the btrfs filesystem to one of the new hard drives
  2. Configure the new btrfs filesystem to use a new storage pool in the second hard drive
  3. Rebalance (btrfs balance start .)
  4. Now you should have almost half of the combined space free.

I wouldn't recommend this approach with the original partition + another drive, because if you corrupt the original partiton (while rebalancing, for example) there might no be another chance for recovery.

If you don't actually mind about the data in the snapshots it might be easier to just copy the contents to another btrfs partition or an ext4 one, mkfs again and transfer the files back.

This way should be faster (if you don't mind snapshots) because you don't have to modify the metadata tree (if mounted read-only).

  • Thank you! I actually tried several variations of this: [move /boot to another disk, resize partition with gparted], [move with dd to other partition which is larger, and move back]. Unfortunately, somehow I reassembled the whole thing wrong and it still wouldn't boot. I'm now running a shiny new F20 install, and all is well (no data was lost). Thanks for your time! – PythonNut Jan 20 '14 at 18:47
  • ps. This question is actually ranking pretty high on Google, so hopefully this will help others. :) – PythonNut Jan 20 '14 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.