mmkw43
Posts: 696
Joined: Tue Dec 24, 2013 6:18 pm

SD cards -- not enough space -- 8kb?

Mon Dec 07, 2020 9:16 pm

I have a dozen Sandisk class 10 micro sd cards that I had written an image file to that were a python script running with Raspian Jessie. I've been spending way too much time trying to figure out how to make these all 100% empty and formatted just like the day I bought them. It's an embarrassingly basic question but no matter what I do, there's about 8kb that hangs in there and when I try to write a new image (from another 16gb card, I get "not enough space").

Using windows 7,
I have -- (1) deleted all the files (2) run DISKPART and did a clean, create primary partition and format FAT32. Have used both DISKPART and the SD formatter and it always shows about 8kb of used space. When I "list partition" in DISKPART it shows 1 primary partition at around 14 gb. Also -- the source SD card that I created a new image from is the exact same 16gb sandisk type that I'm trying to write to. I'd buy new ones but there still 6 bucks a piece ! -- thanks for any help

User avatar
RaTTuS
Posts: 10741
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: SD cards -- not enough space -- 8kb?

Mon Dec 07, 2020 10:20 pm

put in a usb sdcard reader on teh pi
sudo fdisk /dev/sda #<this may be different]
l
d
w
q


[edit]
aha missed that you where trying to write an image to them - not all sdcard are the same size 16Gb is always an approximate with sdcards
Last edited by RaTTuS on Tue Dec 08, 2020 7:58 am, edited 1 time in total.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
rpdom
Posts: 18130
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: SD cards -- not enough space -- 8kb?

Mon Dec 07, 2020 10:39 pm

There is no need to reformat or clear a card in any way in order to write an image file to it.

If you find that you get "not enough space" when writing an image that was created from one card onto another card, it will be because the cards are different sizes. SD cards vary a lot in capacity. The size (16GB or whatever) is only an approximate figure. Even cards of the same make and model can vary by a few KB in capacity. The space available on the card is what is left over once any faulty areas have been marked as unavailable by the card.

You either need to find a card that has sufficient capacity for the image, or reduce the size of the image somehow.
Unreadable squiggle

HvdW
Posts: 183
Joined: Tue Jun 17, 2014 12:41 pm

Re: SD cards -- not enough space -- 8kb?

Mon Dec 07, 2020 10:45 pm

Agree with @rpdom.
However if you want to format you might consider using SD Card formatter, the 'official' one from SD Association.
Who knows knows
Who doesn't doesn't

User avatar
jahboater
Posts: 6675
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: SD cards -- not enough space -- 8kb?

Mon Dec 07, 2020 11:37 pm

You do not need to format before writing an OS image to the card.
The image contains the entire raw disk, including the partition table.
Therefore any formatting done before the copy is simply overwritten and lost.
Pi4 8GB (Raspberry Pi OS 64-bit), Pi4 4GB, Pi4 2GB, Pi1 Rev 1 256MB, Pi Zero

User avatar
CaptainMidnight
Posts: 192
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: SD cards -- not enough space -- 8kb?

Tue Dec 08, 2020 5:30 am

Hi mmkw43, if you are able to boot a Pi with the original image that you want to copy and mount another memory card in a card reader attached to one of the USB ports - may I suggest using a script like "rpi-clone" via the command prompt / terminal / ssh session.

https://github.com/billw2/rpi-clone

That script will allow you to duplicate the original booted memory card to a new card sitting in the memory card reader attached to the Pi - as long as there is some free space on the original booted memory card (which I'm sure there probably is) rpi-clone will create a duplicate card - it recreates the original memory card partitions (boot and root) and then only copies the data i.e used space.


You could also try using one of RonR's scripts - image-backup, to create a new smaller backup image from the Pi booted with the original memory card. This newly created image file will be smaller than the image file you are having trouble with and will self expand when booted for the first time on a new card.

viewtopic.php?f=29&t=247568

With this 2nd method, you'll have created a smaller image file that will fit on any 16GB memory card. You may need to ask RonR about his script as I know it works on Buster, probably will, but not sure about Jessie - can't see why not.
"Never get out of the boat." Absolutely goddamn right!
Unless you were goin' all the way...

mmkw43
Posts: 696
Joined: Tue Dec 24, 2013 6:18 pm

Re: SD cards -- not enough space -- 8kb?

Tue Dec 08, 2020 3:14 pm

Ok thanks very much. I remember running into problems a few years back but it didn't register -- so I may try to do my original on an 8gb card and then make images on 16. And will definitely try that clone program. Thanks -- problem solved.

ganzgustav22
Posts: 141
Joined: Tue Feb 11, 2020 1:04 pm

Re: SD cards -- not enough space -- 8kb?

Tue Dec 08, 2020 4:26 pm

There is no need to reformat or clear a card in any way in order to write an image file to it.
In theory and under Linux, that's true. But on Windows I also sometimes have the issue that Windows doesn't like my sdcards anymore and Windows image writers don't want to write to it. Not sure why that is. If it happens I just zero it with dd on a Linux machine and after that it works again under Windows.

To overwrite everything on the card with zeros:

Code: Select all

dd if=/dev/zero of=/dev/sdx bs=1M status=progress
(replace /dev/sdx with the correct device file that your memory card is using. BE CAREFUL, if you give this command the device file of your main harddrive or other attached drive, it will overwrite everything)

Return to “General discussion”