Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just got a new motherboard to get my old PC up and running. For some reason I cannot get any usb drives or cd/dvds to boot, however I do have an older hard drive with ubuntu already on it and it boots right up. This hard drive is old though, not much space and I think its on its last legs. I have several other hard drives, can I put a 2nd one in my computer and install ubuntu on it while the computer is booted up and then take out the old hard drive and boot straight from the new one?

share|improve this question

1 Answer 1

Yes, you can. I actually did that very recently. Here's how I did it.

I connected the drive that I wanted to install Ubuntu onto. I then created a rawvmdk image so that I could give direct access to the disk to a VirtualBox guest. I then mounted a CD image on that guest, using the rawvmdk disk image as harddisk. I then simply booted the guest and installed Ubuntu as usual. I could then remove the old disk and boot from the new one.

Please note that this must be done correctly, and if you do something wrong, you could potentially ruin your running system. Pay attention.

  1. Make sure you have the correct device name for the harddisk you want to install on, such as /dev/sdb
  2. Open a terminal and run this command, again assuming your disk is actually /dev/sdb: sudo VBoxManage internalcommands createrawvmdk -filename /root/rawdisk.vmdk -rawdisk /dev/sdb
  3. Run VirtualBox as root (you'll need to do that in order to access the raw disk)
  4. When creating the new virtual machine, you'll be asked to choose a harddisk. Select "Use an existing virtual harddrive file" and choose the /root/rawdisk.vmdk from the previous step.
  5. Run the guest and install Ubuntu as usual.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.