Page 1 of 1

Fromatting SD card

Posted: Mon Mar 23, 2020 5:12 pm
by gbar
Hi,

I'm struglling to format a 16 GB SD card previously used in a raspberry pi.

$ geom disk list
Geom name: da0
Providers:
1. Name: da0
Mediasize: 15931539456 (15G)
Sectorsize: 512
Mode: r1w1e3
descr: Mass Storage Device

$ gpart destroy -F da0
gpart: Device busy

It returns to the command prompt and doesn't do anything?

what am i doing wrong?
ta

Re: Fromatting SD card

Posted: Tue Mar 24, 2020 3:54 pm
by aschiebe
have you checked if the device has been auto mounted?

Re: Fromatting SD card

Posted: Tue Mar 24, 2020 4:04 pm
by gbar
Hi,

No i don't think so, see screen shot

Re: Fromatting SD card

Posted: Tue Mar 24, 2020 4:10 pm
by aschiebe
man gpart destroy shows me this, so try first gpart delete afterwards try gpart destroy

Deleting Partitions and Destroying the Partitioning Scheme
If a Device busy error is shown when trying to destroy a partition table,
remember that all of the partitions must be deleted first with the delete
action. In this example, da0 has three partitions:

/sbin/gpart delete -i 3 da0
/sbin/gpart delete -i 2 da0
/sbin/gpart delete -i 1 da0
/sbin/gpart destroy da0

Rather than deleting each partition and then destroying the partitioning
scheme, the -F option can be given with destroy to delete all of the
partitions before destroying the partitioning scheme. This is equivalent
to the previous example:

/sbin/gpart destroy -F da0

Re: Fromatting SD card

Posted: Tue Mar 24, 2020 4:40 pm
by gbar
Thanks for your help.

So, i'm getting this -
fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=1936 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=1936 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 12 (0x0c),(DOS or Windows 95 with 32 bit FAT (LBA))
start 8192, size 114688 (56 Meg), flag 0
beg: cyl 0/ head 130/ sector 3;
end: cyl 7/ head 165/ sector 30
The data for partition 2 is:
sysid 131 (0x83),(Linux native)
start 122880, size 30993408 (15133 Meg), flag 0
beg: cyl 896/ head 0/ sector 1;
end: cyl 815/ head 3/ sector 16
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

I can delete as follows -

/sbin/gpart delete -i 2 da0
da0s2 deleted

but not partition 1-

/sbin/gpart delete -i 1 da0
gpart: Device busy

gpart show da0
=> 63 31116225 da0 MBR (15G)
63 8129 - free - (4.0M)
8192 114688 1 fat32lba (56M)
122880 30993408 - free - (15G)

Re: Fromatting SD card

Posted: Tue Mar 24, 2020 5:41 pm
by aschiebe
stupid question, the sd card is not physical locked?

Re: Fromatting SD card

Posted: Tue Mar 24, 2020 8:23 pm
by Vermilion
it must be:

gpart destroy -F /dev/da0

did you type it exactly like this?

Re: Fromatting SD card

Posted: Fri Mar 27, 2020 3:53 pm
by gbar
Hi,
There is no physical lock, it's a microSD card, haven't seen that on anything other than full size SD but thanks.
Nope, no luck with gpart destroy -F /dev/da0. Even tried copy and past -
gpart destroy -F /dev/da0
gpart: Device busy

Re: Fromatting SD card

Posted: Sat Apr 04, 2020 2:48 pm
by gbar
So........i gave up and formatted it on a Macbook like the quitter i am

Next daft question........ Why can't i compile C++ code?

trying the very simple-
g++ Hello.cpp
brings up all manner of ###?