I'd like to install Ubuntu on a disk which is connected (but not mounted), without booting from a DVD or USB. The goal is to have Ubuntu installed on an external disk, unplug it, plug it to other computer and run.
I know it takes 20 minutes etc etc. I simply want to do it from a running system, without need to reboot that.
What are my options?
Edit: To make it clearer, I have this scenario:
- my friend comes with an empty disk
- I install the system on that disk from my running system (Ubuntu)
- friend puts the disk back to his machine and boots this installed system.
So solutions with USB key or copying my own system are not what I need.
If you are in an Ubuntu machine, then you can just copy the running system in the external hard drive.
Let us assume you already partitioned the external hard drive. For this example I am going to use 2 partitions: / and /home.
cp -ax
does not cross different file system and it is archived (preserve permissions, does not follow symlinks, etc.)Then, you have to update the grub settings and the fstab in the target disk. You can use
chroot
, but before, you will need:Now you are ready to chroot:
Now, you have to update the UUIDs in your fstab and grub. In order to get the UUID, you can run:
Then, replace in /etc/fstab the UUID with the appropriate id gotten with
blkid
.The last step is to update the configuration for booting and install the bootloader in the external hard drive. In my case I use grub, so, I have edit
/boot/grub/menu.lst
. There you have to replace the line that starts with# kopt=root=UUID=... ro
and replace the content of UUID to the partition that has root file system.Where /device/name is the external hdd.
Then, you can exit of chroot and unmount the devices.
And the disk should be ready to be used. Once you boot it, it might ran
fsck
, because it was not unmount properly (you copied the content live).You can use
debootstrap
for that, that should be exactly what you need. Take a look at this link.If you have the ISO image you can create a bootable USB with a live system with either of those 2 tools mentioned in this article:
https://wiki.ubuntu.com/LiveUsbPendrivePersistent
Just type in USB in the unity and a program to create such a disk will appear.