First, from time to time I need to transfer data between arbitrary computers with Windows 7 or later (and, in seldom cases, from/to Mac). I prefer to use a USB drive with a FAT32 partition for this purpose. Second, I boot Debian live from external media every once in a while. For this purpose, given a completely free USB stick, I typically dd an image from http://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/, but I'm ready to change this way of creating live partitions.

How to achieve both goals using the same USB pen drive? (Yes, I know that persistence is not enough: both the FAT32 partition on the drive has to be usable under Windows, and the Debian live has to be bootable. Yes, I've tried Unetbootin; it didn't produce a bootable pendrive; don't ask me why, I have no idea.)

  • The problem you face here is that Windows responds very badly to USB drives with multiple partitions.What I use to do was backup partitions to a file, delete all but one partition and then load the backup but only onto the end of disk GPT backup. THen later I can just do restore from backup in gdisk to get the other partitions back. But this is a horrible work around and the only reason I did it was because it was a 64GB stick that I used for all versions of windows and linux for recovery. Thanks to these windows limitations its far easier to just use separate USB drives. – jdwolf Nov 18 '17 at 3:18
  • It's pretty involved but the live isos for the most part SHOULD support loopback mounting meaning that you can run them live as an iso file instead of writing the iso into a partition. If you like that method I'll write up an answer for it? – jdwolf Nov 18 '17 at 3:20
  • Yes I've tried this plenty and it works. Just haven't done it recently and I know for some distributions that aren't debian it does not work. – jdwolf Nov 18 '17 at 17:26

Many live Linux distributions support iso loopback mounting during boot while GRUB supports loading Linux from within an ISO. Combine these and its possible to boot a live Linux iso just as a file. This should serve your requirements but be warned some don't support this or at least they do not officially support it.

First install GRUB to your USB drive:

Mount usb to mnt

mount /dev/sdb1 /mnt/usb

To install so legacy BIOS boots the USB use:

grub-install --target=i386-pc --boot-directory=/mnt/usb/boot /dev/sdb

For UEFI use:

grub-install --target=x86_64-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable

if /mnt/usb/boot doesn't exist create it with mkdir then do:

grub-mkconfig -o /mnt/usb/boot/grub/grub.cfg

Then edit /mnt/usb/boot/grub/grub.cfg with:

menuentry "Debian live ISO" {
  insmod loopback
  insmod iso9660
  set isofile="/debian.iso"
  loopback loop $isofile
  linux (loop)/install.amd/vmlinuz findiso=$isofile vga=788 -- quiet
  initrd (loop)/install.amd/initrd.gz

Your Answer

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