FAT32 / NTFS + isofs on USB

kyrill

I have a bootable USB disk:

# dd if=/path/to/os_image.iso of=/dev/sdb
(...everything OK...)

# sudo dumpe2fs /dev/sdb
dumpe2fs 1.42.9 (4-Feb-2014)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdb
Couldn't find valid filesystem superblock.

GParted doesn't recognize any partitions (screenshot), the GUI file manager reports filesystem as isofs. The system boots and everything works fine.

The problem is, I want to use the USB disk for a live OS and as a storage with PCs and TVs which only recognize FAT32 and NTFS.

I have tried creating two partitions, doing dd on sdb1 and making sdb1 the only bootable partition, but the system didn't boot.

So my question is: how to put both FAT32/NTFS and (any) bootable ISO image on an MBR-partitioned disk without using an external bootable-usb-creator program? I would like to simply use dd, as I do now.

Presumably this could be solved using the right bootloader with the right configuration, I just don't know which bootloader and what configuration.

jc__

Bootable usb thumb drive with 2 partitions.

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

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

steps:

1: zero out partition table

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

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

create partition table "msdos"

create 2 partitions

p1 = ntfs

p2 = ext4 -- tag as bootable.

format partitions.

3: Install grub bootloader to usb device

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 this pc

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

Test by booting to usb

5: Copy support files to the usb

  • iso files
  • memdisk binary -- get from syslinux
  • grub.cfg -- custom for your usb stick. Overwrite grub.cfg created by grub-mkconfig

Note: each live iso may require different grub information.

Note: If you only get a grub command line, your grub.cfg probably contains errors. Go minimal to start.

6: Create your custom usb boot installer.

Copy the MBR and Partition Table

dd if=/dev/sdx of=/custom_boot/cb_mbr.img bs=512 count=1

Copy the bootable partition

dd if=/dev/sdx2 of=/custom_boot/cb_ext4.img bs=512

7: Create new bootable usb device

  • Delete all existing partitions and clean MBR

    fdisk or gparted (delete partitions)

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

  • restore MBR and Partition Table

    dd if=/custom_boot/cb_mbr.img of=/dev/sdx bs=512

  • Restore bootable partition

    dd if=/custom_boot/cb_ext4.img of=/dev/sdx2 bs=512

  • Fix the first partition and reformat (fat32 or ntfs)

    fdisk or gparted

My grub.cfg

My Notes

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

USB drive format, NTFS vs. FAT32

From Dev

rsync on fat32 and ntfs

From Dev

What filesystem to have on my USB-harddrive; FAT32 or NTFS?

From Dev

NTFS Partition on a USB Stick shows up as FAT32 and is unaccessible in Windows 8.1

From Dev

Should I format USB sticks and SD cards to FAT, FAT32, exFAT or NTFS? (Windows files, live Linux distributions)

From Dev

NTFS vs FAT32 Search Time

From Dev

Can I copy files from NTFS to FAT32, and then open them using a FAT32 OS?

From Dev

Convert NTFS to FAT32 without losing data

From Dev

Benefits of converting Data partition from NTFS to FAT32

From Dev

filesystem conversion from fat32 to ntfs on external hard drive

From Dev

Converting a non-lettered partition from FAT32 to NTFS

From Dev

NTFS vs FAT32 Popularity (Dec '15)

From Dev

FAT32 vs. NTFS microSD card

From Dev

converting filesystem of internal HDD from FAT32 to NTFS

From Dev

Gparted see NTFS windows partition as fat32

From Dev

Copy files from FAT32 to NTFS, preserving date

From Dev

Can Ubuntu Linux be installed on FAT32 or NTFS?

From Dev

How to format Hard drive NTFS and convert it to FAT32?

From Dev

How do I use 'chmod' on an NTFS (or FAT32) partition?

From Dev

Convert FAT32 partition to NTFS without data loss

From Dev

UEFI USB only boots when formatted FAT32

From Dev

Default file permissions for FAT32 USB stick on Raspberry Pi

From Dev

Perfectly uncorrupted USB formatted FAT32 is RAW on Windows

From Dev

dd in mounted USB FAT32 for forensic analysis?

From Dev

Unable to mount FAT32 USB drive in Mint ("is not a block device")

From Dev

How to format the unallocated USB drive and make it as Fat32?

From Dev

How do I tell between FAT16 and FAT32 USB? (Windows)

From Dev

How do I boot a MBR [FAT(32)/NTFS] USB HDD from EFI without legacy bios?

From Dev

Why flash drive has different capacity when formatted using FAT32 and NTFS?

Related Related

  1. 1

    USB drive format, NTFS vs. FAT32

  2. 2

    rsync on fat32 and ntfs

  3. 3

    What filesystem to have on my USB-harddrive; FAT32 or NTFS?

  4. 4

    NTFS Partition on a USB Stick shows up as FAT32 and is unaccessible in Windows 8.1

  5. 5

    Should I format USB sticks and SD cards to FAT, FAT32, exFAT or NTFS? (Windows files, live Linux distributions)

  6. 6

    NTFS vs FAT32 Search Time

  7. 7

    Can I copy files from NTFS to FAT32, and then open them using a FAT32 OS?

  8. 8

    Convert NTFS to FAT32 without losing data

  9. 9

    Benefits of converting Data partition from NTFS to FAT32

  10. 10

    filesystem conversion from fat32 to ntfs on external hard drive

  11. 11

    Converting a non-lettered partition from FAT32 to NTFS

  12. 12

    NTFS vs FAT32 Popularity (Dec '15)

  13. 13

    FAT32 vs. NTFS microSD card

  14. 14

    converting filesystem of internal HDD from FAT32 to NTFS

  15. 15

    Gparted see NTFS windows partition as fat32

  16. 16

    Copy files from FAT32 to NTFS, preserving date

  17. 17

    Can Ubuntu Linux be installed on FAT32 or NTFS?

  18. 18

    How to format Hard drive NTFS and convert it to FAT32?

  19. 19

    How do I use 'chmod' on an NTFS (or FAT32) partition?

  20. 20

    Convert FAT32 partition to NTFS without data loss

  21. 21

    UEFI USB only boots when formatted FAT32

  22. 22

    Default file permissions for FAT32 USB stick on Raspberry Pi

  23. 23

    Perfectly uncorrupted USB formatted FAT32 is RAW on Windows

  24. 24

    dd in mounted USB FAT32 for forensic analysis?

  25. 25

    Unable to mount FAT32 USB drive in Mint ("is not a block device")

  26. 26

    How to format the unallocated USB drive and make it as Fat32?

  27. 27

    How do I tell between FAT16 and FAT32 USB? (Windows)

  28. 28

    How do I boot a MBR [FAT(32)/NTFS] USB HDD from EFI without legacy bios?

  29. 29

    Why flash drive has different capacity when formatted using FAT32 and NTFS?

HotTag

Archive