Web lists-archives.com

Re: libgparted bug.




Hi,

Gene Heskett wrote:
> Th os say its 59.b GB when it mounts the original
> [...]
> gene@coyote:~/rock64.imgs$ dd of=/dev/sdd bs=64k if=working-rock64.img
> dd: writing `/dev/sdd': No space left on device
> 976897+0 records in
> 976896+0 records out

That's the usual confusion between ISO GB (= 1 billion bytes) and programmer's
GiB (1024 * 1024 * 1024 bytes).
dd's "k" are programmer's KiB (= 1024).

976896*64*1024 = 64021856256 = 64.02 ISO GB = 59.63 programmer's GiB.

So it failed when it had already reached the 64 ISO GB limit.
No chance to return the card to the seller for being undersized, i guess.

> So nominally 600k of card disappeared. 

The old card is obviously slightly larger than the new one.


> Obviously I need to restrict dd to about the first 10 gigs as there is 
> not any data beyond that anyway.  So wash, rinse and repeat.
> But I need too, to shrink the file system, and the last partition on the 
> card to low enough I could use a 16GB sdcard as the test tool

You need to do it in a qualified way.
The partition table would be easy as soon as you identified what type
it is: MBR partition table or GPT.

> partition 7 is around 125k bigger than the disk

The task of shrinking a filesystem depends much on its type.
E.g. http://www.microhowto.info/howto/reduce_the_size_of_an_ext2_ext3_or_ext4_filesystem.html
(Disclaimer: I have never done this.)

> Why hasn't such a utility been done?

I guess because most people just buy a bigger medium.


Normally i would advise to copy old partition 7 file by file into a freshly
formatted filesystem in the slightly smaller partition 7 on the new card.
But the bootability might get damaged that way.

You would be lucky if the boot loader on the old card does not refer to
partition 7. I'd flatly give it a try:

- Copy the old card by dd up to the start of partition 7.
  This will most probably copy the oversized partition entry of old
  partition 7.

- So use a partition editor to delete partition 7 on the new card.
  Create an new partition 7 of a size that matches the card size.

- Create a new filesystem in the new partition 7.

- Mount both partitions 7 of old and new card.
  Copy all files from old partition 7 to new one. E.g. by cp -a.

If the new card then does not boot, you have to find out which boot loader
is installed, what it uses on partition 7, and how to re-install it so
that it works properly with new partition 7.


Have a nice day :)

Thomas