Ubuntu – Re-use of Ubuntu Live USB

live-usbusb

I created a Ubuntu 15.04 Live USB using the Start Up Disk Creator. It worked fine; no problems at all.

However, the USB stick I used now cannot be used as a storage device. It will still boot Ubuntu, but when plugged in normally it doesn't appear in Nautilus at all. Plugging it into my MacBook Pro gives a warning about an invalid file system.

Running dmesg after plugging it in gives

[  123.912989] usb 1-3: new high-speed USB device number 7 using xhci_hcd
[  124.043543] usb 1-3: New USB device found, idVendor=4146, idProduct=ba65
[  124.043552] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  124.043556] usb 1-3: Product: USB Mass Storage Device
[  124.043560] usb 1-3: Manufacturer: PRETEC UG-02GB
[  124.043563] usb 1-3: SerialNumber: 5dd1c2372a6703
[  124.046014] usb-storage 1-3:1.0: USB Mass Storage device detected
[  124.046247] scsi host7: usb-storage 1-3:1.0
[  125.044940] scsi 7:0:0:0: Direct-Access     Pretec   UltimatGuard     6.00 PQ: 0 ANSI: 2
[  125.045864] sd 7:0:0:0: Attached scsi generic sg3 type 0
[  125.046317] sd 7:0:0:0: [sdc] 3947016 512-byte logical blocks: (2.02 GB/1.88 GiB)
[  125.046445] sd 7:0:0:0: [sdc] Write Protect is off
[  125.046449] sd 7:0:0:0: [sdc] Mode Sense: 00 00 00 00
[  125.046580] sd 7:0:0:0: [sdc] Asking for cache data failed
[  125.046584] sd 7:0:0:0: [sdc] Assuming drive cache: write through
[  125.180958]  sdc: sdc1 sdc2
[  125.182353] sd 7:0:0:0: [sdc] Attached SCSI removable disk

Note the Asking for cache data failed – is this an error?

The disk appears in the output of lsblk as sdc
(details of sda and sr0 omitted for clarity)

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdc       8:32   1   1.9G  0 disk 
├─sdc1    8:33   1   1.1G  0 part 
└─sdc2    8:34   1   2.2M  0 part 

The disk also shows up in the output of sudo lshw -class disk

  *-disk                  
       description: SCSI Disk
       physical id: 0.0.0
       bus info: scsi@7:0.0.0
       logical name: /dev/sdc
       size: 1927MiB (2020MB)
       capabilities: partitioned partitioned:dos
       configuration: logicalsectorsize=512 sectorsize=512 signature=1cae5859

Is there something wrong with the USB stick?

Is it not mounting because it's bootable?

What is the best/correct way to turn it back into a "normal" USB disk (i.e. not a bootable install disk) ?

Edit: Using the Erase Disk option of the Start Up Disk Creator gives this message

org.freedesktop.DBus.Python.GLib.Error: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/share/usb-creator/usb-creator-helper", line 274, in Format
    part.call_set_flags_sync(boot_dos_flag, no_options, None)
GLib.Error: udisks-error-quark: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error setting partition flags on /dev/sdc2: Command-line `parted --script "/dev/sdc" "set 2 boot off"' exited with non-zero exit status 1: Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes.
 (0)

but the disk does now show up in Nautilus. However, it's not empty, it has some EFI boot stuff on it.

Best Answer

  1. Open up "startup disk creator".
  2. Plug in your USB pendrive.
  3. Click to erase all data on the device.
  4. Exit startup disk creator.
  5. Unplug the device and plug it back in and you should now be able to use the device.

This also works after using dd.


Alternatively, I'm pretty sure you can do this to reformat the drive: warning, this will delete all content on the device so make sure you specify the correct device!

sudo mkfs -t vfat -I /dev/sdx

where /dev/sdx is the actual device.

In your case, it looks like it should be /dev/sdc:sudo mkfs -t vfat -I /dev/sdc


UPDATE

According to this similar question with the same error, you should be able to completely wipe the entire device using the following command:

sudo dd if=/dev/zero of=/dev/sdx
sudo mkfs -t vfat -I /dev/sdx

Where /dev/sdx is the actual device. In this particular case, your device appears to be /dev/sdc so you should run:

sudo dd if=/dev/zero of=/dev/sdc
sudo mkfs -t vfat -I /dev/sdc
Related Question