1

I Have a 16GB USB drive. I found out that multiple partitions on USB drives are possible. I need to make two partitions, one that contains Linux OS and the other one for storing files. A system like any other system (An OS Partition with different file storage partition). I want the storage partition to be accessible by Windows, which means that the storage partition should come before the OS partition in USB. The problem is, when storage partition is before the OS partition, the OS partition is useless and BIOS can't detect an OS if I select USB on boot. I think installing GRUB may solve problems but 'install-grub' throws errors.

  • Where have you got the notion that a Windows filesystem partition needs to be at the beginning of a partition list? Just ensure it's NTFS and you should be good to go. – roaima Jul 13 '17 at 14:55
3

Bootable usb thumb drive with 2 (or more) partitions, and windows to access the data partition.

Edit: This example uses an ISO instead of an installed OS. It should be simple to adjust for an installed OS.

Windows and others may only see the first partition on a usb device even when there are multiple partitions. Therefore make your first primary partition the fat32 or NTFS partition so windows can see and use it.

  • partition 1 - ntfs or vfat
  • partition 2 - ext4
  • partition 3 - linux swap

The second partition is where you will store the bootable iso, or the installed OS. Use grub to load and select what OS you want to use.

Steps:

1: Zero out partition table on the USB device.

dd if=/dev/zero of=/dev/sdx bs=512 count=4

2: Create partitions (use cli "fdisk" or gui "gparted")

Create partition table "msdos" type.

Create Partitions.

Format partitions.

3: Install grub bootloader to usb device.

Mount ext partition on USB to PC. mount /dev/sdx2 /mnt/usbp2

sudo grub-install --boot-directory /mnt/usbp2/boot /dev/sdx

Verify: If these exist all is well so far...

/mnt/usbp2/boot/grub/fonts -- minimum unicode.pf2

/mnt/usbp2/boot/grub/i386-pc -- *.mod modules to load in you grub.cfg

/mnt/usbp2/boot/grub/local -- languages

/mnt/usbp2/boot/grub/grubenv -- environment variable storage

4: Create a grub.cfg file for the OS's on the host pc.

sudo grub-mkconfig --output=/mnt/usbp2/boot/grub/grub.cfg

Test by booting to usb.

When you boot the USB drive you should get a list of the OS that was on the host PC not the empty USB, but this will test the grub and grub config that is on the USB.

5: Copy support files to the USB.

iso files

installed OS image from clonezilla or the like.

memdisk binary -- get from syslinux

6: Edit the grub.cfg on the USB for your ISOs and installed OS.

Each live ISO may require different grub information.

If you only get a grub command line, your grub.cfg probably contains errors. Go minimal to start like a single ISO.

Example grub.cfg for free live distro PartedMagic and others.

  • I must create 3 partitions within an extended partition, is that okay? – Notagenericmember Jul 13 '17 at 15:42
  • As long as the first is a primary, i think, yes its okay. – jc__ Jul 13 '17 at 15:43
  • Everything is within an Extended partition. Where to copy the support files?ext4 partition? – Notagenericmember Jul 13 '17 at 15:56
  • I booted by USB before copying iso support files, it is going into grub's shell, no OS options. – Notagenericmember Jul 13 '17 at 16:05
  • /boot/grub.cfg must exist on the partition tagged as bootable, ext3 partition. – jc__ Jul 13 '17 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.