Keith via plug on 1 Feb 2021 07:45:13 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Missing Space on USB Disk / Reset to fully clean?


On 1/31/21 10:19 AM, Jon Wolfe via plug wrote:
This probably doesn't help, but I thought I'd mention this.

When you download a CD/DVD image and copy this to a USB stick using DD, AFAIK it doesn't have a partition table. It is CD ISO-9660 format and it uses whatever system is used on a CD.

So a modern BIOS recognizes that even though it is a USB stick which normally should have a partition table, this stick is an exception and it can be treated as a CD.

This would be different if you use one of these special programs for writing USB sticks such as LinuxLoader. These programs write a real partition table with a small CD boot loader in the first partition.

Best wishes,
Jon Wolfe

+1

Jon is understating his point.  It is important to keep in that an .iso, just like an .img or other filesystem-in-a-file thingy should be treated like a binary object.  That means you should not implement any special handling of it, i.e. the concept of a blocksize does not apply.

Most times you will not get you into any real trouble specifying a block size since alignment issues (think 512e vs 4kn hard drives) are handled properly by the kernel by padding things appropriately.  Thus playing block sizes while writing data generally just effects the speed / throughput of the process.

That said, I've had seen issue with usb drives in years past when people put .iso's on then.  Its usually a bios issue as other have said but if you want to factor out burn in issues, I would recommend using either cat or pv.  So for example...

cat distro.iso > /dev/sdd

or

pv < distro.iso > /dev/sdd

would both work and not be subject to any alignment interpretation by the tool.  The kernel will just do what it needs to do to write the data to the device.  I tend to use pv since you get a progress meter.

Additionally, I sometimes have had to issue a "sync" to make sure all the data is written out since when you have alignment issues it appears some data can get "stuck" when you are working with raw devices.  Normally when you umount file systems everything is flushed but when you are pushing a block of data to a device it is possible that system fsync doesn't happen quick enough or the system is expecting more data.  Chances are you'll only see this problem on a very busy system but it is something to be aware of.


On 1/31/21 3:16 PM, prushik--- via plug wrote:
I can't twll you exactly whats happening there, but I can probably clarify some things. Your dd command should overwrite the whole disk, that includes the partition table, so anything you do with gdisk or cfdisk or anything prior to this command will have no effect whatsoever as it all gets overwritten.
I suspect that your short write issue is caused by a loose connection in that usb port, when you get the issue, I suggest checking dmesg to see if there are any usb related errors around the time of your short write.
on a side note, are you sure your iso file is a gpt disk inage? iso is supposed to be the extension for iso cdrom images, not regular disk images. I have seen others using the iso extension in this way and I have seen it cause confusion before, ultimately the extension doesn't matter, but it can and does confuse us humans.

On January 31, 2021 7:42:55 AM EST, Casey Bralla via plug <plug@lists.phillylinux.org> wrote:

This has been a recurring problem from me.  I've been able to work around it by mucking around randomly enough times until I fix it (somehow!), but despite my above-average physical attractiveness, I don't understand what is happening.   I hope somebody can help me figure this out.


Sometimes when I try to create a bootable USB disk to try out a new distro, the process fails.

I always use this command to create the bootable USB disk:

dd if=distro.iso of=/dev/sdd bs=4M

But occasionally this disk won't boot so I try to repeat the command.   In about 5% of the times when I repeat the command I'll get an error message like:

dd: error writing '/dev/sdd': No space left on device
3+0 records in
2+0 records out

Using cfdisk to look at the partition table shows that my 4 GByte USB disk now has only 9 MBytes!  Somebody stole my disk space!

I've tried using gdisk with the "z" command to zap the partition table, and I think it has worked sometimes, but it didn't work for me this morning.

I've also tried using dd to write all zeros to the disk, with the same result.


GPT disks are still confusing to me.   I'm assuming the USB disk has allocated space for GPT tables and the like, but I'm bumfuzzled.   Can anybody explain this, or tell me how I can completely reset a USB disk?


TIA!


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
-- 
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Keith C. Perry, MS E.E.
Managing Member, DAO Technologies LLC
(O) +1.215.525.4165 x2033
(M) +1.215.432.5167
www.daotechnologies.com
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug