Recovering files from an unbootable/broken OS install

Post Reply
User avatar
Edge100x
Founder
Founder
Posts: 12945
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Recovering files from an unbootable/broken OS install

Post by Edge100x »

If you accidentally break your OS installation on your VDS in such a way that it won't boot -- such as by installing an invalid kernel, or deleting critical system files -- then it's a good idea to back up your files before taking any further recovery steps.

One procedure to rescue files is this:
  1. Select "install-amd64-minimal-20170907-isoboot.iso" from the DVD images selector, and check the box to boot to the CD/DVD.
  2. Reboot the VDS.
  3. Visit your VNC console page and wait for it to completely boot, leaving you with a command prompt that says "livecd ~ # "
  4. Configure the network and DNS (tailor these to match the IP, netmask, and gateway given on the "IP list" page in your control panel) by entering the following commands:

    Code: Select all

    ip address add 1.2.3.4/255.255.255.0 dev eth0
    ip route add default via 1.2.3.254 dev eth0
    echo "nameserver 8.8.8.8" > /etc/resolv.conf
    
  5. Make a new directory where you'd like to mount your existing file system partition to, such as with mkdir -p /mnt/recover
  6. Mount your partition. The command that you will need to use varies depending on the OS used on your main drive. Typically, you would use --
    mount -o ro /dev/xvda2 /mnt/recover
  7. Set a temporary password by typing passwd and pressing enter, then entering your choice twice when it asks.
  8. Start the SSH daemon by typing /etc/init.d/sshd start and pressing enter.
  9. Log in through SSH/SFTP/SCP using your IP address, username root and the password you defined above (one good client to use for this is WinSCP).
  10. Navigate to the location you mounted your partition to (such as /mnt/recover) and download some or all of your files.
If you simply forgot your password, though, that may be a simpler process to recover from. For a Linux installation, usually you can boot into single-user mode from your existing disk, without using a DVD, and set a new root password. There are many guides out there to do this, such as one for Ubuntu at http://askubuntu.com/questions/24006/ho ... e-password.

For Windows, we provide a recovery DVD that you can boot to for the sole purpose of resetting a lost Administrator password. We have a knowledge base article detailing how to use this recovery DVD, linked here: http://www.nfoservers.com/forums/viewto ... =46&t=4615
Post Reply