question for a pro, about my usb stick [RESOLVED+TUTORIAL]

rythman

New Member
Joined
Aug 12, 2019
Messages
7
Reaction score
5
Credits
0
hi all there is my problem,

for installing linux in my usb stick i'm tryng rufus with (persistent option that i choose 1Gb) .
in my usb stick 2 primary partition:
partition 1: 13GB raw
partition 2: rw-casper <--- wtf
with some software he tell me that the partition 1 is over writed the partition 2 with 30 sectors conflict.
(with gparted unable to format, unable to resize, unable to move, unable to do anithing...)
please how can i do
 

Attachments

  • 333222222.PNG
    333222222.PNG
    18.9 KB · Views: 641
  • 444444444444455555.PNG
    444444444444455555.PNG
    20 KB · Views: 650
Last edited:


partition 2: rw-casper <--- wtf
This is where "persistence" is stored on the USB.


with some software he tell me that the partition 1 is over writed the partition 2 with 30 sectors conflict.
I've run into this before too. I suspect that different programs may sometimes evaluate the partitions and structure differently... similar to how a file's size can also show different sizes sometimes. This is not too terrible to worry about, I don't think.


(with gparted unable to format, unable to resize, unable to move, unable to do anithing...)
please how can i do
Now this is more serious to worry about, if Gparted can't manage the USB anymore. I have also run into similar problems when a program (like Rufus, but others too) seem to really mess up the USB file and/or partition structure. I have a couple of methods that may help to recover your USB drive, but it will totally erase the USB in the process.

If you want to try one of these methods, tell me if you prefer Linux or Windows to work with. I will want to review my notes and test it out first to make sure that I think it will still work.

Cheers
 
This is where "persistence" is stored on the USB.



I've run into this before too. I suspect that different programs may sometimes evaluate the partitions and structure differently... similar to how a file's size can also show different sizes sometimes. This is not too terrible to worry about, I don't think.



Now this is more serious to worry about, if Gparted can't manage the USB anymore. I have also run into similar problems when a program (like Rufus, but others too) seem to really mess up the USB file and/or partition structure. I have a couple of methods that may help to recover your USB drive, but it will totally erase the USB in the process.

If you want to try one of these methods, tell me if you prefer Linux or Windows to work with. I will want to review my notes and test it out first to make sure that I think it will still work.

Cheers

verry explained thanks for reply,
i'm ready to erase all data in my usb stick.
linux and windows are the same for me, i need format this stick for using linux.
i want to try any solution and i agreer if bricked is only my responsability.
 
Okay, let's go with Windows first... it has less instructions to follow. If it doesn't work, then we will go over the Linux method. Follow each of these commands exactly ((comments in double parentheses)):

Open Start Menu and run: CMD ((does not have to run as Administrator))

Enter these commands:

>diskpart ((one word... this opens DISKPART in a new CMD window))

DISKPART> list disk ((two words))

DISKPART> select disk # ((# is the flash drive number... could be 0 thru 5, or more. Check the sizes. Be very, very sure you are choosing the right drive!))

DISKPART> clean ((This totally erases the drive you picked above. Be sure!))

DISKPART> create partition primary ((don't reverse the words here... that's an easy mistake))

DISKPART> select partition 1

DISKPART> format fs=fat32 quick ((can also use fs=ntfs -- it shows 0% for the whole process, then 100% when complete))

DISKPART> assign

DISKPART> exit ((this closes the DISKPART window))

>exit ((this closes the original CMD window))


And hopefully the USB flash drive will be usable again now. Run Gparted from Linux to check it there, and you might run whatever other program you used that showed the sector conflicts and see if those have gone away too. Good luck! :D
 
ok lets go:
diskpart lunched
DISKPART>list disk (seem ok)
DISKPART>select disk 1 (ok)
DISKPART> clean (ok)
DISKPART> create partition primary (error no enough space)
DISKPART> select partition 1 (ok)
DISKPART> format fs=fat32 quick (incorrect parameter)
DISKPART> assign (ok)

gparted cant format partitions because 2 partitions too close and this partitions sharing the same sectors between 2 partitions attached , maybe need shrink with entering to a file in usb pen and hack and modify partitions spaces for giving space between these partitions in conflict, what you think about this idea? maybe interessent maybe not.
 
Ah, well... it was worth a try. I think the Linux tools are more powerful, but a little more complicated to use. You may be familiar with the command tool called fdisk... and we're going to use that briefly, but then we will use a different tool called gdisk. You may have to install that first. If you have a Debian/Ubuntu based Linux, use sudo apt install gdisk.

I happened to test on a USB that had a similar problem with overlapping blocks... see my report below. This may be different from the error you had. This USB was working fine though, even with the overlapping blocks. So, as I said before, that wasn't the serious part of your problem, I don't think.

Windowshot_2019-08-14_20:41:29.png



OK, here we go. Please read through a time or two to get a feel for what we're doing. You have to follow each step carefully, but you should be able to start again from the beginning if there is any issue. I am very hopeful that we fix your USB this time and not turn it into a brick... but anything is possible. If the USB does not respond to these instruction, I don't think I have any other ideas. Everything below is from a Linux command line ((comments in parentheses, like before)):

1. Install gdisk, if not already installed

2. sudo fdisk -l ((to identify your drive... mine is /dev/sdg and I will use that in my examples))

3. sudo umount /dev/sdg1 ((unmount the partition, if it was automounted when plugged in))
sudo umount /dev/sdg2 ((just in case, since you have 2 partitions on the USB))

4. sudo gdisk /dev/sdg ((this is where my errors showed in the screen above))

5. You are now in the gdisk menu... it looks like this shown below:

6. Command (? for help): x ((enter x to put gdisk in eXpert mode))

7. Expert Command (? for help): z ((enter z to Zap the drive... this bricks it when you answer Y below))

8. About to wipe out GPT on /dev/sdg. Proceed? (Y/N): y

9. Blank out MBR? (Y/N): y

10. You are now back at terminal prompt after gdisk exits by itself.

11. sudo gdisk /dev/sdg ((running gdisk again... don't need eXpert mode this time))

12. Command (? for help): p ((will show drive info, but this is not necessary))

13. Command (? for help): n ((for New partition))

14. ((Accept the defaults for Partition 1, First sector, and Last sector, then enter 0700 where it asks for Hex code or GUID. Hex code 0700 is "Microsoft Basic Data".))

15. Command (? for help): w ((write the new partition table to disk and exit))

16. Next, hit Y when asked to Proceed creating a new GPT partition table ((yes, this is gdisk, not fdisk, so it makes GPT partition table))

17. Now, you are back at terminal prompt, and you need to create the filesystem...

18. sudo mkfs -t ntfs /dev/sdg1 ((for NTFS or...))
sudo mkfs -t vfat /dev/sdg1 ((for FAT32... I usually prefer FAT32 in most cases))


Okay... I think that's it (if I didn't make any mistakes copying my notes). After all these steps, look at your USB with Gparted. In my case, it "named the partition" something like, "Microsoft Basic Data" but Gparted will let you name it something else, or just delete that name. You don't have to unmount to change the name. When I run gdisk again on the drive (sudo gdisk /dev/sdg)... after it is unmounted... my errors are gone, as shown here:

Windowshot_2019-08-14_21:03:54.png



It's a lot easier to go through and do these steps than it is to read them! Or write them! It really isn't too hard of a process, and it has almost always worked for me to recover USB drives that have been messed up by .iso burning programs. But sometimes the drives can be already badly damaged, and so it is possible that even all of this will fail. But good luck... I hope that it works! :D

Cheers
 
I went through a large collection of USB drives this morning and began "zapping" them as described above. A few that I found were a bit different, so I thought I'd make mention of them here. I'm pretty sure that I used the Linux dd command to burn Linux .iso files to these drives. The difference that I noticed was the the "filesystem" shown by Gparted was iso9660 instead of FAT32. And "zapping" the drive did not change that, even after using the mkfs command. That's kind of weird.

So instead I used Gparted to format the partition to FAT32 first. That worked. Then I went through the "zapping" procedure again and everything was back to normal, including the partition name that gets applied to it (Microsoft Basic Data).

I'm not sure how Rufus created your drive, but just in case it made an iso9660 filesystem, I thought this info might be relevant too. By the way, gdisk also sometimes showed a slightly different response, besides the overlapping blocks... it was nothing big, but you want to read carefully as you go in case you encounter something different from my instructions.

Cheers
 
Lets go with gdisk:
sudo fdisk -l (ok)
Disk /dev/sdc: 14,4 GiB, 15500574720 bytes, 30274560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000974c6

Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 28177411 28175364 13,4G c W95 FAT32 (LBA)
/dev/sdc2 28177412 30274555 2097144 1024M 83 Linux


sudo umount /dev/sdc ( not work because this partition with problem de format raw)
sudo umount /dev/sdc2 (because only this partition is umountable because ext2)
sudo gdisk /dev/sdc (ok)
Warning! Secondary partition table overlaps the last partition by
29 blocks!
Try reducing the partition table size by 116 entries.
(Use the 's' item on the experts' menu.)


Expert Command (ok)
About to wipe out GPT on /dev/sdg. Proceed? (Y/N): y

Blank out MBR? (Y/N): y (ok)

You are now back at terminal prompt after gdisk exits by itself. (ok)

sudo gdisk /dev/sdc (ok)

Command (? for help): p (ok)
no enough space to creat primary partition
Command (? for help): n (ok)

((Accept the defaults for Partition 1, First sector, and Last sector, then enter 0700 where it asks for Hex code or GUID. Hex code 0700 is "Microsoft Basic Data".)) (ok)

Command (? for help): w (ok)

Next, hit Y when asked to Proceed creating a new GPT partition table (ok)

sudo mkfs -t vfat /dev/sdc1
result : not solved maybe because partition table overlaps the last partition by
29 blocks!
 
I went through a large collection of USB drives this morning and began "zapping" them as described above. A few that I found were a bit different, so I thought I'd make mention of them here. I'm pretty sure that I used the Linux dd command to burn Linux .iso files to these drives. The difference that I noticed was the the "filesystem" shown by Gparted was iso9660 instead of FAT32. And "zapping" the drive did not change that, even after using the mkfs command. That's kind of weird.

So instead I used Gparted to format the partition to FAT32 first. That worked. Then I went through the "zapping" procedure again and everything was back to normal, including the partition name that gets applied to it (Microsoft Basic Data).

I'm not sure how Rufus created your drive, but just in case it made an iso9660 filesystem, I thought this info might be relevant too. By the way, gdisk also sometimes showed a slightly different response, besides the overlapping blocks... it was nothing big, but you want to read carefully as you go in case you encounter something different from my instructions.

Cheers
i agreer , overlapping exist!
reduce the partition can resolve in this case? (gparted and all softwares cant do that and somme erros apprearing when trying format and resize).

partition 1 :
Command (? for help): i
Partition number (1-2): 1
Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
Partition unique GUID: EA885916-4324-4982-8F54-757FC339CDA4
First sector: 2048 (at 1024.0 KiB)
Last sector: 28177411 (at 13.4 GiB)
Partition size: 28175364 sectors (13.4 GiB)
Attribute flags: 0000000000000000
Partition name: 'Microsoft basic data'

partition 2:
Command (? for help): i
Partition number (1-2): 2
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: E88CDC6F-18AA-4C30-B11C-2CB25BA82057
First sector: 28177412 (at 13.4 GiB)
Last sector: 30274555 (at 14.4 GiB)
Partition size: 2097144 sectors (1024.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'Linux filesystem'


other informations :

Disk /dev/sdc: 14,4 GiB, 15500574720 bytes, 30274560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000974c6

Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 28177411 28175364 13,4G c W95 FAT32 (LBA)
/dev/sdc2 28177412 30274555 2097144 1024M 83 Linux
 
sudo umount /dev/sdc ( not work because this partition with problem de format raw)
sudo umount /dev/sdc2 (because only this partition is umountable because ext2)
This may be the first mistake (if not just a typing error). You need the number "1" in the first command, as in, "sudo umount /dev/sdc1" and not just "/dev/sdc". This may be why this step did not work correctly. If the other partition, /dev/sdc2, said it was "not mounted".... that is okay, I think.

Before trying the "zap" method again, please look at your USB with Gparted again. Be sure you click on the first partition (/dev/sdc1) so that partition is "highlighted" (usually in a blue color). With that partition highlighted, then hit the Delete key on your keyboard (or you can go into the Partition Menu at the top of Gparted, and select Delete in there). If it responds and looks like it has been deleted... it hasn't. There is one final step... you have to click on the far-right button on the row of buttons just below the top menu (this button may look like a check mark or a kind of arrow symbol).... if you hold your mouse over this button, it will say "Apply All Operations". And so you have to click that button to so that the partition is actually deleted. If this works to delete the partition, then repeat the process to delete the other partition too.

Sorry to go over the Gparted directions so carefully, but I don't know if you are very skilled with using it or not. Sometimes people forget to click the "Apply" button and so the changes are not saved.


Disklabel type: dos
This quote, from your "other information" section, shows me for sure that the "zap" method failed to work when you went through it... even though you wrote (ok) for most of your responses. I think the reason is probably because you did not "umount /dev/sdc1" correctly, as I wrote above. When all the "zap" steps are successfully completed, the Disklabel type will be gpt, not dos.

So, if you are willing... please try Gparted as I described above. It's possible that Gparted may work if you had been missing any steps (highlight first, apply at the end). It is also possible that Gparted will format the partitions for you... but you must first unmount them for Gparted to work. Both the Unmount and Format tools are in the Partition Menu at the top.

Following any work you do with Gparted, then try the "zap" method again too. I didn't see any other things that you might have missed, so I hope that by correctly doing "umount /dev/sdc1" that this process will be successful and that it will remove the overlapping blocks.

Good luck!
 
Hi atanere happy to hear you, and sorry about my error.

after following your tutorial i finally retreive my usb, and i'm verry happy to have someone like you help people to resolve a must of difficute situations like mine,
only the professional and smart person can, you'r my man!
4295
 
Hey, that's great news! I'm very happy that I was able to help get you through it! I have fought with this problem before too, which is why I finally took some notes on how to fix it. Maybe this thread will also help others in the future too.

Cheers!
 
I know that the dust should be settling on this Thread now that it has been successfully resolved, but it raises a couple of issues that might need further explanation.

0cd7RxV.gif


(Wizard appears in a puff of smoke)

G'day @rythman and welcome to linux.org :)

Can you tell me
  1. Was it a 16 GB USB stick you are using?
  2. Is it your intention to install a full version of Linux to the stick, and if so which one, eg Linux Mint, Ubuntu, other?
  3. OR did you just want to install a Live Linux on the stick (from which you can still install a full version to the hard drive on your computer) and yet still have it save changes you make to the stick?
  4. Was it Rufus v3.6 you are using, and what version of Windows are you running?
Rufus 3.6 is the first to use Persistence but it is experimental. Have a read here

https://rufus.ie/

.. and it says, in part

Changelog

  • Version 3.6(2019.07.18)
    • Add support for persistent partitions [EXPERIMENTAL]
      (Note: The above won't work with Ubuntu until Ubuntu bug #1489855 is properly fixed)
    • Add a mode to use VDSwhen partitioning/formatting (
      Alt
      -
      V
      ) [EXPERIMENTAL]

In turn, that Bug referred to is at Launchpad, and can be read about here, but be warned it is very complicated.

https://bugs.launchpad.net/ubuntu/+source/casper/+bug/1489855

The bug was first reported 2015-08-28, and appears to be still in progress. So if Rufus' persistence capability is relying on that being fixed, then you risk borking your stick if you use it again.

Try Unetbootin or other solution if you really want the Persistence.

Stan, on dd:

A few that I found were a bit different, so I thought I'd make mention of them here. I'm pretty sure that I used the Linux dd command to burn Linux .iso files to these drives. The difference that I noticed was the the "filesystem" shown by Gparted was iso9660 instead of FAT32. And "zapping" the drive did not change that, even after using the mkfs command. That's kind of weird.

if you use dd to put an iso image on to usb, then the usb now has the filing system appropriate to an optical disk. As far as Linux is concerned, it looks like an optical drive run off a usb port. It won't be treated as a random-access memory device any more.

If you want to turn it back into a conventional memory device, a partition editor probably won't do it. It will see the device has the iso9660 filing system and assume you're trying to partition a CD/DVD. You may need to destroy the filing system ID before using the partition editor, with something like

Code:
dd if=/dev/zero bs=1M count=10 of=/dev/sdx

... as root or prefaced with sudo.

That being said, I am a notoriously lazy sod, and seldom do this. I just beat and bash the USB stick into submission, and then reuse it for YAD (Yet Another Distro).

Cheers and it's Friday here in Oz so

Avagudweegend

Chris Turner
wizardfromoz
 
thanks wizardfromoz,

i use toshiba 16Gb.
i'm choosing linux mint and moving from windows because he is laggy.
linux persistent is a good idea , no need to move my computer, i just plug usb stick and run linux os.
the problem appearing when i try install linux os i'm clicking "persistence" in rufus option, and that brick my usb pen.
thanks for useful issues.
 

Staff online


Top