[SOLVED]To reset an USB key

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED]To reset an USB key

Postby pmithrandir » Apr 27th, '13, 14:14

Hello.

I used my useb key to boot a live mageia. Now, I don't need anymore to keep it, so I would like to reset my partition table and to format my usb key back to fat32 filesystem.

I tried to use MCC, to remove all partition from my USB key, to create a new fat32 partition, and to format it, even with bad sector detection.

I tried also to remove the partition using fdisk and to create a new partition. (from sector 2048 to the last one...)
But, in both case, I get the same result. When I insert the usb key in the laptop, KDE detect 2 partition, including the one created by mandriva-seed.
I have no way to use any partition anymore.

Do you have any idea of stronger way to reset my usb key ?

Thank you,
Pierre
Last edited by pmithrandir on May 2nd, '13, 09:08, edited 1 time in total.
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby sander85 » Apr 27th, '13, 15:56

dd if=/dev/zero of=/dev/sdX where sdX is your usb key. This should erase everything.
Stand for something, or you will fall for nothing.
-- Richard Stallman
User avatar
sander85
 
Posts: 88
Joined: Jan 28th, '12, 20:41
Location: Estonia

Re: To reset an USB key

Postby doktor5000 » Apr 27th, '13, 15:59

Should, yes. But i've also observed what Pierre describes. dump a Mageia media on a flash drive or harddisk,
and afterwards zero out the first 2MB of that drive, and repartition and format it.
Weird thing is, that dolphin then shows 2 entries, one for the Mageia media which was previously there (but obviously cannot be mounted)
and also the current partition on the drive.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18062
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: To reset an USB key

Postby pmithrandir » Apr 27th, '13, 17:20

Doktor, that exactly the problem I see.

Did you find any way to resolv it ?
I think that last time I finished on windows, but I'm not sure.

PIerre
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby alf » Apr 27th, '13, 18:04

in such cases i use gparted.
for windows problems reboot; for linux problems be root
alf
 
Posts: 326
Joined: Apr 1st, '11, 23:07
Location: DE Paderborn

Re: To reset an USB key

Postby pmithrandir » Apr 27th, '13, 20:36

Same result.
Gparted say the usb key is empty, but it display a partition when I insert it in KDE.
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby martinw » Apr 27th, '13, 22:03

I've never seen this myself, but I use GNOME, not KDE. It seems like KDE is caching the partition table. If you create a new user and log in as that user, do you get the same behaviour?
martinw
 
Posts: 608
Joined: May 14th, '11, 10:59

Re: To reset an USB key

Postby doktor5000 » Apr 27th, '13, 22:42

pmithrandir wrote:Did you find any way to resolv it ?

Well, i just don't click on the old partition label in Dolphin. Didn't bug me enough to invest time to diagnose it further, it's not big deal.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18062
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: To reset an USB key

Postby pmithrandir » Apr 27th, '13, 22:45

I have the same behaviour on another computer... so I don't think cache is involved
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby madeye » Apr 30th, '13, 11:23

What if you try to make a new partition table using parted?
I've had luck with that on some harddrives that behaved in a similar fashion.
- Madeye

When I supply commands in an answer, please make sure you understand them before you run them! Use google or man to check!
User avatar
madeye
 
Posts: 110
Joined: Jul 23rd, '11, 12:36
Location: Aabenraa, Denmark

Re: To reset an USB key

Postby pmithrandir » Apr 30th, '13, 11:30

I'm gonna try this evening.

Thank you,
Pierre
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby doktor5000 » Apr 30th, '13, 20:29

Weird thing was in my case, that zeroing the whole stick, and then creating a new partition table, still the old one was recognised.
So martinw may have a valid point there, but IMHO that would be quite dumb - why would you cache a partition table?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18062
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: To reset an USB key

Postby madeye » Apr 30th, '13, 21:48

I just tried with two different USB sticks. I used dd to copy the contents of an installation CD to the sticks, checked that partitions were created (both in dolphin and with parted) and then I zero'ed them with dd.
In my case I ended up with an empty stick, and no partitions were shown in neither dolphin nor parted. (actucally parted showed me a message that no partition table exists)

I've heard that some sticks are worse than others in the sense that a part of them is reserved for internal use. In some cases a windows program could be used to remove this reserved space. Don't know if this could also be the problem with the OPs USB stick.
- Madeye

When I supply commands in an answer, please make sure you understand them before you run them! Use google or man to check!
User avatar
madeye
 
Posts: 110
Joined: Jul 23rd, '11, 12:36
Location: Aabenraa, Denmark

Re: To reset an USB key

Postby doktor5000 » Apr 30th, '13, 22:03

In my case happened also with brand-new sticks from Kingston, Corsair, Sharkoon. Only step afterwards was mostly to create an NTFS partition via diskdrake on it, plug it out, and back in.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18062
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: To reset an USB key

Postby martinw » Apr 30th, '13, 22:07

I agree that caching the partition table would be a daft thing to do! But I'm struggling to think of another explanation that would survive zeroing the whole drive :?
martinw
 
Posts: 608
Joined: May 14th, '11, 10:59

Re: To reset an USB key

Postby alf » Apr 30th, '13, 23:28

never had problems doing this with gparted
- delete existing partitions
- create new partiition table
- create new partion
but one thing, the label of the stick remains.
for windows problems reboot; for linux problems be root
alf
 
Posts: 326
Joined: Apr 1st, '11, 23:07
Location: DE Paderborn

Re: To reset an USB key

Postby digigold » May 1st, '13, 07:25

I used to have issues when cleaning and preparing usb drives, but if you use the following steps you should have no issues.

1 - use fdisk do open device
2 - delete any/all existing partitions
3 - create new partition table
4 - create new primary partition of type "c" (W95 FAT32 (LBA))
5 - format using the following command (assuming /dev/sdb1 your new partition.)
Code: Select all
mkdosfs -F 32 -n newlabelname /dev/sdb1


Now the drive should be as good as new.
"A mind that is stretched by a new experience can never go back to its old dimensions."
~Oliver Wendell Holmes, Jr.
User avatar
digigold
 
Posts: 150
Joined: May 9th, '12, 14:50
Location: Northern U.S.

Re: To reset an USB key

Postby pmithrandir » May 1st, '13, 11:28

Hello,

I tried with gparted or fdisk + mkdosfs.

I still have my 2nd partition created with mageia folder on it. with folder :
- booot
- isolinux
- loopbacks

I think I created it with the following command line
Code: Select all
dd if=../Telechargements/Mageia-2-LiveCD-KDE4-Europe1-Americas-i586-CD/Mageia-2-LiveCD-KDE4-Europe1-Americas-i586-CD.iso of=/dev/sdb bs=1M


Do you think it could explain anything ?

Pierre
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby madeye » May 1st, '13, 14:45

If the CD image you used has support for EFI booting, then I think it's normal that two partitions are created on the USB stick.
Parted should show one of the partitions as hidden, but this does not stop dolphin from showing it in the list.

I've had trouble installing from such a USB stick. It was necessary to unhide the partition before I could boot from it. :?:

Nevertheless it should be possible to get rid of the partitions again. Here is what I did with my USB stick.
Code: Select all
dd if=/dev/zero of=/dev/sdX bs=4096
parted /dev/sdX mklabel msdos
parted /dev/sdX mkpart primary 2048s -1
mkfs.vfat -F 32 /dev/sdX1

Make sure you substitute sdX with the correct drive in the commands above, or you could delete the wrong drive! :!:

Just out fo curiosity. What is the make and model of the USB stick you're having trouble with?
- Madeye

When I supply commands in an answer, please make sure you understand them before you run them! Use google or man to check!
User avatar
madeye
 
Posts: 110
Joined: Jul 23rd, '11, 12:36
Location: Aabenraa, Denmark

Re: To reset an USB key

Postby pmithrandir » May 1st, '13, 16:03

Hello.

i tried this one, but I got an error on this line :
Code: Select all
parted /dev/sdb mkpart primary 2048s -1


Any idea why ?
[root@portablePierre pmithrandir]# parted /dev/sdb mkpart primary 2048s -1
parted : option invalide -- '1'
Usage : parted [-hlmsv] [-a <alignement>] [PERIPHERIQUE [COMMANDE [PARAMETRES]]...]
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby sander85 » May 1st, '13, 16:27

Why not use gdisk?
Stand for something, or you will fall for nothing.
-- Richard Stallman
User avatar
sander85
 
Posts: 88
Joined: Jan 28th, '12, 20:41
Location: Estonia

Re: To reset an USB key

Postby madeye » May 1st, '13, 18:24

@pmithrandir,

Oops. I think I made a mistake. Although I remember using exactly that method before.
Using the following will work:
Code: Select all
parted /dev/sdX mkpart primary 2048s <size of stick>

You should enter the size of your USB stick where appropriate. My stick is 16GB, so I used 16G. (the exact command I used is shown below.)
Code: Select all
parted /dev/sdc mkpart primary 2048s 16G


@sander85,
gdisk should work just as well, I've just gotten used to using parted.
- Madeye

When I supply commands in an answer, please make sure you understand them before you run them! Use google or man to check!
User avatar
madeye
 
Posts: 110
Joined: Jul 23rd, '11, 12:36
Location: Aabenraa, Denmark

Re: To reset an USB key

Postby pmithrandir » May 1st, '13, 23:05

It works.

Thank you very much !!!

Pierre
Creator of : http://www.jaiuneidee.net a "direct democracy" website for France.
User avatar
pmithrandir
 
Posts: 442
Joined: May 4th, '11, 19:30

Re: To reset an USB key

Postby isadora » May 2nd, '13, 06:57

Pierre, please be so kind marking the topic accordingly, thank you!!! ;)
..........bird from paradise..........

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
—Antoine de Saint-Exupéry
User avatar
isadora
 
Posts: 2766
Joined: Mar 25th, '11, 16:03
Location: Netherlands


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest