Re-claim USB flash drive space

Fatdog64 ISO image is an isohybrid. It can be burned into a CD or DVD, but it can also be "imaged" or "flashed" (or just dd-ed) to a USB flash drive like this:


dd if=fatdog.iso of=/dev/sdb bs=4M

Replace /dev/sdb above with your actual USB flash drive device name, and make sure it is pointing to your USB flash drive and NOT YOUR HARDDISK (otherwise irrecoverable data lost will happen). If you're not sure, don't do this - and you can ignore the rest of this post.

The problem is, due to the UEFI isohybrid structure, after you do this, the rest of the USB flash drive becomes unusable, because there is not partition table entry that provides access to this space. Easy, just create one, right? Yes, but the most common tool to do so, gparted, won't work (it won't recognise the hybrid MBR/GPT partition tables in the flash drive). fdisk will work, but it is too scary for most people.

I have created a simple script that will automate this process - behind the scene it will use sfdisk to create the partition (=partition 3). After using the script, you still need to make a filesystem on it, but after that you're good to go.

The script does some checking to ensure that you only target a USB flash drive (=making sure it is not removable, making sure it is connected through USB port, making sure that partition 3 on the target device isn't already exist.

Future version of Fatdog64 will have this script included in the ISO image (so you can run it from the USB flash drive you have just dd-ed), but for now, it is available here: fix-usb.sh


Posted on 20 Feb 2013, 22:33 - Categories: Fatdog64
Edit - Delete


Comments:

Posted on 23 Feb 2013, 11:47 by 01micko
"nice script!"
Ha! I knew I saw this somewhere! Trouble is in the woof template (slacko and standard pups) it filters out sfdisk so I had to install that manually from util-linux.

I did FAT filesystem but in hindsight I should have used ext2 because it's an 8GB stick!

Thanks,

Cheers.
Delete

Posted on 4 Mar 2013, 12:56 by jamesbond
"Missing sfdisk?"
I would have thought that sfdisk would be available in all puppies, but I have spent too much time in Fatdog that I forget which apps are available in mainline puppies and which ones aren't
Delete



Add Comment

Title
Author
 
Content
Show Smilies
Security Code 2642306
Mascot of Fatdog64
Password (to protect your identity)