Skip to content

Manual data recovery

Overview

This Document will show you how to perform data recovery on a cloud instance

Prerequisites

Create and download a snapshot

To recover data from an existing instance, we have to create a snapshot first.

openstack server image create <server uuid> --name <snapshot name> --wait

We can download the snapshot now. This can take a while.

openstack image save --file snapshot.qcow <snapshot name>

We can access the snapshot's contents via nbd.

sudo apt-get install -y qemu-utils
sudo modprobe nbd
sudo qemu-nbd --connect /dev/nbd snapshot.qcow

Let's list the partitions.

$ sudo fdisk -l /dev/nbd
Disk /dev/nbd:  GiB,  bytes,  sectors
Units: sectors of  *  =  bytes
Sector size (logical/physical):  bytes /  bytes
I/O size (minimum/optimal):  bytes /  bytes
Disklabel type: dos
Disk identifier: xbba

Device      Boot Start       End   Sectors Size Id Type
/dev/nbdp *         G  Linux

To repair the filesystem, use fsck.

# Using the option -y, fsck will repair without asking.
sudo fsck -f /dev/nbdp
[...]

Now we can mount the filesystem.

sudo mount /dev/nbdp /mnt/

Conclusion

Now the data is accessible on /mnt/.
If it's an ext filesystem you should have a look in /mnt/lost+found.