3

Copy Ubuntu Install from Internal Drive to Bootable USB that boots BIOS or UEFI

An external drive can easily be copied to USB using dd or Disks 'Create Disk Image" / "Restore Disk Image".

However these methods only create a drive that boots in the same BIOS or UEFI mode as the original.

It is also handy to have a FAT32 or NTFS Data partition that can save data from the computer it was plugged into.

The question is: How can I create a bootable USB drive that is a clone of my desktop and boots in either BIOS or UEFI mode.

It should also have a data partition that can store data from Windows and Apple computers.

1 Answer 1

5

User's Desktop Ubuntu to Bootable USB, BIOS or UEFI

This is another mkusb hacking project

  1. Create a Live USB drive using USB tool of your choice. Mkusb works well.

  2. Create a Persistent USB drive using mkusb with defaults, (including sdx1 NTFS data partition). This is the Target Drive.*

  3. Boot the computer using the Live USB.

  4. Plug in the Persistent USB Target drive, (sdx).

  5. Open GParted on Live USB and delete all target drive partitions except sdx1,sdx2 and sdx3.

  6. Right click and copy the root partition from the internal drive, Right click the unallocated space on the target drive and select "Paste". This should become sdx4.

  7. If there is a /home partition copy it as well. Do not include any boot or efi partitions from the internal drive.

enter image description here

  1. If you use a swap partition designate space for it also.

  2. Overwrite /dev/sdx3/boot/grub/grub.cfg with /dev/sdx4/boot/grub/grub.cfg.

  • If you want the USB to have the ability to boot ISO files using grub, create the target drive using the usb-pack-efi option. (this replaces grub 2.04 with 2.02).
12
  • Would it be wise - and is it possible - to also add swap space on this live, persistent USB clone (target drive)?
    – Royan
    Nov 6, 2022 at 19:31
  • @Ryan: I was thinking that the swap file is already located in / and a swap partition would not be necessary. I will edit the above answer to include a swap partition for those who use one. By the way, this is not a not a Live Persistent USB clone, It is a clone of your internal Fully installed OS with BIOS and UEFI boot partitions. Nov 7, 2022 at 1:58
  • Thanks again. Apologies for another question... can you explain the step about overwriting one grub.cfg with another? In my case Gparted shows sdb2 as "grub2core.img" There's no /dev folder
    – Royan
    Nov 7, 2022 at 8:17
  • @Ryan: Are you starting with a Target drive created using mkusb? I have edited the answer hoping to simplify things. A picture of the final partition structure has been added. See also askubuntu.com/questions/1403792/… . That method uses a fresh install of Ubuntu rather than cloning an existing install of Ubuntu. Nov 7, 2022 at 9:41
  • 1
    Ok, it worked! Well, sort of... The result is that the USB copy of the system works very well on the same laptop as the original, which is an older model with legacy BIOS. However, it boots very slowly and hardly works at all on a much newer laptop, which uses UEFI and different hardware. So my USB copy seems to be device-dependent. C.S. recommended elsewhere that in a case like this, temporarily removing proprietary drivers before copying the system to the target drive should avoid this issue. Overall this is a very neat technique!
    – Royan
    Nov 13, 2022 at 20:14

You must log in to answer this question.

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