Wierd USB problem

I decided to give openSUSE a whirl and its left me with a weird problem on the flash drive I used to install it. I’ve mentioned this on another tech forum I use but want to address it specifically to the suse bunch too. RaspberryPi USB flash weirdness here if anyones interested.

In summary, I used Win7 and image writer to put the Gnome Live CD on an 8GB flash drive. This installed on my netbook with no probs. Once done the drive was formatted back to one FAT partition and renamed USB KEY.

Yesterday I installed the raspberry pi xbmc and thought to use the USB drive as local storage for music. However if I plug the the USB drive into the Pi, it mounts at “/media/opensuse Live CD GNOME/”. Somehow after formatting and renaming, something has been left. Figuring it would be something related to booting the drive I formatted again changing to a GPT to ensure the boot sector would be overwritten, but still no joy. Under both opensuse and win7 the drive shows one FAT partition of 7.4GB called “USB KEY” in any partition manager I choose to use.

The Pi however sees a 0.1GB drive called “opensuse Live CD GNOME”.

The nearest solution I’ve found is to wipe the drive using dd mentioned here
http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/467985-how-remove-opensuse-live-cd-kde-partition-usb-stick-4.html. Any ideas what has happened or whatelse I can do about it?

Thanks,

Nathan

Hi Nathan, welcome

This phenomenon has had me wondering too, a couple of years ago I even threw away a (at that moment) quite expensive 16GB stick, since I thought it was a hardware fault. Which of course it isn’t.

The cause: the Live media come with a hybrid filesystem, one could say one file system on top of the other. The top layer so to speak gets removed, but the lower one stays, and gets recognized…

The solution: you’ll have to completely empty the USB device, by writing zeros to it from begin to end of the disk/stick

Here’s how:

  • Unplug all USB storage
  • Plug in the faulty USB device
  • Open a terminal window and do
ls -ltr /dev | tail 

This shows the last 10 lines of the content of the /dev folder, where entries for devices are being created. Look for sdX, where X is an alphabetic char, not “a” ( /dev/sda is the internal hdd), if you only have one HDD in your machine and no other USB storage devices connected, this should be “sdb”, replace the X in the command below with the alphabetic char found in the ouput

  • Write zeros to the device:
su -c 'dd if=/dev/zero of=/dev/sdX'

(enter your root password)

  • Wait until it’s done, this may take a while

When it’s done, you have a completely empty USB-stick, with no partition table, no filesystems, ready to be used from Windows and Linux.

Thanks for the quick reply. I was hoping it wouldn’t come down to a 7 hour wait while the whole thing got over written. As as extra point of interest, I used EaseUS partition manager to wipe the drive previously. I did so again but deleted everything from the drive, then removed and reconnected before creating a new partition.

Now if I leave the flash drive directly connected to the Pi (e.g. not through a hub) while it boots up, it sees both partitions as separate and presents both the xbmc. However if I plug it in either directly or through a hub after the Pi has started, it only shows the 0.1GB empty partition.

I think I will leave dd running when I go to work one day, as even though its kind of usable now, I would like the convenience of being able to hot plug it.

IIRC my 8GB took about an hour, not seven, but it does take a long time, yes.

On 2012-11-16 15:26, nathan600 wrote:
>
> Thanks for the quick reply. I was hoping it wouldn’t come down to a 7
> hour wait while the whole thing got over written. As as extra point of
> interest, I used EaseUS partition manager to wipe the drive previously.
> I did so again but deleted everything from the drive, then removed and
> reconnected before creating a new partition.

You might try to erase only, say, 500MB, it should work.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

I gave dd a go and just overwrote a small portion of the disk to hit the boot sector. It still shows up as two drives when connected to the Pi. I will wipe the whole thing tomorrow.

On the plus side, I found the opensuse can successfully ssh to my pi, can share files across my network to the pi, and can ftp music to be stored on the SD card…everything except completely wipe a USB key.

Part of me is starting to wonder if the problem is now being caused by the Pi, rather than the afore mentioned suse image. If dd fails with a complete write, I’ll take this to the RaspberryPi forums and see what they make of it.

After zeroing a small part of the disk, you should unplug it, then plug it back in. Otherwise the system remembers what it saw when first plugged in. Wait a while before unplugging, to allow time for the data to be written back to the device. I’m not sure whether the “sync” command actually does anything, but it wouldn’t hurt.

I would probably overwrite (with zeros) around 1 MB, then run “fdisk” on that disk to create an empty MBR. I would then unplug it before doing anything else.

I recently heard a free software named Easeus partition master, it can help you repart your partition without causing any damage of your data and files.