4

I have a USB drive (whatever size) that I write an ISO to. After writing the image to the drive it only shows the partition size as the size of the ISO image with no additional space to write to. I need to be able to write additional data to the drive for additional setup that needs to be done for my specific machine but I can't access the other parts of the USB.

For example, with a 32Gb USB, after writing an image, the drive only shows the capacity as 2.4Gb with no additional space. When I open GParted and select the drive (/dev/sdb) it shows the capacity as 32Gb but says the Used portion is -- and the Unused is --. The file system shows gray and ISO9660 and its unable to mount.

All of the programs I have used that write an ISO to the USB reduce the size of the USB to the size of the ISO image and you lose all the extra space that is on the USB. I would like to be able to create a bootable USB with the terminal command line and just write the contents of the ISO to the USB in a separate process (not using dd or any of the image writing programs since these all reformat the drive to the size of the ISO), or, is there a way to reclaim the extra space of data after writing the ISO?

I can't find any way to make a USB bootable from the command line without writing an ISO image. I find plenty of instructions for making a USB bootable from Windows with diskpart, but I don't have that option available as I have completely migrated to Linux.

  • Just to verify it's not something specific to the ISO image you are using, I would suggest writing a different ISO (eg. ubuntu server) and verify if it happens with that ISO too. – Ankur A Sharma Feb 23 '21 at 21:51
  • Many tools use dd or dd under the hood and create a hybrid iso9660 DVD/flash drive. That then is just the size of the ISO, and not standard partitions. You can do a full install or a persistent install. You used to be able to just extract ISO to FAT32 for UEFI only boot, but they modified something, so last time I tried that it did not work. Persistent install https://help.ubuntu.com/community/mkusb/persistent & https://askubuntu.com/questions/1025847/usb-live-pen-persistent-boot-disk-in-uefi – oldfred Feb 23 '21 at 22:17
  • I would suggest rewriting the title to reflect your goal, that you want to achieve; something like "How to create a bootable USB and leave leftover space available to use?" – Levente Feb 23 '21 at 22:30
  • I have tried various programs and ISOs and, all of them, so far, have left the extra area beyond the size of the original ISO unavailable. I have used dd from the command line to write the iso to /dev/sdb and still the same. If I use a 256Gb USB and write an ISO of 3Gb it limits the size of the partition to the size of the ISO and the rest of the 253Gb is unavailable for use. All of them are writing in the same way as to limit the area's availability after the writing process is done. Everything boots fine at the moment, I just need to add more data to the USB and can't figure out how. – BuddyBoy Feb 24 '21 at 01:24
  • When I use Startup Disk Creator (usb-creator-gtk) in Ubuntu, I automatically get three partitions: (1) A partition with the ISO I just "burned", (2) a small FAT boot partition, and (3) a "writable" partition which contains the remaining space on the USB. (Someone had mentioned that the additional partition, named "writable", does not appear until after the ISO has been used to boot at lest once; I can't verify ~when~ the extra partition is created, but I definitely get this partition simply by using Startup Disk Creator). – Enterprise Feb 24 '21 at 04:35
  • PJ Singh, you are absolutely correct. I found that it isn't shown by the OS as a default, for some reason, until the USB has been used at least once the "writable" section is not accessible. So, it has to be booted to at least once before the other space on the USB can be used. – BuddyBoy Aug 11 '21 at 00:01

1 Answers1

2

Make Bootable USB with No Wasted Space from Ubuntu.

There are several methods of making a bootable USB in Ubuntu.

Basic categories are Persistent install and Full install

For a comparison see: Use Ubuntu on external hard drive in 2 different devices? . Instructions for Full install USB are included.

The main reason to make a Persistent install is to create a USB that can be used to install Ubuntu.

The best tool for doing this is mkusb, see: https://help.ubuntu.com/community/mkusb , mkusb will create a drive that will run Ubuntu and save between sessions, (Persistence), It can also create a NTFS data partition to be used by Linux or Windows like a normal USB.

enter image description here

enter image description here

The easiest tool for making a Live USB, that can be used for installing Ubuntu, comes with Ubuntu and is called Startup Disk Creator. It overwrites the whole disk as you mention in the question.

The useless space resulting from a SDC install can be easily converted to a NTFS or FAT32 data partition useful for data storage and transportation like mkusb.

Procedure Legacy Boot

  • Run Startup Disk Creator, dd. Disks or Etcher to create Live 19.10, or later, USB

  • Boot new Live USB to activate writable partition, (AKA casper-rw), then Power Off.

  • Reboot the Live USB toram. (press shift when booting, hit F6 and type a space and toram).

  • Unmount writable/casper-rw partition using Disks.

  • For NTFS open Terminal and run:

sudo mkfs.ntfs -f -L data /dev/sdx3

were x is the drive letter of the new Live USB

For FAT32 use:

sudo mkfs.vfat -F 32 -n data /dev/sdx1

The drive should now have the original data space minus the size of the OS ISO.

Procedure UEFI Boot

Same as Legacy Boot however at GRUB menu press e. After the words quiet splash type a space then toram. Press F10 to continue boot.

C.S.Cameron
  • 19,519
  • @Conway Phelps: Mkusb has several options, the one that you mention is the Live-only USB option. The one I mention is the Persistent Live option. Note that the mkusb Live only option can be given a FAT32 or NTFS data partition the same as a SDC, dd, Disks and Etcher install, (mkusb-plug will do this), but for most people, having a persistent install plus a data partition beats no persistence. I will add a picture to my answer to clear this up. – C.S.Cameron Feb 25 '21 at 06:44
  • Thank you, I have been able to use the mkusb to access the rest of the USB, so, yes, it does allow more than dd alone or other utilities. But I am still on the lookout for something that is more of an approximation to the utility DISKPART in DOS. – BuddyBoy Feb 25 '21 at 06:51
  • @Conway Phelps: You can let others know this worked as a solution to your question by clicking the arrow on the upper left corner of this answer, (Accept answer). Have you tried GParted in Ubuntu? One problem is that it doesn't work with ISO9660 partitions like SDC, Etcher and dd make. – C.S.Cameron Feb 25 '21 at 07:14