You are Here:
FAQ
Dedicated Servers
Linux Server
Linux Server Recovery
Article #8
|
How to restore the server using the rescue systemIf you accidentally misconfigured your server or it won't start up properly for any reason please use the Recovery-Tool to restart the Root-server bypassing its internal hard drive. Please note!Do not run file system repairs on partitions that are mounted as this
will destroy the data! Prerequisite: Root-Server has to boot up in the Rescue-System The Rescue System is a Linux system that runs on a RAM-Disk. A connection with
your Root-Server will look something like this (with your IP address instead of 172.17.1.1): user@machine:~$ ssh root@172.17.1.1 Password: XXXXX Welcome to pureserver rescue disk If you are using a unix/linux/mac from a terminal. If you are using a windows machine you will need to connect with an ssh client such as putty. Remote Server Access Using Secure Shell (SSH) From here you can partition your internal hard drive or edit incorrect settings. The following is the standard partitioning of the internal hard drive: If you are using hardware raid you will only see one drive. rescue:~# fdisk -l Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 123 987966 fd Linux raid autodetect /dev/sda2 124 367 1959930 82 Linux swap / Solaris /dev/sda4 368 19457 153340425 5 Extended /dev/sda5 368 976 4891761 fd Linux raid autodetect /dev/sda6 977 1585 4891761 fd Linux raid autodetect /dev/sda7 1586 19457 143556808+ fd Linux raid autodetect rescue:~# If you are using software raid you will see two drives. rescue:~# fdisk -l Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 123 987966 fd Linux raid autodetect /dev/sda2 124 367 1959930 82 Linux swap / Solaris /dev/sda4 368 19457 153340425 5 Extended /dev/sda5 368 976 4891761 fd Linux raid autodetect /dev/sda6 977 1585 4891761 fd Linux raid autodetect /dev/sda7 1586 19457 143556808+ fd Linux raid autodetect Disk /dev/sdb: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 123 987966 fd Linux raid autodetect /dev/sdb2 124 367 1959930 82 Linux swap / Solaris /dev/sdb4 368 19457 153340425 5 Extended /dev/sdb5 368 976 4891761 fd Linux raid autodetect /dev/sdb6 977 1585 4891761 fd Linux raid autodetect /dev/sdb7 1586 19457 143556808+ fd Linux raid autodetect Disk /dev/md7: 147.0 GB, 147002097664 bytes 2 heads, 4 sectors/track, 35889184 cylinders Units = cylinders of 8 * 512 = 4096 bytes Disk /dev/md7 doesn't contain a valid partition table Disk /dev/md6: 5009 MB, 5009047552 bytes 2 heads, 4 sectors/track, 1222912 cylinders Units = cylinders of 8 * 512 = 4096 bytes Disk /dev/md6 doesn't contain a valid partition table Disk /dev/md5: 5009 MB, 5009047552 bytes 2 heads, 4 sectors/track, 1222912 cylinders Units = cylinders of 8 * 512 = 4096 bytes Disk /dev/md5 doesn't contain a valid partition table Disk /dev/md1: 1011 MB, 1011548160 bytes 2 heads, 4 sectors/track, 246960 cylinders Units = cylinders of 8 * 512 = 4096 bytes Disk /dev/md1 doesn't contain a valid partition table rescue:~# First of all you should run a filesystem check to fix any errors in the file structure. Please note!Do not run file system repairs on partitions that are mounted as this
will destroy the data! For hardware raid rescue:~# fsck -f /dev/sda1 for software raid rescue:~# fsck -f /dev/md1 /dev/md5 or /dev/sda5, /dev/md6 or /dev/sda6, and /dev/md7 or /dev/sda7 are XFS and use different methods to be checked. For hardware raid rescue:~# xfs_check /dev/sda5 rescue:~# xfs_check /dev/sda6 rescue:~# xfs_check /dev/sda7 for software raid rescue:~# xfs_check /dev/md5 rescue:~# xfs_check /dev/md6 rescue:~# xfs_check /dev/md7 If the curser simply returns to the rescue:~# then there were no detectable problems. If this does report errors you will first want to mount and umount the drives. Either mdx or sdx where x is the partition number you are attempting to repair. For hardware raid rescue:~# mount /dev/sdax /mnt rescue:~# umount /dev/sdax for software raid rescue:~# mount /dev/mdx /mnt rescue:~# umount /dev/mdx Then check the partition again. If there are still problems with 5, 6, or 7 you will need to run xfs repairs on these partition. Using the -L option does run the risk of data loss so it is recommended that you use this option if you have backups of the data or the data is already irretrievable. for hardware raid rescue:~# xfs_repair -L /dev/sdax for software raid rescue:~# xfs_repair -L /dev/mdx Now you can mount the internal hard drive into the /mnt directory and change into the system on the partition. If you do not remember where usr, home, and var are mapped to then mount the root partition first and check the mtab or fstab. for hardware raid rescue:~# mount /dev/sda1 /mnt kjournald starting. Commit interval 5 seconds EXT3 FS on sda1, internal journal EXT3-fs: mounted filesystem with ordered data mode. for software raid rescue:~# mount /dev/md1 /mnt kjournald starting. Commit interval 5 seconds EXT3 FS on md1, internal journal EXT3-fs: mounted filesystem with ordered data mode. check to see where the usr, home, and var are assigned to rescue:~# more /mnt/etc/mtab or rescue:~# more /mnt/etc/fstab as an example of a fstab /dev/md1 / ext3 defaults 1 1 /dev/sda2 none swap sw /dev/sdb2 none swap sw /dev/md5 /usr xfs defaults 0 2 /dev/md7 /var xfs defaults,usrquota 0 2 /dev/md6 /home xfs defaults,usrquota 0 2 devpts /dev/pts devpts gid=5,mode=620 0 0 none /proc proc defaults 0 0 none /tmp tmpfs defaults 0 0 Then mount the other partitions. The below example commands are based on the partitions from the example fstab above. You will need to match 5, 6, or 7 to usr, home, and var based on your fstab or mtab. If you are using hardware raid it will be sdax instead of mdx where x is the partition number. rescue:~# mount /dev/md5 /mnt/usr rescue:~# mount /dev/md6 /mnt/home rescue:~# mount /dev/md7 /mnt/var One of the things you can check here is: ensure that the partitions are not full with rescue:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/ram0 252M 218M 34M 87% / tmpfs 998M 4.0K 998M 1% /dev/shm /dev/md1 950M 137M 765M 16% /mnt /dev/md5 4.7G 2.1G 2.6G 46% /mnt/usr /dev/md6 4.7G 4.4M 4.7G 1% /mnt/home /dev/md7 221G 111M 221G 1% /mnt/var if any of these /dev/md1 950M 137M 765M 16% /mnt /dev/md5 4.7G 2.1G 2.6G 46% /mnt/usr /dev/md6 4.7G 4.4M 4.7G 1% /mnt/home /dev/md7 221G 111M 221G 1% /mnt/var are at or near 100% this will cause problems and you will want to remove data to create more free space. You can search for large files with the find command. So if the /mnt/var partition is full you would use rescue:~# find /mnt/var -size +1000M to search for files larger then 1000MB. If you do not find anything decrease the size to 750M and look again. In many situations it is log files that create these problems. You can move large log files to your ftp backup space using ftp. then chroot into the mounted operating system. rescue:~# chroot /mnt Now you can repair and/or configure your Root-Server now that you are in /mnt as if you were logged into the machine under normal conditions. Note: most of the services will be stopped that would normally be running. So if you need to make a proper database dump of your mysql databases you could start mysql rescue:~# /etc/init.d/mysqld start Please noteRemember you are running everything out of the RAM and so have less
memory to work with then normal. So start as few services as possible to accomplish what you need to accomplish. After you have finished restoring your root server you need to execute the following commands to restart your Root-Server: to exit the chroot environment rescue:~# exit to umount your partitions rescue:~# umount -al Do not forget to unmount your internal hard drive after the restore and BEFORE you restart the server. Also remember to change your Root-Server back to normal boot mode from your Control Panel. You have the option of rebooting from inside the recovery tool or just changing the boot image by either selecting the reboot now option or not. If you do not select the reboot now option it will only change the boot mode. rescue:~# shutdown -r now |
© 2012 1&1 Internet Inc - About 1&1 Internet