Re: Repair bootable USB stick

2020-02-10 Thread David Christensen

On 2020-02-09 17:00, ghe2001 wrote:

On Sunday, February 9, 2020 5:10 PM, David Christensen 
 wrote:

# time dd if=/dev/zero bs=1M
of=/dev/disk/by-id/usb-SanDisk_Ultra_Fit_-0\:0

Assuming dd has already put the img at the beginning of the thumbDrive, how 
about asking gparted or eq to resize the / partition?


TIMTOWTDI.  I prefer KISS and the big hammer.


David



Re: Repair bootable USB stick

2020-02-10 Thread Thomas Schmitt
Hi,

(please Cc: debian-user@lists.debian.org when replying

Jon Magee wrote:
> I ran dd as you suggested, unplugged/replugged the USB, and
> started KDE partition manager. It saw it as an 'unknown device (0 B)'. I
> tried to create a new partition table and got this error:
> Create a new partition table (type: gpt) on ‘/dev/sdc’
> Job: Create new partition table on device ‘/dev/sdc’
> Creating partition table failed: Could not create a new partition table in
> the backend for device ‘/dev/sdc’.
> Create new partition table on device ‘/dev/sdc’: Error
> Create a new partition table (type: gpt) on ‘/dev/sdc’: Error

("Error" is about the most useless problem specification that i can imagine.)

What do you get from inspecting the first two blocks of the device ?
Please show the outputs of

  dd if=/dev/sdc bs=512 count=2 | od -t x1

and

  /sbin/fdisk -l /dev/sdc


> To follow-up, the previous error was when I made a GPT partition table. An
> MS-DOS table succeeded, but the device still showed as 0 B, with "No valid
> partition table found on this device." (KDE partition manager) In Disks, it
> still shows the old partitions but I can't do anything to them, format or
> otherwise.

This partitioning has probably overwritten the state after the zeroizing
dd run.  Nevertheless, the new state is of interest too.


> In Disks, it
> still shows the old partitions but I can't do anything to them, format or
> otherwise.

We will have to reduce complexity of this problem by avoiding frontend
programs which try to be smart.


Have a nice day :)

Thomas



Re: Repair bootable USB stick

2020-02-09 Thread David Christensen

On 2020-02-09 14:27, Thomas Schmitt wrote:

   dd if=/dev/zero bs=512 count=2 of=/dev/sdc


When I want to zero-fill a USB flash drive:

1   1M = 1024*1024 byte blocks read and write much faster than 512 byte 
blocks.


2.  I zero-fill the whole flash drive (by omitting 'count'):

a.  Get rid of any leftovers from any source, known or unknown.

b.  Verifies fast.

c.  Once I have written an image:

i.  I know that non-zero bytes came from the image.

ii. If I take an image later, zeroes compress nicely.

3.  Debian provides human-readable /dev/disk/by-id device nodes.  Using 
them reduces the chance that I will blow away the wrong drive.



So, I would suggest the following (adjust device node to suit):

# time dd if=/dev/zero bs=1M 
of=/dev/disk/by-id/usb-SanDisk_Ultra_Fit_-0\:0



Optional:

4.  'status=progress'

5.  'time dd '


David



Re: Repair bootable USB stick

2020-02-09 Thread Thomas Schmitt
Hi,

dd brought your stick into this state. dd should get it out too.

  dd if=/dev/zero bs=512 count=2 of=/dev/sdc

should zap the MBR partition table and the GPT header block.
(Of course verify three times that /dev/sdc is the address of the stick
 before erasing its partition table.)

Then do

  hdparm -z /dev/sdc

or unplug and re-plug the USB stick.
A partition editor should afterwards perceive it as unpartitioned.


> I recently helped a friend install Mint on her computer, [...]
> I now have the problem that I can only format 3.9Gb of the drive.
> "Error deleting partition /dev/sdc1: Failed to read partition table on
> device '/dev/sdc/ (/dev/sdc: unrecognised disk label) (udisks-error-quark,
> 0)"

Mint 64bit ISOs have the same isohybrid layout as Debian amd64 ISOs.
I.e. MBR partition table with nested partitions and outer partition type 0
plus an invalid GPT.

It would be interesting to see whether a more conservative layout would
be more digestible to the partition editors offered by Debian.


Have a nice day :)

Thomas



Repair bootable USB stick

2020-02-09 Thread Jon Magee
I recently helped a friend install Mint on her computer, and I made a 
bootable USB stick using their .iso and dd. It's a 16Gb drive, and the 
.iso was 3.9Gb. I now have the problem that I can only format 3.9Gb of 
the drive.


I'm on Debian 10.2 with KDE. GNOME Disks utility recognizes the device 
as "16 Gb Thumb Drive / Sandisk Cruzer Glide," and it shows three 
partitions: a 2Gb ISO9660 for Mint, a 2.5Mb FAT, and 14Gb free space. It 
also shows partitioning as "Master boot record." But when I press "-" on 
the Mint partition I get the following error:


"Error deleting partition /dev/sdc1: Failed to read partition table on 
device '/dev/sdc/ (/dev/sdc: unrecognised disk label) 
(udisks-error-quark, 0)"


When I try to format the free space, I get this error:

"Don't know how to create partitions this partition table of type 
'(null)' (udisks-error-quark, 0)"


Originally I got an error from GNOME Disks that the device had no 
partition table. I tried the KDE partition editor to no avail. That app 
made a new MS-DOS partition table for the device, but it believed it was 
only 3.9G. Making that partition table has not changed the results in 
Disks, other than to change it from the no partition table error to the 
unrecognized disk label error.


Can anyone offer any help?

Thanks,
jon