2

I am using Ubuntu 16.04 and have a large USB flash drive (256 GB) that I want to use to store my data as an encrypted backup. My data is less than 100 GB, so I my idea was to partition the USB drive (say 2x128 GB) and use the disk utility to format one of the partitions as ext4 with encryption. The plan is to format the other partition as fat32 in order to use it just as an ordinary USB stick and be compatible with both Linux and Windows systems.
I found a tutorial that roughly describes this: https://medium.com/tech-notes-and-geek-stuff/how-to-encrypt-a-usb-disk-47f6a4166f03
However, I couldn't even find out how exactly to do the first step: "format the USB key as an Extended partition. This will allow you to create multiple child partitions."

How can one format the USB as an "extended partition" and how to create multiple "child partitions"?

First, I formatted the whole USB as fat32 via the Gnome Disk utility and then tried GParted and used the Resize/Move option (in menu on right click) on the whole USB. That created two parts. One has now the format fat32 but the other has no/unknown format and it seems I cannot change that. (Here is a screenshot.)
enter image description here
Any ideas how to proceed? Is that what I want even possible?

  • MBR that has 4 primary partitions and if any one primary is made as the extended partition, can act as container for as many logical partitions as you want. But MBR is old. http://en.wikipedia.org/wiki/Master_boot_record Some advantages to use the newer gpt partitioning. http://ubuntuforums.org/showthread.php?t=1457901 & https://wiki.archlinux.org/index.php/GUID_Partition_Table#Advantages_of_GPT But if a bootable drive with gpt, you need either a bios_grub partition for BIOS boot or an ESP - efi system partition for UEFI boot. – oldfred Sep 03 '20 at 03:34

1 Answers1

3

You've over-complicated the task at hand with these "extended" and "child" partitions. You also made a mistake when you formatted the entire disk as FAT32. If you format the entire disk as one partition, you will have no room for another partition.

The solution is quite simple.

  • First, open the Disks application (gnome-disk-utility).

  • Format the Disk as MBR: Select your device on the left, then click the three horizontal bars near the top right. Choose "Format Disk..." to format the entire disk. (For flash drives, choose the MBR partition scheme for compatibility.)

  • Make your FAT32 Partition": Click the + symbol under the bottom left of the bar graph that represents the partitions on this disk. Choose a partition size that leaves room for your other partition. Give it a name, and choose "For use with all systems and devices (FAT)"

  • Make your LUKS encrypted partition: Now select the "Free Space" at the end of the drive and click + again to add another partition. Give it a name and choose "Internal disk for use with Linux systems only (Ext4)" and check "Password protect volume (LUKS)". Enter and confirm your password. Click "Create" one last time, and you're done.

Nmath
  • 12,333
  • Hi Nmath, thanks a lot for the advice! I tried it but after formatting the disk with the Gnome Disk Utility (Step 2) I get the error:
    "Error formatting disk Error synchronizing after initial wipe: Timed out waiting for object (udisks-error-quark, 0)" However, something seems to have happened, since now I have three volumes on the disk: 1 called "Free Space" of 289 MB, a second one called "Partition 2" of 8.3 GB and a third one also called "Free Space" of 260 GB.
    – Ubuntu_fan Sep 04 '20 at 13:14
  • When I select the third part and try to create the FAT32 partition (Step 3), I get the error "Error creating partition Don't know how to create partitions this partition table of type `(null)' (udisks-error-quark, 0)". By the way, after inserting the USB flash drive, it doesn't seem to be recognized by the file explorer. Any ideas? – Ubuntu_fan Sep 04 '20 at 13:22
  • BTW, now GParted just shows one big 250 GiB chunk called "unallocated" that is grayed out. There are not many options that I have. The only possibility seems to be to click on "Devices" and then select "Create Partition Table". Should I try that? There are several options for a partition table to choose from, including msdos and gpt. – Ubuntu_fan Sep 04 '20 at 13:30
  • You must successfully format the drive so it has a valid partition scheme before you start making partitions. Do not skip steps or continue to barrel thru if you get an error This is advice that you should follow with any Linux problem. – Nmath Sep 04 '20 at 16:42
  • But I think the USB device is faulty. Either that or the port that you are using is going bad. One final thing to try before throwing in the towel on this hardware: try to do this from a live session, solely for the purpose of process of elimination to rule out anything "dirty" in your current installation. You'll need 2 flash drives, one for the live session. If it doesn't work with a "clean" OS, then the flash drive probably is bad. FYI: it's a common scam to advertise a very large flash drive capacity, but the product actually doesn't have that capacity. Even name brand can be counterfeit – Nmath Sep 04 '20 at 16:43
  • Very useful answer - thank you for your time. – Duncan May 10 '21 at 08:02