Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] Why is GParted or cfdisk so buggy with Live USB ?

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
User avatar
TheExplorer
Posts: 254
Joined: 2010-05-31 15:04

[SOLVED] Why is GParted or cfdisk so buggy with Live USB ?

#1 Post by TheExplorer »

Guys, why GParted or cfdisk doesn't work as expected with Live Linux USB flash sticks ?

I mean when you dd or cp a Linux distro .iso onto any USB flash stick and then, after a while, decide to clean it and bring it to its original state.
GParted starts showing me lots of warnings like: 'we need to inform the kernel about something, but we can't... you need to reboot' and driver descriptors and physical block sizes mismatch like this one, etc, etc.
I also tried cfdisk to erase all partitions on it but was getting the same errors and warnings.

In order to make a clean USB stick I need to reboot and accomplish this successfully with Winblows' Drive Management tool :(

Am I doing something wrong? What other tools do you, guys, use when working with USB ?

Thank you in advance.
Last edited by TheExplorer on 2018-03-24 07:20, edited 2 times in total.
Money is the evil of all root. Be free. Use Linux.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Why does GParted or cfdisk is buggy with Live USB ?

#2 Post by bw123 »

I don't recall ever seeing that, but I found some links that might be helpful.
https://duckduckgo.com/html/?q=driver+d ... ze+warning
Am I doing something wrong? What other tools do you, guys, use when working with USB ?
I don't think any method is doing anything wrong if it works, the thing is to "understand" the tools you use. I still like cfdisk, even though it's kind of old fashioned, and I sometimes use parted and fdisk. I'm still not a fan of gparted or other gui partition tools, but I think they work very well nowadays from what I have read.

I think it's probably some unusual dd usage that caused your issue, but can't say for sure. Might be a good thing for you to follow up on, and let people know here so they don;t repeat the error? Thanks.
resigned by AI ChatGPT

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Why does GParted or cfdisk is buggy with Live USB ?

#3 Post by Segfault »

Nowadays I use mostly gdisk, never had any issues. But then again, I do not partition USB sticks and hard drives for a single filesystem, I just create the filesystem on raw device. I think Windows cannot read a USB stick without partition table, but I couldn't care less. Last Windows crashed out here about 2004.
BTW, using ancient partitioning tools is a good way to create misaligned partitions.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Why does GParted or cfdisk is buggy with Live USB ?

#4 Post by p.H »

The partition table(s) in some ISO hybrid images such as Debian installer ones is invalid and partitioning tools do not handle it properly.
The best thing to do is to erase all metadata with dd or wipefs, then create a new clean partition table with any partitioning tool.

User avatar
TheExplorer
Posts: 254
Joined: 2010-05-31 15:04

Re: Why does GParted or cfdisk is buggy with Live USB ?

#5 Post by TheExplorer »

p.H wrote:The partition table(s) in some ISO hybrid images such as Debian installer ones is invalid and partitioning tools do not handle it properly.
The best thing to do is to erase all metadata with dd or wipefs, then create a new clean partition table with any partitioning tool.
Yep, exactly what I was looking for. It's indeed Debian hybrid ISO. Fdisk just hangs for 5 minutes while reading devices... It really annoys me.

Thank you for wipefs, didn't know about this one. And what should I do with dd? dd if=/dev/urandom > /dev/sdX ?
Money is the evil of all root. Be free. Use Linux.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Why does GParted or cfdisk is buggy with Live USB ?

#6 Post by bw123 »

TheExplorer wrote:It really annoys me.
It's okay, wipefs is mentioned in cfdisk man page, and fdisk also has explanation for --wipe in it's man page. The idea I think is that if you dd a device with 2048 block size (like a cd/iso9660) onto another device that is 512 byte block size, then it is of course invalid, so you can't edit it interactively. That's not really "buggy" but yeah it is confusing. Man pages are your friend.
resigned by AI ChatGPT

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Why does GParted or cfdisk is buggy with Live USB ?

#7 Post by p.H »

Do not bother with urandom. /dev/zero is fine.
Also, you need to erase only the first 64 kB or so containing the MBR, the GPT primary header, the Apple partition table and the ISO 9660 header.

User avatar
TheExplorer
Posts: 254
Joined: 2010-05-31 15:04

Re: Why does GParted or cfdisk is buggy with Live USB ?

#8 Post by TheExplorer »

p.H wrote:Do not bother with urandom. /dev/zero is fine.
Also, you need to erase only the first 64 kB or so containing the MBR, the GPT primary header, the Apple partition table and the ISO 9660 header.
Thank you!
Money is the evil of all root. Be free. Use Linux.

User avatar
TheExplorer
Posts: 254
Joined: 2010-05-31 15:04

Re: Why does GParted or cfdisk is buggy with Live USB ?

#9 Post by TheExplorer »

bw123 wrote:It's okay, wipefs is mentioned in cfdisk man page, and fdisk also has explanation for --wipe in it's man page. The idea I think is that if you dd a device with 2048 block size (like a cd/iso9660) onto another device that is 512 byte block size, then it is of course invalid, so you can't edit it interactively. That's not really "buggy" but yeah it is confusing. Man pages are your friend.
Got it. Thanks!
Money is the evil of all root. Be free. Use Linux.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Why is GParted or cfdisk so buggy with Live USB ?

#10 Post by Head_on_a_Stick »

I use gdisk to clear "live" USB sticks:

Code: Select all

# sgdisk --zap-all
deadbang

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Why does GParted or cfdisk is buggy with Live USB ?

#11 Post by bw123 »

TheExplorer wrote: Yep, exactly what I was looking for. It's indeed Debian hybrid ISO. Fdisk just hangs for 5 minutes while reading devices... It really annoys me.
I'm not having any problem reading my live usb with fdisk or cfdisk. From what I recall I made this one with dd, and used cfdisk to create the extra partitions. Again, it might be something to follow up on if you can narrow down the issue. I don't know whether it's the same on the regualr install images I don;t have one handy atm.

Code: Select all

# fdisk /dev/sdc

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdc: 14.9 GiB, 16008609792 bytes, 31266816 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: 0x4502db07

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdc1  *           0  5049279  5049280  2.4G  0 Empty
/dev/sdc2           2136     2967      832  416K ef EFI (FAT-12/16/32)
/dev/sdc3        5050368 21827583 16777216    8G 83 Linux
/dev/sdc4       21827584 31266815  9439232  4.5G  c W95 FAT32 (LBA)

cfdisk info on first part...

Code: Select all

Partition type: Empty (0)
      Attributes: 80
Filesystem UUID: 2017-06-20-01-10-31-00 
Filesystem LABEL: d-live 9.0.1 kde amd64
      Filesystem: iso9660 
resigned by AI ChatGPT

User avatar
sunrat
Administrator
Administrator
Posts: 6457
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 472 times

Re: Why is GParted or cfdisk so buggy with Live USB ?

#12 Post by sunrat »

This command should restore a USB key to original format, "superfloppy" mode unpartitioned:

Code: Select all

mkfs.vfat -I /dev/sdx
(upper case "i")
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
TheExplorer
Posts: 254
Joined: 2010-05-31 15:04

Re: Why is GParted or cfdisk so buggy with Live USB ?

#13 Post by TheExplorer »

sunrat wrote:mkfs.vfat -I /dev/sdx
Ok, thanks!
Money is the evil of all root. Be free. Use Linux.

User avatar
sunrat
Administrator
Administrator
Posts: 6457
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 472 times

Re: [SOLVED] Why is GParted or cfdisk so buggy with Live USB

#14 Post by sunrat »

Make sure to replace the "x" with the correct letter for your drive, check with

Code: Select all

dmesg |tail
And the drive must be unmounted first.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
TheExplorer
Posts: 254
Joined: 2010-05-31 15:04

Re: [SOLVED] Why is GParted or cfdisk so buggy with Live USB

#15 Post by TheExplorer »

Yeah, I know. Thanks!
Money is the evil of all root. Be free. Use Linux.

Post Reply