Author Topic: Linux: Trying to Reformat Memory Card  (Read 940 times)

Linux: Trying to Reformat Memory Card
« on: 19 December, 2020, 04:11:23 pm »
The ultimate aim of this is to prepare a clean blank storage medium (micro SD card) in order to make available two small pieces of firmware at a specific stage of an installation of Debian.

The installation program states:
Code: [Select]
Some of your hardware needs non-free firmware files to operate.  The firmware can be loaded from removable media, such as a usb stick or floppy.

The missing firmware files are: ess/maestro3_assp_kernel.fw

If you have such media available now, insert it, and continue.

Load missing firmware from removable media?

<Yes>                                                                         <No>


The above refers to the first piece of firmware; the other piece of firmware is:  maestro3_assp_minisrc.fw

Turning to the media I am trying to re-format, I fit the micro SD card into a usb card reader/adapter, and it will automatically mount on my other Debian machine, and lsusb picks it up:

Code: [Select]
root@esprimodebian:/home/martin# lsusb
Bus 007 Device 008: ID 0bda:0326 Realtek Semiconductor Corp. Card reader
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 03f0:1024 HP, Inc Smart Card Keyboard
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:c408 Logitech, Inc. Marble Mouse (4-button)
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

The command fdisk -l gives

Code: [Select]
[...]

Disk /dev/sdb: 14.9 GiB, 15931539456 bytes, 31116288 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: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1        8192 31116287 31108096 14.9G  c W95 FAT32 (LBA)

When I run the command mount, the relevant part of the output shows:

Code: [Select]
/dev/sdb1 on /media/martin/3862-3763 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

In order to remake the partition using the parted program, or to then format it with the mkfs utility, I understand I need to unmount the drive.  When I try to do this using the umount command, the output is:

[code
umount: /dev/sdb: not mounted
[/code]

In order to check mkfs, I issue the command mkfs.ext3 /dev/sdb1, but get the output:

Code: [Select]
mke2fs 1.43.4 (31-Jan-2017)
/dev/sdb1 contains a vfat file system
Proceed anyway? (y,N) y
/dev/sdb1 is mounted; will not make a filesystem here!

So the system appears to be regarding the card as both mounted and unmounted, which leaves things blocked!

I had already tried copying the two firmware files to the card as it is currently, then offering this to the installation program, but it fails to pick them up, which is why I thought about completely refreshing it first, but this is where I am stuck.

Maybe I will just have to acquire a new card.




Kim

  • Timelord
    • Fediverse
Re: Linux: Trying to Reformat Memory Card
« Reply #1 on: 19 December, 2020, 04:37:29 pm »
Are you unmounting /dev/sdb (the disk) or /dev/sdb1 (the partition)?

vorsprung

  • Opposites Attract
    • Audaxing
Re: Linux: Trying to Reformat Memory Card
« Reply #2 on: 19 December, 2020, 05:26:37 pm »
what the kim sez

umount /dev/sdb1 as root then mkfs.ext3 /dev/sdb1 won't fail for the reason shown

Re: Linux: Trying to Reformat Memory Card
« Reply #3 on: 19 December, 2020, 10:04:56 pm »
I already know to obey what de kim sez.
I will do that and try again...

Re: Linux: Trying to Reformat Memory Card
« Reply #4 on: 19 December, 2020, 10:07:54 pm »
Just make sure you don't have some annoying piece of shit like udisks enabled which tries to automount such drives.

I had a bit of a fight against it a while back whilst trying to do something similar. I'd stick in the memory card and it'd automount it, so I'd unmount and the bloody thing would automount it again before I could start to blat it.

(There are ways you can tell udisks to fuck off, I can't remember the right incantation right now, I tend to use a variant of "kill -9" but that's not very friendly [and something is usually there to restart the daemon anyway].)
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Linux: Trying to Reformat Memory Card
« Reply #5 on: 23 December, 2020, 05:36:38 pm »
Thanks all.

Got there in the end. ::-)