@Sam, I tried unsuccessfully to find my notes, so this thread is it.
The image you get from Linode does not have:
the /boot folder,
a kernel image, or
a MBR.
The general idea of what I figured would work was to get a fresh Ubuntu 10.04LTS VM running, and then switch the '/' partition it was using to my Linode version.
Stage 1 - Writing the Linode Image to a DriveI used an existing VM (Ubuntu 14.04) with an extra empty drive added to in VirtualBox (VB). If you downloaded the Linode image using your host OS, you can us VB to setup the VM to share the folder where it's at.
I partitioned the empty drive using GParted.
I then used
dd to write the image to it.
Code:
ls -l imagename #to get the size
sudo fdisk /dev/sdX
dd if=imagename of=/dev/sdXY
http://www.backuphowto.info/backup-mbr-linuxSo now I had a drive with the Linode data on it. I could access it now, but not boot into it. I used
blkid to get its UUID.
After shutting down this machine, I removed the drive with the Linode image from the VM using VB.
Stage 2 - Creating a surrogate ServerI created a new 10.04LTS server with 3 drives ( '/', '/boot', and 'swap') and made it boot from the '/boot' partition.
I needed access to the net to install Grub2 later, so I set the network settings (in VB) of this VM to use a 'bridged network' interface.I took note of the UUID's of all 3 drives with the command
blkid, as I would need to modify the /etc/fstab file later.
With the install completed, I shutdown the 10.04LTS VM.
Stage 3 - Adopting the Linode image into the surrogateI added (in VB) the drive with the Linode image which I created earlier in the other VM to this fresh 10.04LTS VM.
I booted my fresh 10.04LTS install and after logging in, mounted the extra drive as per the above steps shown in
Code in my OP.
Note:: The devices referred to here might be inconsistent with what I posted later because I posted this before I got it working.(These steps are required because you will notice that I
chroot to the new '/' folder structure.)
(You will notice that the last
mount command uses the '/boot' partition from the fresh install [recall I used 3 drives] and at the moment I have 4 drives attached.)
Basically what you want to do is to mount the linode image (which is the '/' partition) as a sub-folder of the surrogate OS (which already has a '/' folder) and then make it the actual '/' folder using CHROOT. This is similar to what Jailkit does.
But because the Linode image doesn't have a '/boot' folder, you need to mount the surrogate's '/boot' folder into this. (Kind of a recursive arrangement)Stage 4 - Setup FSTAB and GRUBI then edited the line in the /etc/fstab file which referred to the '/' partition.
Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/xvda / ext3 noatime,errors=remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0 1
/dev/xvdb none swap sw 0 0
In place of '/dev/xvda' I pasted 'UUID=xxxxxxx' where 'xxxxxxx' was the UUID of the drive with the Linode image.
The UUID is the best way to ensure which drive is allocated to what, so I think I did the same thing for the other drives.
Make sure the other UUIDs are right, and that the '/boot' partition has the 'boot' flag set.
I also had to edit the /boot/grub/grub.cfg file.
Here I replaced all UUID entries for the fresh '/' partition with the Linode UUID.
Now I needed to configure the MBR, so I installed Grub2 using 'apt-get install grub2' and
ran 'grub-install /dev/sdc' (the Linode image drive in my case).
(I'm a little sketchy on what I exactly did in Stage 4. I had tried so many variations which didn't work, and suddenly it did. AND, I haven't done it since. But the jist of what I've written worked for me. I have since rationalised things, and the FSTAB example above is how the VM is currently setup.)Because I have password logins disabled on my server, I had to boot into rescue mode the first time to retrieve the server's IP address. After that I've been logging in using puTTY.
I hope the above helps you in some way.
Cheers,
Nap.