Closed jackbit closed 5 years ago
You need to create an EBS volume of at least the same size as the original one to hold the restored data. The destination for dd should never be /mnt/xvdf, it needs to be the device name of the EBS drive to write to, probably /dev/xvdf (the drive must not be mounted!)
On Sat, 9 Mar 2019, 9:02 AM Yacobus Reinhart, notifications@github.com wrote:
Hi,
I am using --dd parameter, my question how to restore it back as snapshot ec2 instead file, because after executing line below, it will return insufficient space for /dev/xvdf, so i use another root volume /mnt/xvdf
aws s3 cp "s3://backups.example.com/vol-xxx/2017-01-01 snap-xxx.img.lz4" - | lz4 -d | sudo dd bs=1M of=/mnt/xvdf
But after extraction it returns file, how to make it mountable or back to snapshot ec2.
I have tried without --dd and after extracting to empty volume, then take snapshot on it and after that create image from snapshot, the image can not be started after lunched. The image keeps stoping. Please kindly help, thank you
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thenickdude/snap-to-s3/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1Rgw9_fbIj_Q-4XBMs3hlRplAGIt5Iks5vUsG8gaJpZM4bmCNr .
It worked. Backup without --dd
makes the restore does not working. So if you have ami, instance, or snapshot and you want to upload on S3 and restore again successfully, here is steps:
Backup the instance snapshot
snap-to-s3 --migrate --snapshots snap-xxxx --bucket bucket-name --validate --dd
To restore (example, in new aws account or vpc ) :
Launch new EC2, install snap-to-s3, awscli and aws configure
Create empty volume with size as big as the backup file
Login ssh to new instance and run lsblk
to get volume name, example the output like:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 87.9M 1 loop /snap/core/5742
loop1 7:1 0 16.5M 1 loop /snap/amazon-ssm-agent/784
loop2 7:2 0 91M 1 loop /snap/core/6405
loop3 7:3 0 17.9M 1 loop /snap/amazon-ssm-agent/1068
nvme0n1 259:0 0 10G 0 disk
`-nvme0n1p1 259:1 0 10G 0 part /
nvme2n1 259:4 0 9G 0 disk
Resize your /dev
volume it the size is smaller than backed file mount -o remount,size=20G /dev
Example the volume name /dev/nvme2n1
, then embed s3 backup on step 1 to it
cp "s3://bucketname/image-name-xxxx.img.lz4" - | lz4 -d | sudo dd bs=1M of=/dev/nvme2n1
It will take some times, once success run again lsblk
, then you will get some thing like this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 87.9M 1 loop /snap/core/5742
loop1 7:1 0 16.5M 1 loop /snap/amazon-ssm-agent/784
loop2 7:2 0 91M 1 loop /snap/core/6405
loop3 7:3 0 17.9M 1 loop /snap/amazon-ssm-agent/1068
nvme0n1 259:0 0 10G 0 disk
`-nvme0n1p1 259:1 0 10G 0 part /
nvme2n1 259:4 0 9G 0 disk
`-nvme2n1p1 259:5 0 8G 0 part
Start mounting mount /dev/nvme2n1p1 /mnt
then check folder /mnt, it should contains backed root ebs
Hi,
I am using --dd parameter, my question how to restore it back as snapshot ec2 instead file, because after executing line below, it will return insufficient space for /dev/xvdf, so i use another root volume /mnt/xvdf
But after extraction it returns file, how to make it mountable or back to snapshot ec2.
I have tried without --dd and after extracting to empty volume, then take snapshot on it and after that create image from snapshot, the image can not be started after lunched. The image keeps stoping. Please kindly help, thank you