Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some time ago, I moved the folder /usr to its own partition. Before this it had lived in the / partition which has a btrfs filesystem.

Accidentally, I formatted my /usr partition from my Windows XP OS.

Using an Xubuntu LiveCD, I can see there are three snapshots, two of which contain my old /usr.

I am wondering if I can recover my /usr from the snapshots taken by btrfs?

Can I just copy the contents of the snapshot to /usr?

share|improve this question

Thanks to Btrfs and the good snapshots (at least it looks good to me, CoW snapshot of the whole /)

You need to mount the snapshot (it works just like a subvolume) and they copy the files over properly (using rysnc)

Steps (I recommend doing this from a Live DVD/USB system):

  1. mount the snapshot to a temporary mount point, for example /mnt/snapshot

mount -t btrfs -o subvol=apt-snapshot-xxx block_device /mnt/snapshot

  1. then you'll be able to access the contents, old /usr should be under /mnt/snapshot/usr

  2. mount your /usr to a temporary location, for example /mnt/usr

  3. Copy the contents over (be careful with the trailing / of source) from snapshot to your current /usr

sudo rsync -axHAX --progress /mnt/snapshot/usr/ /mnt/usr

Reboot and it should be good.

share|improve this answer

Your Answer


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.