[Bradford] Formatting micro SD for Raspberry Pi

Moanin moanin at mikegoodman.uk
Tue Mar 16 21:04:17 UTC 2021


Hi David,

Thanks for the posthumous post. ;-) I read that earlier, having already 
done it. Then I felt a bit glum, cheering up a bit after realising it 
was the old card, not the new one. And you are correct, simply writing 
over with the os image works perfectly well. I've taken notes.

Re your reply on my other thread, recovering the nvidia mods and then 
disabling nvidia, all the commands from those changes are now noted down 
and I'll come back to you once I have time to go through them and sort 
it out a bit more.

Thanks,

Mike

On 16/03/2021 20:54, David Spencer wrote:
> Hi folks
> 
> It is a *terrible* *terrible* *terrible* idea to "clean" SD cards in
> this way. They have a limited number of write cycles. You're just
> destroying the card for no benefit. Same goes for any other flash
> based tech -- old USBs, eMMC, ssd, nvme.
> 
> If you have a used SD card and you want a complete re-do, start with
> dd'ing the os image again. Pre-zeroing the whole thing with dd before
> that is simply using up all the write cycles for nothing and likely to
> end in an unusable card.
> 
> Cheers
> -D.
> 
> On Tue, 16 Mar 2021 at 17:09, Moanin via Bradford
> <bradford at mailman.lug.org.uk> wrote:
>>
>> Hi Folks,
>>
>> Seems it's all done, using dd on the command line. The only mistake was
>> neglecting to add an empty ssh file in the boot partition so "access
>> denied" errors ensued 'til I managed to work it out. The info was tucked
>> away in a "locked" corner of the forum.
>>
>> Just as importantly, the whole micro sd card is usable. There are 29
>> gigs instead of 4.
>>
>> Raspberry OS is Debian. I don't like having sudo by default. It allows
>> any intruder to test it out. Far better to have shell only access for a
>> user and force use of su with a strong password for root.
>>
>> Still, I can sort that out later. It's just great to have a minimal
>> install of any distro and space to work in. Now to enable wireless and
>> move it from its precarious position on the windowsill!
>>
>> Thanks for all the help and ideas, including those off-list.
>>
>> Cheers,
>>
>> Mike
>>
>>
>> On 16/03/2021 12:11, Bernard Czenkusz via Bradford wrote:
>>> Hi guys
>>>
>>> For what its worth:
>>>
>>> With Linux Mint I used the  graphical 'Disks' option, with menu
>>> description 'Manage Drives and Media' - then within the application I
>>> highlighted the (unmounted) card and from the utilities hamburger menu
>>> chose the 'Restore Disk Image..'  option, chose the image file, and it
>>> loaded the image. From memory, I don't think there was any need to
>>> format.
>>>
>>> I find the 'Disks' menu calls the command "gnome-disks" which is
>>> widely available, you may already have it. Though its only applicable
>>> if you're using a graphical desktop.
>>>
>>> Cheers
>>>
>>>   Bernard
>>>
>>>
>>> On 15/03/2021 22:50, Moanin via Bradford wrote:
>>>> Hi John,
>>>>
>>>> That's got me perplexed! Is the 32768 the bs=1M multiple? Each time
>>>> an SD card is formatted it loses some space. These two are now down
>>>> to 29.??gb (the older one) and 31.?? (the new one). Which raises the
>>>> question: do we need to stipulate the size, or, as I suspect, isn't
>>>> it just as good to let whichever utility supply a default, which
>>>> should be the end of the disc?
>>>>
>>>> Alternatively, is 32768 the number of blocks in a section? That
>>>> amounts to 4gb and is the size of the sections which were causing the
>>>> problems earlier.
>>>>
>>>> Or does 32768 simply state a maximum limit for the dd command?
>>>>
>>>> The original dd command was:
>>>>
>>>> dd if=/dev/zero of=/dev/sdb bs=1M status=progress
>>>> which gave me a constant update of, well, progress.
>>>>
>>>> Now this has popped up in the browser (well I did do a search):
>>>> https://www.iottechtrends.com/format-sd-card-for-raspberry-pi/
>>>> the implication of which appears to be that the dd command for
>>>> installing the image will implement the partitioning, too.
>>>>
>>>> That looks attractive, in part because of its simplicity. It also
>>>> shows me that I neglected to unmount the card before formatting it
>>>> during the earlier efforts.
>>>>
>>>> But will it work? It implies using dd for the whole process.
>>>>
>>>> TIA,
>>>>
>>>> Mike
>>>>
>>>> On 15/03/2021 22:02, John Robert Hudson wrote:
>>>>> Hi Mike
>>>>>
>>>>>
>>>>> With a 32GB card you should be using something like:
>>>>>
>>>>>
>>>>> dd if=/dev/zero of=/dev/sdb bs=1M count=32768
>>>>>
>>>>>
>>>>> The DOS partition is presumably for /boot/efi and the Ext4
>>>>> partitions for / and /home - no swap?
>>>>>
>>>>>
>>>>> I would use Gparted for that.
>>>>>
>>>>>
>>>>> John
>>>>>
>>>>>
>>>>> On Monday, 15 March 2021 21:08:44 GMT Moanin via Bradford wrote:
>>>>>
>>>>>   > Evenin' All,
>>>>>
>>>>>   >
>>>>>
>>>>>   > I have two 32gb micro SD cards, the second because the first one
>>>>>
>>>>>   > appeared to be corrupted. Once loaded with an OS, there were
>>>>> loads of
>>>>>
>>>>>   > 4gb sectors at the beginning and the OS update in the Pi showed not
>>>>>
>>>>>   > enough space left on the card. It needed a few more mb on the
>>>>> partition.
>>>>>
>>>>>   > But it wasn't the card. This has repeated itself with each
>>>>> attempt to
>>>>>
>>>>>   > fix matters.
>>>>>
>>>>>   >
>>>>>
>>>>>   > Wiping the cards then checking with either lsblk or fdisk -l
>>>>> showed them
>>>>>
>>>>>   > as clean. So the formatting process came under suspicion and I
>>>>> was extra
>>>>>
>>>>>   > careful when formatting them. So the OS transfer (using dd)
>>>>> became the
>>>>>
>>>>>   > main suspect.
>>>>>
>>>>>   >
>>>>>
>>>>>   > They wee cleaned using the command "dd if=/dev/zero of=/dev/sdb
>>>>> bs=8192"
>>>>>
>>>>>   > (earlier attempts were with bs=1M) and everything shows as 512 bytes
>>>>>
>>>>>   > from fdisk -l /dev/sdb. The result has not changed with the
>>>>> altering of
>>>>>
>>>>>   > the bs size parameter. It looks OK to me. Is it correct? As we
>>>>> would expect?
>>>>>
>>>>>   >
>>>>>
>>>>>   > All of the above was using a CentOS 7 for Pi download but it may be
>>>>>
>>>>>   > corrupted (the cause) and no Pi version is available any more. So
>>>>>
>>>>>   > Raspberry Pi OS (Raspbian has been renamed, still Debian based)
>>>>> is about
>>>>>
>>>>>   > to be downloaded.
>>>>>
>>>>>   >
>>>>>
>>>>>   > Here's the question: what is the best format structure for one of
>>>>> these
>>>>>
>>>>>   > micro SDs prior to installing it? I really don't want to end up
>>>>> going
>>>>>
>>>>>   > round in more frustrating and time consuming circles.
>>>>>
>>>>>   >
>>>>>
>>>>>   > The various online docs show a dos partition table with a 512M ext4
>>>>>
>>>>>   > primary partition and another ext4 primary partition for the
>>>>> remainder
>>>>>
>>>>>   > of the card. I've been using fdisk to do the formatting. Would
>>>>> Parted do
>>>>>
>>>>>   > a better job, or stick with fdisk?
>>>>>
>>>>>   >
>>>>>
>>>>>   > If fdisk and dos table, is it safe to just hit o (create a new
>>>>> empty dos
>>>>>
>>>>>   > partition table) to begin with?
>>>>>
>>>>>   >
>>>>>
>>>>>   > TIA,
>>>>>
>>>>>   >
>>>>>
>>>>>   > Mike
>>>>>
>>>>>   >
>>>>>
>>>>>   > --
>>>>>
>>>>>   > Bradford mailing list
>>>>>
>>>>>   > Bradford at mailman.lug.org.uk
>>>>>
>>>>>   > https://mailman.lug.org.uk/mailman/listinfo/bradford
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>> --
>> Bradford mailing list
>> Bradford at mailman.lug.org.uk
>> https://mailman.lug.org.uk/mailman/listinfo/bradford



More information about the Bradford mailing list