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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
03-30-2017, 11:47 AM
|
#1
|
LQ Newbie
Registered: Mar 2017
Location: UK
Posts: 7
Rep:
|
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.
|
|
|
03-30-2017, 12:10 PM
|
#2
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
Two partition bootable USB
if this allows two then the same mythology should let you create more then two. I have not read it.
|
|
|
03-30-2017, 01:24 PM
|
#3
|
LQ Guru
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,864
|
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.
|
|
|
03-30-2017, 01:43 PM
|
#4
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
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.
|
|
|
03-30-2017, 02:18 PM
|
#5
|
Senior Member
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
|
Quote:
Originally Posted by Wolfpeach42
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,
|
|
|
03-30-2017, 04:12 PM
|
#6
|
Moderator
Registered: Mar 2008
Posts: 22,130
|
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.
|
03-30-2017, 05:11 PM
|
#7
|
LQ Guru
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,864
|
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.
|
|
|
03-30-2017, 05:56 PM
|
#8
|
LQ Newbie
Registered: Mar 2017
Location: UK
Posts: 7
Original Poster
Rep:
|
Quote:
Originally Posted by yancek
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.
|
|
|
03-30-2017, 06:27 PM
|
#9
|
LQ Newbie
Registered: Mar 2017
Location: UK
Posts: 7
Original Poster
Rep:
|
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
|
|
|
03-30-2017, 06:57 PM
|
#10
|
Senior Member
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
|
Quote:
Originally Posted by yancek
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.
|
03-30-2017, 09:42 PM
|
#11
|
LQ Guru
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,864
|
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.
|
03-31-2017, 01:16 AM
|
#12
|
LQ Newbie
Registered: Mar 2017
Location: UK
Posts: 7
Original Poster
Rep:
|
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.
|
|
|
03-31-2017, 07:14 AM
|
#13
|
LQ Guru
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,864
|
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.
|
03-31-2017, 07:54 AM
|
#14
|
LQ Newbie
Registered: Mar 2017
Location: UK
Posts: 7
Original Poster
Rep:
|
Quote:
Originally Posted by yancek
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.
|
|
|
03-31-2017, 08:42 AM
|
#15
|
Member
Registered: Nov 2016
Location: UK
Distribution: Debian Jessie
Posts: 154
Rep:
|
Quote:
Originally Posted by Wolfpeach42
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.
|
|
|
All times are GMT -5. The time now is 08:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|