Fromatting SD card

Post your general questions or comments about GhostBSD here!
Post Reply
gbar
Posts: 32
Joined: Wed Apr 05, 2017 12:30 pm
Has thanked: 2 times
Been thanked: 0

Fromatting SD card

Post by gbar » Mon Mar 23, 2020 5:12 pm

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

aschiebe
Posts: 6
Joined: Sat Mar 14, 2020 4:04 pm
Has thanked: 0
Been thanked: 2 times

Re: Fromatting SD card

Post by aschiebe » Tue Mar 24, 2020 3:54 pm

have you checked if the device has been auto mounted?
These users thanked the author aschiebe for the post:
gbar (Fri Mar 27, 2020 3:53 pm)
Rating: 50%

gbar
Posts: 32
Joined: Wed Apr 05, 2017 12:30 pm
Has thanked: 2 times
Been thanked: 0

Re: Fromatting SD card

Post by gbar » Tue Mar 24, 2020 4:04 pm

Hi,

No i don't think so, see screen shot
Attachments
Screenshot at 2020-03-24 19-03-50.png
Screenshot at 2020-03-24 19-03-50.png (13.46 KiB) Viewed 96 times

aschiebe
Posts: 6
Joined: Sat Mar 14, 2020 4:04 pm
Has thanked: 0
Been thanked: 2 times

Re: Fromatting SD card

Post by aschiebe » Tue Mar 24, 2020 4:10 pm

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
These users thanked the author aschiebe for the post:
gbar (Fri Mar 27, 2020 3:53 pm)
Rating: 50%

gbar
Posts: 32
Joined: Wed Apr 05, 2017 12:30 pm
Has thanked: 2 times
Been thanked: 0

Re: Fromatting SD card

Post by gbar » Tue Mar 24, 2020 4:40 pm

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)

aschiebe
Posts: 6
Joined: Sat Mar 14, 2020 4:04 pm
Has thanked: 0
Been thanked: 2 times

Re: Fromatting SD card

Post by aschiebe » Tue Mar 24, 2020 5:41 pm

stupid question, the sd card is not physical locked?

Vermilion
Posts: 26
Joined: Sat Jan 18, 2020 5:52 am
Has thanked: 2 times
Been thanked: 3 times

Re: Fromatting SD card

Post by Vermilion » Tue Mar 24, 2020 8:23 pm

it must be:

gpart destroy -F /dev/da0

did you type it exactly like this?

gbar
Posts: 32
Joined: Wed Apr 05, 2017 12:30 pm
Has thanked: 2 times
Been thanked: 0

Re: Fromatting SD card

Post by gbar » Fri Mar 27, 2020 3:53 pm

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

Post Reply