How can I setup an internal SATA SSD such that it boots an Ubuntu installer ISO image ? This would be much faster than using an USB stick.
The naive approach to dd
the image file to a disk partition and then setup grub
to chainload this partition does not work. Why not ? Which is the key feature for booting an ISO image that a thumb drive has but an internal drive misses ?
Get the
uuid
of the partition on the disk:Store the ISO in the root of the partition, in this example we will use
ubuntu-19.04-desktop-amd64.iso
.Mount the ISO and copy the first
menuentry
from/boot/grub/grub.cfg
, and paste it in/etc/grub.d/40_custom
:Change the following in bold:
Update grub:
Next time you reboot you will have an entry to boot the ISO.
Grub 2.04
Grub 2.04 as found in Ubuntu 19.10 and later, does not chainload ISO files in UEFI mode.
See [Bug 1851311] Re: Grub 2.04 Out of memory error, https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1851311
See posts 17 to 21 for background on workaround.
Procedure to lookmount ISO files on SSD
Install Ubuntu to the SSD using mkusb with the usb-pack-efi option. (this replaces grub 2.04 with 2.02).
Deleted ISO9660 partition sdx4, and casper-rw partition sdx5, stretch usbdata NTFS partition #1 into it's place.
Dropped ISO into iso folder on NTFS partition.
Updated grub.cfg on usbboot partition #2 to loopmount the ISO.
Boots in BIOS using grub 2.04, Boots in UEFI using grub 2.02~Beta2
Booting an ISO file on SSD and running it in RAM should make a fast setup.
RAM is orders of magnitude faster than an SSD.
A relatively fast SSD may achieve real-world write speeds of 456MB/sec.
The theoretical maximum speed of RAM is in its PC number, so a module of PC3-12800 memory can transfer 12,800MB/sec. (roughly 30 times faster than the real world performance of an SSD).
An Ubuntu installer image will run in RAM. You need more RAM than the size of the image. (>2.5GB).
Mkusb will make a USB that has a boot to RAM option, or when booting, you can press shift, then F6 and type a space then toram then enter.
debootstrap gives this capability but it is a complex process, and generating then installing from a LiveDVD or LiveUSB is far easier and quicker than using debootstrap.
sudo update && sudo apt install debootstrap
sudo mkfs.ext4 /dev/sda1
.sudo mkdir /mnt/installer && sudo mount /dev/sda1 /mnt/installer
sudo debootstrap xxxxxx /mnt/installer
- substitute the Ubuntu distro you intend to install for xxxxxx .sudo cp /etc/apt/sources.list /mnt/installer/etc/apt/
to copy files to retain your repositories.Upgrade the new install. Install your local "language-pack-en-base" with
apt-get update && apt-get install language-pack-en-base && apt-get upgrade
If you intend to use Software RAID and/or LVM, install these packages before the kernel:
apt install mdadm lvm2
Install GRUB2 and the kernel with
apt install grub-pc linux-image
Add a user & set their password, and the root password, with
adduser <username>
thenpasswd
Do you want them to belong to sudoers? Then do
gpasswd -a <username> sudo
Make fstab; a simple example is
echo "/dev/sda1 / ext4 errors=remount-ro 0 1" >> /etc/fstab
More details are available in https://help.ubuntu.com/community/Installation/FromLinux#Debootstrap including the installation of a desktop (which you haven't yet said you wanted).
General comment
I notice that the answers are very different. I think it is because we read your question in different ways. Please make things more clear:
Your [original] question and my answer
You can treat a SATA SSD (internal SATA or external eSATA or connected via a USB adapter or box) just like a USB stick, if the tool you are using is allowing it.
And you are right, it is much faster than using a USB stick.
I have done it with
dd
. So it works, but if you use the simple cloning method, there will be a terrible waste of drive space.But there are several methods to create a persistent live drive with a partition for persistence, where you can use the remaining drive space 'behind' the cloned image, or create a dedicated partition table.
I have done it many times and can confirm that it works. I have also created persistent live drives with
mkusb
, edited the partition table (when booted live-only 'to RAM' from the drive itself) and created an installed system in the drive space made unallocated. (It is even possible to overwrite the live system completely, when you install the system, but if you make a mistake you have to start from the beginning, so I would not recommend it.)You can also use other methods to boot via grub.
The following links describe methods that work, if you want to setup an internal or external SSD such that it boots an Ubuntu installer ISO image.
help.ubuntu.com/community/mkusb
help.ubuntu.com/community/mkusb/persistent
How is it easier to make a persistent live drive with Ubuntu 19.10? - you can use
mkusb-sedd
directly for an internal target drive becausemkusb-plug
needs a removable target driveUbuntu on a USB stick - boot in both BIOS and UEFI modes
help.ubuntu.com/community/Grub2/ISOBoot/Examples
help.ubuntu.com/community/Installation/UEFI-and-BIOS/stable-alternative-18.04.1