1

I have a 64 GB USB pendrive with two partitions, of approximately 10 GB (the first) and 54 GB.

I'm on macOS, and I know how to create a bootable USB drive by using diskutil erasedisk and then dd to copy the latest Ubuntu installer .iso image to the USB device. This removes any previously existing partitions and then sets up the entire UBS drive as one single bootable volume.

Is there also a way to keep the 2nd partition unharmed, and just only the first 10GB partition to set up the Ubuntu installer, in a way so that the device still becomes bootable?

I can also remove the 10GB partition and create a smaller one or something else in its place, if that's required. But I just would like to keep the 2nd partition (the 54GB one) as-is.

10
  • Mac is UEFI and newer computers are UEFI. If you do not need BIOS boot. UEFI only USB key, just extract ISO ( 7 zip or similar) to FAT32 formatted flash drive partition & set boot flag. askubuntu.com/questions/395879/… The dd method overwrites standard partition table (eraseing drive) in making hybrid DVD/flash drive installer. The installers that do not use dd, do the format & extract, but normally format entire flash drive as assumed to be smaller and just for the install. But they also add BIOS boot loader, syslinux.
    – oldfred
    Sep 16, 2018 at 14:35
  • UNetbootin makes an installer for Mac. It will install the bootable OS to a flash drive partition, and works both BIOS and UEFI. unetbootin.github.io Sep 17, 2018 at 15:26
  • @oldfred In this case I'm also looking for a way to do it without UEFI. Is that possible?
    – RocketNuts
    Sep 27, 2018 at 22:02
  • @C.S.Cameron Thanks, I'm just wondering if there's a way to do it with plain shell commands, i.e. a combination of diskutil and gpt and dd or something? Perhaps the same as UNetbootin does, but in separate manual commands, so I understand exactly what's happening in this process?
    – RocketNuts
    Sep 27, 2018 at 22:05
  • With a Mac you really want UEFI. But you can do the same thing as the UEFI only extraction, but also then install syslinux boot loader which is the boot loader used by the Ubuntu installer for BIOS boot.
    – oldfred
    Sep 27, 2018 at 22:13

1 Answer 1

2

SIMPLE mkusb ISO Booter

It is easy to boot operating system ISO's on a modified mkusb flash drive.

Use mkusb to make a Persistent USB drive using a default OS of your choice, https://help.ubuntu.com/community/mkusb

Make a folder in the usbdata partition sdx1, named ISOs.

Add the ISO('s) to be booted to this folder.

Add menuentries to /sdx3/boot/grub/grub.cfg to loopmount the ISO's.

Samples:

menuentry "Ubuntu-18.04 64-bit ISO" {
    set root=(hd0,1)
    set isofile="/ISOs/ubuntu-18.04-desktop-amd64.iso"
        loopback loop $isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile splash --
        initrd (loop)/casper/initrd.lz
}

menuentry "GParted 64-bit ISO" {
    set root=(hd0,1)
    set isofile="/ISOs/gparted-live-0.31.0-1-amd64.iso"
    loopback loop $isofile
    linux (loop)/live/vmlinuz boot=live union=overlay username=user config components noswap noeject toram=filesystem.squashfs ip='' nosplash findiso=$isofile splash --
    initrd (loop)/live/initrd.img
}

menuentry "Clonezilla 64-bit ISO" {
    set root=(hd0,1)
    set isofile="/ISOs/clonezilla-live-2.5.5-38-amd64.iso"
    loopback loop $isofile
    linux (loop)/live/vmlinuz boot=live live-config nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\"   ocs_live_keymap=\"\" ocs_live_batch=\"no\" ocs_lang=\"\" vga=788   ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile splash --
    initrd (loop)/live/initrd.img
}

If you don't need persistence you can delete the casper-rw partition.

You can keep or delete the ISO9660 partition.

The usbdata partition can be expanded or shrunk to suit.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .