Recovery mode

Recovery mode is available to all Mac Mini dedicated server customers, and is accessed through the Customer Control Panel. Recovery mode allows you to reboot your server into an NFS mounted Linux installation. Once booted, you can mount your server's own file system and carry out repairs or configuration necessary to get your server booting again.

In order to use recovery mode, you will need an SSH key pair, used for authentication. If you do not have one, you can generate one easily using the ssh-keygen command line. This will generate you two files, usually called .ssh/id_dsa and .ssh/id_dsa.pub (although they may have rsa rather than dsa in the file name). You will need to copy and paste the contents of the file ending .pub into the control panel.

For each of your servers, the control panel will provide the following options:

Service IP Boot Mode Authorized Keys
service ip-address linux
OSX
recovery
ssh-dss AAAAB3NzaC1kc3MAAACBAJ64Uh64nXHhSzlxnLl5kVp6rey
nz3TPhP6hcZMvRoLJuQMkpoGsXeHXlM8Jmq2sQSgQ2yOSZjd0M9Wy8X
veEVxiK5bkB37ORWmJFvBK1bMbrvLiVkMCMgouY9QpYh33uZ6+yZNTK
8MQQNIzx5mU5QmdYSi+kaH8B0uZO4Z2FrM/AAAAFQD0F571/DqVrAWg
Ha2NSed2aHIXrwAAAIAKAHvhPGD0EOJvJFHj+Tz3I+b3YYjESWypdO7
qydlaPqQbvCA0rwnwky+1rMkcJomPUNnF0OpdML55THWkOr5FItIR4D
oJm3bFNGmdGl5x2SZbUgmz3GTzLc7GH+CF+6JuyPQdZfOsPCeDmV+FP
updm3TqxbdpBPo/RyYDra4txgAAAIEAgZ5+GeRud38GOfrZWJ1JjJBl
oF5oLlvCGZfqfL//1jhwwOBHtSOyf7mwVbrbbsTwJi/0H9hwquXf7z+
5os2/3uR0yCzaFjJRiteyrOGxE5FcOZwcA8Iy9CBIzcbKUnAzW6ovEy
HyLY1Xjj36E2ctTGkunso7czKJtR+jRwRLOdI= pete@macbeth 

You need to paste your public key (the .pub file) into the Authorized Keys section (as shown above). You can then select the mode that you want your server to boot into. Choose "recovery" for recovery mode, and either "linux" or "OS X" when you want to boot into your normal OS.

Once you have saved your changes to the recovery mode configuration using the Apply button, you should reboot your machine using the Power Cycle button (when switching back from recovery mode to normal boot mode, you can just type reboot -f on the command line, rather than power cycling).

When your server is up in recovery mode, you will be able to log in as root using the ssh key you have just generated. It is very likely that you will get a warning from ssh about the host key of your server having changed. This is expected, and can be safely ignored.

Using recovery mode

fsck

To check your disks first you need to see the partition table. To do this you need to use parted.

recovery:~# parted /dev/sda print

Disk /ramdisk/dev/sda: 40.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name        Flags
 1      20.5kB  35.7MB  35.7MB  fat32        EFI         boot 
 2      35.7MB  455MB   419MB   hfs+         Recovery         
 3      455MB   1399MB  944MB   hfs+         OSBoot           
 4      1399MB  1483MB  83.9MB               Media            
 5      1483MB  1535MB  52.4MB  ext3         linux-boot       
 6      1535MB  39.5GB  37.9GB  ext3         linux-root       
 7      39.5GB  40.0GB  537MB   linux-swap   linux-swap       

Information: Don't forget to update /etc/fstab, if necessary.

This tells us where the partitions are so we can check them.

recovery:~# e2fsck /dev/sda5
e2fsck 1.40-WIP (14-Nov-2006)
/dev/sda5: recovering journal
/dev/sda5: clean, 16/12824 files, 8971/51200 blocks


recovery:~# e2fsck /dev/sda6
e2fsck 1.40-WIP (14-Nov-2006)
/dev/sda6: recovering journal
Clearing orphaned inode 3949937 (uid=0, gid=4, mode=0100640, size=1079)
Clearing orphaned inode 3967306 (uid=33, gid=33, mode=0140600, size=0)
Clearing orphaned inode 3949904 (uid=0, gid=4, mode=0100640, size=3218)
Clearing orphaned inode 3967301 (uid=33, gid=33, mode=0140600, size=0)
Clearing orphaned inode 3949917 (uid=0, gid=4, mode=0100640, size=1319)
Clearing orphaned inode 3964958 (uid=33, gid=33, mode=0140600, size=0)
/dev/sda6: clean, 202333/4636672 files, 3927687/9261665 blocks

We can format the swap partition.

recovery:~# mkswap /dev/sda7
Setting up swapspace version 1, size = 536850 kB
no label, UUID=c68eedbe-d405-437d-887b-52b20ed249b8

We can check if the disk thinks that it is broken.

recovery:~# smartctl -d ata -H  /dev/sda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

Chroot

It can be useful to chroot (change root) into the dedicated server if we need to repair various things. This switches you into an environment very much like your normal server, with your normal root filesystem. Additional packages can be installed, services can be started and tested:

recovery:~# mkdir /mnt/root
recovery:~# mount /dev/sda6 /mnt/root  # This may not be sda6 - check parted output as above.
recovery:~# chroot /mnt/root
recovery:/# mount /boot
recovery:/# mount /proc

When you're done, you should leave the chroot environment and unmount your filesystem before rebooting:

recovery:~# exit                # leave chroot
recovery:~# umount /mnt/root    # unmount root filesystem

Reformatting

Debian and Ubuntu can both be readily reinstalled from the recovery console.

mount /resources
cd /scripts/macmini/intel/partition
./partition
cd ../install_debian
./install_debian
cd ../install_kernel
./doinstall

or

mount /resources
cd /scripts/macmini/intel/partition
./partition
cd ../install_ubuntu
./install_ubuntu
cd ../install_kernel
./doinstall

At this time we don't have end-user friendly scripts for installing gentoo,centos or OSX - please contact us if you'd like to reimage with one of these operating systems.

Please note, it is very important to run the partition script that matches your dedicated server platform.

Notes

Sometimes recovery mode can fail to start up correctly if there's a few dropped packets while the netboot starts. In this event you'll need to wait a few minutes then power cycle the server again to start another boot attempt. Eventually the server will fall back and try and boot locally from disk which may not work.

Ubuntu LTS requires /dev to be on tmpfs, if you're having trouble booting check that /etc/fstab contains

dev	/dev	tmpfs	rw	0 0

this musn't be present for older versions of Ubuntu, Debian or Centos.