Restore

From PrgmrWiki

A quick rundown after you've followed Backing_up_disk_image_via_SSH

Boot to rescue disk, then, here is a sample log:

[root@astram ~]# fdisk /devxvda

Unable to open /devxvda
[root@astram ~]# fdisk /dev/xvda
This disk has both DOS and BSD magic.
Give the 'b' command to go to BSD mode.

Command (m for help): p

Disk /dev/xvda: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): +
Using default value 391

Command (m for help): p

Disk /dev/xvda: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1         391     3140676   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@astram ~]# ssh username@yourhost.com "cat /home/username/vps.fs.bz2" | bunzip2 | dd of=/dev/xvda1 
Could not create directory '/root/.ssh'.
The authenticity of host 'sailfish.usc.edu (128.125.244.196)' can't be established.
RSA key fingerprint is 71:fc:60:cb:75:6b:2e:f5:79:f5:0e:a7:84:b5:c4:e5.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/root/.ssh/known_hosts).
alex@sailfish.usc.edu's password: 
3973416+0 records in
3973416+0 records out
2034388992 bytes (2.0 GB) copied, 371.489 seconds, 5.5 MB/s
[root@astram ~]# shutdown -h now

Broadcast message from root (xvc0) (Thu Feb 17 05:37:39 2011):

The system is going down for system halt NOW!
INIT: Switching to runlevel: 0
INIT: Sending processes the TERM signal
Stopping HAL daemon: [  OK  ]
Stopping system message bus: [  OK  ]
Shutting down kernel logger: [  OK  ]
Shutting down system logger: [  OK  ]
Shutting down interface eth0:  [  OK  ]
Shutting down loopback interface:  [  OK  ]
Flushing firewall rules: [  OK  ]
Setting chains to policy ACCEPT: filter [  OK  ]
Unloading ip6tables modules: [  OK  ]
Flushing firewall rules: [  OK  ]
Setting chains to policy ACCEPT: filter [  OK  ]
Unloading iptables modules: Removing netfilter NETLINK layer.
[  OK  ]
Starting killall:  [  OK  ]
Sending all processes the TERM signal... 
Sending all processes the KILL signal... 
Saving random seed:  
Syncing hardware clock to system time Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.

Unmounting file systems:  
umount2: No such file or directory
umount: /proc: device is busy
umount: /proc/716/mounts: not found
umount2: No such file or directory
umount: /proc: device is busy
umount: /proc/716/mounts: not found
mount: mount point /proc/716/mounts does not exist
Halting system...
md: stopping all md devices.
System halted.
Error: Domain 'astram' does not exist.


Options for astram
1. out of band console (press ctrl-] to escape, not resizeable)
2. create/start
3. shutdown
4. destroy/hard shutdown
5. reboot
6. swap i386/amd64 bootloaders (pvgrub) currently amd64
7. view/add/remove ssh authorized_keys
8. exit
press the number> 2


And then you'll be booting the image!


Also, if you did use the step

  • resize2fs -M /dev/xvda1

in your Backup to SSH methodology, then you would be wise to use the following:

  • e2fsck -f /dev/xvda1
  • resize2fs /dev/xvda1

Before rebooting the rescue image, or else you will probably run out of disk space quite quickly.