32

Here's what I mean:

I normally install by running a Ubuntu Live USB, clicking "try" Ubuntu, and when I'm ready, I double-click the "Install Ubuntu" icon on the desktop.

Install Ubuntu Icon

Now, I have an eSATAp port and what I'd like to do is connect my hard drive directly to my laptop/desktop which already has Ubuntu running on it and simply run that same application that's available on the Live CD/USB to install it on the external drive.

I'm open to other methods as well, as long as I don't have to "burn" an ISO to a USB, then reboot from the USB, then install it to the external drive.

A million thanks!

Nathan J.B.
  • 2,640

4 Answers4

8

You are asking an interesting questions. I'll rephrase it my own words: Is it possible to run Ubuntu's installer, which is present at Ubuntu's LiveCD, from a regular Ubuntu system (installed to HDD)?

The GUI installer you found on the LiveCD is packaged as ubiquity. It's not clear, what will happen if you try to install and run this from your your HD install. While it might work, this does not seem supported or tested.

It's well known, that Debian-based systems such as Ubuntu can be installed in a chroot environment. Chroot is a tool, which can treat any directory as the root directory "/". You can easily create a chroot environment on your external HDD. If you want to boot this chroot Ubuntu, you have to install a kernel and a boot loader. While this is a known and tested method for Debian (and I have personally done this with Ubuntu), the tutorials on the web are outdated. Hence, this is only an option if you are familiar with grub and the Linux boot process.

Actual Answer: While your question is reasonable, it does not seem supported by Ubuntu or any other modern operating system. We have become so used to install OSs from a boot CD or USB, that other methods were neglected.

You didn't specify what the purpose of installing Ubuntu onto the external HDD is. If you leave this external HDD connected as it is, your computer will probably never boot it, because it prefers your internal HDD. If you change the BIOS settings, connect the external HDD to a different computer, or anything the like, then this (currently) external HDD can become the role of the boot HDD. Now, here comes the catch: It takes some guesswork to know now, whether and how this HDD will ever become bootable. The PC BIOS is a horrible bootloader, not designed for such things. That's probably why your idea is not supported through easy installation vectors such as Ubuntu's GUI installer.

Jan
  • 3,598
  • I just tried ubiquity and it failed (from ubuntu 14.04). One of the possible problem is that it formatted all swaps found on the system. It crashed when a screen was telling "copying files to disk". The main reason I wanted to install from an actual ubuntu is because im lazy and did not want to qui the conveniance of my actual system to install ubuntu on my new and larger SSD. – Lynch Sep 03 '17 at 04:05
  • Before you start the ubiquity install run 'sudo swapoff -a' to turn off swap and then ubiquity can't bring down the running system when it reformats the swap partitions. You may need to repoint the automount for the swap in /etc/fstab after ubiquity completes as the identity of the swap partition might change. – freegnu Jan 14 '19 at 12:52
  • 2
    (literally 8 years later) is this operation still not supported? – birgersp Sep 09 '19 at 14:53
  • (literally 10 years later) i'm running from a boot-disk, how do i "install" it on a HDD partition (grub win etc) ps. computers don't have cd drives anymore. – Jason K. Dec 04 '21 at 13:04
6

I think this link that may help: How do I install Ubuntu to a USB key? (without using Startup Disk Creator)

In short:

  1. Install qemu-kvm package and dependencies if not yet done so.

    sudo apt-get install qemu-kvm
    
  2. Run virtual machine with external HDD (assume it is mounted at /dev/sdb) as internal drive and Ubuntu ISO file as cdrom. Add more ram to virtual machine with -m 2GB if you have plenty of ram on your machine to speed up installation process.

    sudo kvm /dev/sdb -cdrom ~/.cache/testdrive/iso/ubuntu_natty-desktop-i386.iso
    

Personally, I prefer to run any installer on target PC/laptop instead of remove HDD from it and install at another PC/laptop.

Hai Lang
  • 161
0

It isn't really necessary to reinstall at all. You can just copy your installed operating system onto the other disk and boot it. If the two disks are of equal size, then it's very easy:

sudo dd if=/dev/disk1 of=/dev/disk2

This will make disk2 a clone of disk1, meaning that the partitions and everything will be copied. When the copy is finished, you can boot from the external disk, and have everything you had.

If your computer supports hardware virtualization, then you can also install kvm -- probably with virt-manager as a GUI -- and use the external disk as a disk for a virtual machine.

  • 2
    This would be great if I needed to duplicate systems. But what I want is to install the first system (and not a duplicate of my laptop's setup). E.g. I'm at a friend's place and they have a spare laptop, I suggest trying Ubuntu on it, and they agree. I then take out the HDD, connect it via eSATAp to my laptop (which runs 11.04 currently), open the "Install Ubuntu 11.04" app (or do something else?), then install directly to the new hard drive. (As a side note, btw, it's faster to do fresh installs each time than to copy every bit from one HDD to the other.) – Nathan J.B. Oct 07 '11 at 09:35
0

This may be possible by using Virtual Box. You would just need to set up a USB device in Virtual Box, and then install to the external drive that way.

RolandiXor
  • 51,541