44

split from here

I have a 16gb flash drive, which I want a live ISO to boot from (via unetbootin or something similar). It'll be some 32bit distro that I can plug-in and boot on whatever computer I need to. Since it will be a live ISO, I'll need somewhere to save data. I want the USB drive to have about 1gb for the distro, and the other 15gb for data storage.

I made two FAT partitions, the first called 'bootable' and the second 'storage'. The storage works fine in Linux, but Windows only sees the bootable partition. The storage isn't accessible.

How can I make the data accessible on Windows, and still have a bootable distribution? If the answer is how to partition it, please include the order and type of each partition. Do I need swap space for this, or is this handled differently?

Brigand
  • 535
  • 1
  • 5
  • 13
  • Latest unetbootin has an option to create a compatible data storage partition. There is an input field where you can set the size of the data partition in MB. – ccpizza Sep 20 '17 at 22:20

8 Answers8

26

I would do it like this (assuming that sdb is your stick):

Delete any previous partition table:

# dd if=/dev/zero of=/dev/sdb bs=512 count=1

Create the new ones:

# fdisk /dev/sdb
> n
> p
> 1
(+1GB)
> a
> 1
(toggles boot flag)
> t
> c
(filesystem type)
> n
> p
> 2
(defaults)
> t
(specify 2nd partition)
> c
(filesystem type)
> p
(prints current configuration)
> w
(write the new table and quit)

Create the filesystems:

# mkfs.vfat /dev/sdb1
# mkfs.vfat /dev/sdb2
maxschlepzig
  • 56,316
  • 50
  • 205
  • 279
  • Thanks, I'll try this out when I get home. How does this differ from what I have now, though? Will it change how Windows mounts the partitions? – Brigand Jan 30 '12 at 12:55
  • 1
    I tried it, and it partitions everything. I did have to change the order though. It appears Windows only sees the first partition on the disk. When I try to boot from the second I get to the UNetbootin screen, but I can't get past. The only option is Default. Pressing ENTER or waiting the 10 seconds both restart the counter almost immediately. Is it having trouble reading something? Is the problem that the second partition is bootable? What's going wrong, and how do I fix it? – Brigand Jan 30 '12 at 22:37
  • @FakeRainBrigand, perhaps Windows has some braindead limitations regarding 'large' USB devices. – maxschlepzig Jan 31 '12 at 17:13
  • 2
    @maxschlepzig: no, from the little I found out, Windows has braindead limitations regarding the fact USB removable disks are seen as something different from a regular disk. I even found out a post somewhere suggesting hacking the device driver identification so that windows detects the USB device as a proper disk and recognizes all partitions. But that does not suit the OP, as it would request admin access to the computers. – njsg Feb 03 '12 at 21:28
  • 2
    let's just agree to say windows has limitations. – Aki Feb 03 '12 at 21:32
  • Why is the `dd` command needed? – user unknown Feb 04 '12 at 02:17
  • 1
    @userunknown, it is needed to delete any previous partition table, MBR etc. Thus you get a clean start before doing any partition and/or boot device experiments. Alternatively you would have to delete/modify existing partitions from inside your partition tool (e.g. fdisk). There is a slight chance that an existing partition table could influence the partition tool in its behaviour (think switch on compatibility mode or something like that). – maxschlepzig Feb 06 '12 at 19:13
  • @maxschlepzig: Thanks, but I don't know what `switch on compatibility mode` means. I'm very skeptic that there is a real case. Looks like snakeoil to me. – user unknown Feb 06 '12 at 20:01
  • @userunknown, it doesn't hurt anything. When you troubleshoot it, go for the maximum consistency possible. (My thoughts, anyway.) – Brigand Feb 06 '12 at 20:30
  • @userunknown, I wrote 'slight chance' and I didn't mention it as premier advantage of using `dd` to delete the MBR (including partition table). Main reasons to use `dd` for this are: you get a clean MBR in no time a) conveniently b) dependable and c) easy to understand and write down. It works for getting a clean start for all things bootloader/partition related. If you want to experiment you better make sure that your experiments are repeatable. – maxschlepzig Feb 06 '12 at 21:56
  • Maybe the slight chance of making a typo, and ruining the wrong drive is much higher than the `slight chance` you mention, which might, effectively, be zero? And since you start fdisk later anyway ... – user unknown Feb 06 '12 at 22:01
  • @userunknown, `fdisk` does not delete the whole MBR. Besides, you don't _have_to_ do it like this. If you are positive that just deleting the partition table is enough and you feel that it is more conveniently done (with the same effect) from your favourite partition tool, just use it. But be careful - using fdisk (or another tool) does not protect you from making typos and shooting yourself in the foot either ... – maxschlepzig Feb 08 '12 at 08:52
17

Using a graphical partition editor (Like Disk Utility on a Mac or GParted) simply make two FAT32 partitions and use the first one as your Windows-readable partition (as Windows only reads the first partition on a disk) and then use the second partition as your bootable startup disk (as the BIOS recognizes both partitions and knows which to boot from).

Then, when you insert the disk into a Mac or Linux PC you'll still see two partitions, but the one you need is always available within Windows.

Renan
  • 16,976
  • 8
  • 69
  • 88
Nathan
  • 171
  • 1
  • 2
  • After all my Googling and looking at the different StackExchange sites, this was the most help post. I simply have a MS DOS free space partition as the first partition and a bootable partition on the second partition. Thank you. – Jared Burrows Feb 10 '14 at 20:41
  • A better answer is here: http://askubuntu.com/questions/423300/live-usb-on-a-2-partition-usb-drive – Gabriel Staples May 23 '16 at 03:41
12

The absolutely easiest way I found using Linux was the following:

1) Partition the drive (I used GParted) in 2 partitions with the SECOND partition being large enough to hold your operating system. My drive was a 2gb Flash Drive so I created a 500Mb Partition 1 and the remainder as Partition2.

2) I installed the latest version of UNetbootin on my Linux Computer.

3) I opened UNetbootin and installed Ubuntu Mate on the 2nd Partition. In my case that was /sdb2.

When UNetbootin finished I tested the flash drive in a different computer and it worked!

Thank you UNetbootin!!!

descomputer
  • 121
  • 1
  • 3
0

Create First partition for Data storage with file system as NTFS because FAT32 does not support individual file not more than 4GB. Second partition as FAT32 and make it bootable. Windows always recognizes first partition, so it can read contents from first partition and boots from 2nd partition.

0

I have made an instruction on how to do this without the shell on my blog, and combine it with a full disk encrypted install.

The partition scheme we get there looks like this:

1st - storage -  FAT32, not bootable
no mount point

This can be as small or large as you want, this is just for the unencrypted storage.

2nd - boot - EXT4 unencrypted, bootable
used as Ext4 journaling file system
mount point: /boot

This only has to be a few hundred MB, the default for kali is just over 100MB, so 2-300 will do fine. This contains some static files to get the FDE'd Linux up and running.
Seeing as GRUB supports some encryption, you could include this, but we'll be keeping it simple today.

3rd- crypt - Logical volume group, not bootable
used as: physical volume for encryption.
mount point: /

At least 4GB. This will contain 2 'virtual' partitions, one for the root mount point, the other for swap space.
J.A.K.
  • 101
  • 1
0

Untried, But it might worked.

DummyDisk or DiskMod to recognise as Fixed Disk then Partition the "USB Drive" and Format the partition with the Bootable ISO and the other partitions are reserved as storage. (That's what I think anyway.)

TPS
  • 2,483
  • 5
  • 27
  • 45
Saina
  • 1
0

I did a really crude, but simple method in Windows 10. Get your linux ISO from whereever (I used linux mint) use rufus to create a bootable install.

In rufus, select the linux ISO, and then the "trick" is, set the persistant partition size to whatever you want your windows accessable storage parition to be.

Create the bootable disk, then go to windows disk management (Create and format hard disk partitions), find the unmountable weird persistant storage partition on your USB drive that rufus made, delete it, and then recreate it as a normal NTFS partition.

Crude, but seems to work!!

Etalon
  • 1
0

I know it's an old post, but I looked for some 'perfect' solution, compatible with Windows and Linux (and Mac), bootable... for a long time.

Found this year only => Ventoy <= Easy. Powerfull. Open Source. https://www.ventoy.net https://github.com/ventoy/Ventoy

Easy preparation of your the USB drive you carry, for data + multi ISO boot And some features I don't use (yet), like persistency for live distro.

My 64GB usb now has 6+ bootable ISO + many GB of my files too. Perfect