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

If none of the more specific forums is the right place to ask

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

Postby TheExplorer » 2018-03-23 09:14

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
TheExplorer
 
Posts: 241
Joined: 2010-05-31 15:04

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

Postby bw123 » 2018-03-23 10:22

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.
User avatar
bw123
 
Posts: 2926
Joined: 2011-05-09 06:02
Location: TN_USA

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

Postby Segfault » 2018-03-23 10:28

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.
Segfault
 
Posts: 664
Joined: 2005-09-24 12:24

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

Postby p.H » 2018-03-23 11:49

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.
p.H
 
Posts: 343
Joined: 2017-09-17 07:12

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

Postby TheExplorer » 2018-03-23 12:17

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
TheExplorer
 
Posts: 241
Joined: 2010-05-31 15:04

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

Postby bw123 » 2018-03-23 12:40

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.
User avatar
bw123
 
Posts: 2926
Joined: 2011-05-09 06:02
Location: TN_USA

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

Postby p.H » 2018-03-23 13:34

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.
p.H
 
Posts: 343
Joined: 2017-09-17 07:12

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

Postby TheExplorer » 2018-03-23 13:45

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: 241
Joined: 2010-05-31 15:04

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

Postby TheExplorer » 2018-03-23 13:47

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
TheExplorer
 
Posts: 241
Joined: 2010-05-31 15:04

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

Postby Head_on_a_Stick » 2018-03-23 21:13

I use gdisk to clear "live" USB sticks:
Code: Select all
# sgdisk --zap-all
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 7413
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby bw123 » 2018-03-23 22:00

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
User avatar
bw123
 
Posts: 2926
Joined: 2011-05-09 06:02
Location: TN_USA

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

Postby sunrat » 2018-03-23 22:42

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
sunrat
 
Posts: 2219
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

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

Postby TheExplorer » 2018-03-24 07:20

sunrat wrote:mkfs.vfat -I /dev/sdx


Ok, thanks!
Money is the evil of all root. Be free. Use Linux.
User avatar
TheExplorer
 
Posts: 241
Joined: 2010-05-31 15:04

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

Postby sunrat » 2018-03-24 21:28

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
sunrat
 
Posts: 2219
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

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

Postby TheExplorer » 2018-03-25 08:56

Yeah, I know. Thanks!
Money is the evil of all root. Be free. Use Linux.
User avatar
TheExplorer
 
Posts: 241
Joined: 2010-05-31 15:04


Return to General Questions

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable