LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-30-2017, 11:47 AM   #1
Wolfpeach42
LQ Newbie
 
Registered: Mar 2017
Location: UK
Posts: 7

Rep: Reputation: Disabled
How to create bootable USB with multiple partitions?


I'm trying to create a bootable live linux USB stick with a separate data partition, as it seems a waste to have several gig of unused space after the iso.

I've tried using gparted to partition an 8Gig stick into two FAT32 partitions, first one 7Gig (for data), second one 1Gig (for an iso), marking the 2nd partition as "bootable".

Then I opened a terminal in the folder containing the iso, and used:

sudo dd if=[iso name] of=/dev/sdc1 bs=4M

I'm sure that /dev/sdc1 was the correct partition.

I've tried with a Linux Lite iso, and also a Puppy Linux iso.

The iso write seems to work fine, but then when I try to boot from the stick, it does not recognise it. When I use a standard USB with a single partition, containing an iso of one of the same distros created in windows with Win32DiskImager, it works fine.
 
Old 03-30-2017, 12:10 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Two partition bootable USB

if this allows two then the same mythology should let you create more then two. I have not read it.
 
Old 03-30-2017, 01:24 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 9,389

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Using dd to the device /dev/sdb rather than a partition should work and give you a bootable usb. I'm not aware of any way to create another partition on the device written this way with dd.

Using various other software, you can create a bootable usb with persistence and if you have a persistent usb which can be done with some Linux distributions, you may not have to create the mount point or mount it each time. Not really sure about the mounting, an entry in fstab. I've tried that a few times with persistent usb drives and never got it to work.

You can install Grub to the MBR of the usb drive pointing to the boot directory that you have created previously and manually create a grub.cfg file to boot an iso on that partition or another partition. Booting an iso directly is possible with Grub2 but will not boot all version of Linux. This again is a read-only filesystem so you will need to create a mount point and manually mount each boot.

A likely reason for your not being able to boot the usb you created with dd is writing to the partition rather than the device.

Last edited by yancek; 03-31-2017 at 07:24 AM.
 
Old 03-30-2017, 01:43 PM   #4
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
I've had limited success with partitioning the storage device and rsync-ing the / of the image.

# mount -o loop -t iso9660 image.iso /mnt/loop
# cd /mnt/loop
# ls

A lot of the newer bootable images put the actual / in a squashfs file in a sub-tree. And other /boot/ and such sub imaging. So getting to an rsync-able / that is bootable isn't always easy.

# mount /dev/sdX# /mnt/partition
# rsync -aRXHv ./* /mnt/partition/

Although I tend to make a minimal debootstrap install on another partition to "rescue" and contain a bootloader like grub. Which is how I manage booting the various partitions.

-----

But to be honest, use something like easy2boot. You'll have better odds of maintaining your sanity.
 
Old 03-30-2017, 02:18 PM   #5
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch
Posts: 1,253

Rep: Reputation: 467Reputation: 467Reputation: 467Reputation: 467Reputation: 467
Quote:
Originally Posted by Wolfpeach42 View Post
I'm trying to create a bootable live linux USB stick with a separate data partition, as it seems a waste to have several gig of unused space after the iso....
I don't think you really need another partition on the USB drive to do this. After formatting it as a bootable distro, just use the rest of the space on the same partition ... Create a "Data" directory if you like, to distinguish it more readily.

Cheers,
 
Old 03-30-2017, 04:12 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,836

Rep: Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370
There may be a few ways to make dual booted usb. As above notes, dd to a partition is not correct when using an iso. Even if it were a hybrid iso.

Another way might be to get a large enough usb and install each linux on it as if it were a real mechanical hard drive. Then you'd have loader(grub2 usually) and two linux distros. If you get too many distro's you may have to work on issue about primary partitions and such.


You could use tools like YUMI (I think) that create multiboot usb's.

Could use grub4dos and boot directly to some iso images.
 
1 members found this post helpful.
Old 03-30-2017, 05:11 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 9,389

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
I don't think you really need another partition on the USB drive to do this. After formatting it as a bootable distro, just use the rest of the space on the same partition ... Create a "Data" directory if you like, to distinguish it more readily.
That won't work as the OP wants a Live CD which will be read-only whether using dd, unetbootin or similar software. The easiest thing to do is to do an actual install which could easily be done with Puppy. The Linux Lite iso is only 800+ MB so that could probably be installed on an 8GB flash with room to spare on the same partition or another partition.
 
Old 03-30-2017, 05:56 PM   #8
Wolfpeach42
LQ Newbie
 
Registered: Mar 2017
Location: UK
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
Use the dd command on the device (/dev/sdc) rather than the partition. Boot another Linux system with GParted or GParted from a CD. Resize (shrink) the part you have the iso on to slightly larger than the iso.
i reformated the USB, and used dd on the device (sdc) rather than the partition (sdc1) - this gives me a bootable USB stick. So far so good... However, it has no partitions on it. GParted comes up with the error "Invalid partition table - recursive partition on /dev/sdc", and does not recognise anything on the USB to shrink. It lets me create a partition... but this wipes the iso and I am back to square 1.

It seems burning the iso on the device gives a bootable stick, but no partitions, so I cant use the same stick to store anything. Creating partitions, and burning the iso to one of the partitions, produces a stick that is not bootable.
 
Old 03-30-2017, 06:27 PM   #9
Wolfpeach42
LQ Newbie
 
Registered: Mar 2017
Location: UK
Posts: 7

Original Poster
Rep: Reputation: Disabled
Tried something else - rather than reformat the whole disk, and knowing that the iso was at the start, and just under 1gig in size, I created a partition after the iso (sdb1, leaving the first gig unallocated. This worked, and the usb was still bootable (I'm using it now...) but I have not been able to mount or access sdb1. fdisk shows me that the partition exists, but I cant access it (tried, see below)

Disk /dev/sdb: 7.2 GiB, 7747397632 bytes, 15131636 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x613089a1

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2539520 15128575 12589056 6G b W95 FAT32

linux@linux:~$ mkdir /tmp/x/
linux@linux:~$ sudo mount /dev/sdb1 /tmp/x/
mount: /dev/sdb1 is already mounted or /tmp/x busy
 
Old 03-30-2017, 06:57 PM   #10
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch
Posts: 1,253

Rep: Reputation: 467Reputation: 467Reputation: 467Reputation: 467Reputation: 467
Quote:
Originally Posted by yancek View Post
That won't work as the OP wants a Live CD which will be read-only whether using dd, unetbootin or similar software. The easiest thing to do is to do an actual install which could easily be done with Puppy. The Linux Lite iso is only 800+ MB so that could probably be installed on an 8GB flash with room to spare on the same partition or another partition.
Hmmmm. I do this all the time. The difference perhaps is that I use YUMI to format the USB drive to allow me to have several ready to boot distros and tools. If there is any space left in the single partition on the drive, it is accessible read/write (formatted FAT32) for any usage whatsoever.

I apologize - I should have been clearer about that particularity.

Cheers !
 
1 members found this post helpful.
Old 03-30-2017, 09:42 PM   #11
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 9,389

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
The difference perhaps is that I use YUMI to format the USB drive to allow me to have several ready to boot distros and tools.
There's more to YUMI than simply doing a dd of an iso which the OP indicated he was using. What happens with dd is explained in post 8 above, the 'invalid partition table' message.

Quote:
I created a partition after the iso (sdb1, leaving the first gig unallocated. This worked, and the usb was still bootable
Your post immediately prior to the above explains that, you have no partition table. I recall using dd to write an iso to a flash drive and getting the same message when accessing it in GParted. I don't know how one could access and use different partitions without a partition table?

You might try YUMI suggested above which works well. The best software I have found to create a bootable usb with a separate data partition is mkusb. It creates a boot partition, installs the iso on a separate partition, creates an ext4 persistent partition any size you want as well as an ntfs partition for data. Very simple, fast and reliable. The drawback is that from what I have read, it is only Ubuntu and derivatives so you would need an Ubuntu to run it from but it would work with Linux Lite.

Last edited by yancek; 03-30-2017 at 09:48 PM.
 
1 members found this post helpful.
Old 03-31-2017, 01:16 AM   #12
Wolfpeach42
LQ Newbie
 
Registered: Mar 2017
Location: UK
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks All! Futzing with bootable partitions and MBRs seems to escalate rapidly way past my capability, so I will try YUMI and mkusb as recommended above (Someone also recommended easy2boot).

[Edit: YUMI seemed to work initially, and booted at first thru the YUMI loader, then the Linux lite initial "feather" screen, but stopped at a screen asking for a Ubuntu username & password... which I had never set, as this was a fresh boot from a live iso... odd. Lucid Puppy Linux worked first time, though!]

Last edited by Wolfpeach42; 03-31-2017 at 02:03 AM.
 
Old 03-31-2017, 07:14 AM   #13
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 9,389

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
What you describe in your last post is not expected behavior. When I booted Linux Lite from the iso, it booted directly to the Desktop. Either something went wrong with the creation during YUMI or you might have had a bad download of the iso. Glad you got the Puppy working.
 
1 members found this post helpful.
Old 03-31-2017, 07:54 AM   #14
Wolfpeach42
LQ Newbie
 
Registered: Mar 2017
Location: UK
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
What you describe in your last post is not expected behavior.
Inorite!? I will try again with a fresh Linux Lite iso download and install. But, in any case, YUMI seems to have done the job. Really elegant, easy to use way to create live linux USB sticks (that will also store data). The ability to boot multiple distros is cherry on the cake.
 
Old 03-31-2017, 08:42 AM   #15
trumpforprez
Member
 
Registered: Nov 2016
Location: UK
Distribution: Debian Jessie
Posts: 154

Rep: Reputation: Disabled
Quote:
Originally Posted by Wolfpeach42 View Post
Inorite!? I will try again with a fresh Linux Lite iso download and install. But, in any case, YUMI seems to have done the job. Really elegant, easy to use way to create live linux USB sticks (that will also store data). The ability to boot multiple distros is cherry on the cake.
Glad to hear the good news.
I have a full debian OS burnt onto a 16gb usb. The OS uses up the whole usb.
I booted from a separate OS (on my HDD), opened gparted and attempted to shrink the OS on the usb. However, gparted wouldn't let me. I'm wondering if that was your situation.

I did lsblk to see if the usb was mounted automatically when I booted from my OS on my HDD:
Code:
lsblk -o name,mountpoint,label,size,uuid
Turns out the usb was mounted and that's why gparted wouldn't let me make changes to the usb.
I unmounted the usb, opened gparted and it let me shrink the OS and add a data partition.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone a bootable CF card with multiple partitions and copy to bigger drive RoyLittle0 Linux - Newbie 12 02-22-2015 07:43 AM
Image a bootable CF card with multiple partitions RoyLittle0 Linux - Newbie 1 02-21-2015 10:03 PM
Regarding Creation of Bootable ISO of hard disk image having multiple partitions.. nagamohan_p Linux - Newbie 1 08-26-2006 10:52 PM
Regarding Creation of Bootable ISO of hard disk image having multiple partitions.. nagamohan_p Programming 1 08-25-2006 09:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration