Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
  • 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:

  • Run systemrescuecd from a USB stick. Attempt mount
    • Fail. systemrescuecd has an outdated kernel that doesn't do BTRFS well.
  • Run Fedora 16 from existing stick. Attempt mount
    • Fail. Same as above
  • Make a F20 stick and run 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.

share|improve this question
    
Can you mount read only? Get a spare drive, and transfer your data off it, then reinstall. –  Zoredache Jan 15 at 9:27

1 Answer 1

up vote 2 down vote accepted

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).

share|improve this answer
    
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 at 18:47
    
ps. This question is actually ranking pretty high on Google, so hopefully this will help others. :) –  PythonNut Jan 20 at 18:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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