After writing image to Raspberry Pi, where did the extra space of the SD card go?

With this command
dd bs=4M if=2015-09-24-raspbian-jessie.img of=/dev/sdd

Open in new window

, I am writing an image ( about 3.28GB to a 8GB SD card. After the writing, I checked the SD card with the Disk Utility on my Mac, I can only see about 3.2GB of space. So, where did the rest of the space go? How can I recover them so that I can use them in the Raspberry Pi Raspian system?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gerwin Jansen, EE MVETopic Advisor Commented:
That will happen during the first boot of your Raspberry, it will reallocate partitions amongst a few other things.
condor888Author Commented:
Yes, I know that. The config GUI will help me to do that. But can some one explain that where the space go? And is it possible to recover it using command line without the GUI? Because I want to know the underlying mechanism. Thanks!
Gerwin Jansen, EE MVETopic Advisor Commented:
I'm assuming it is unpartitioned space, right after the 4M that was written. Think the disk size has been set to 4M and that's why you don't see the other 4M.
condor888Author Commented:
Hi Gerwin, could you take a look at the Screenshot that I posted? Then you can have a better idea what I was talking about. Sorry about the confusion.
condor888Author Commented:
raspberry pi sd card partition I am embedding the picture in this post.
Gerwin Jansen, EE MVETopic Advisor Commented:
I see, can you try from a console:

sudo fdisk /dev/disk2

and post the output?
condor888Author Commented:
Hi @Gerwin, sorry about the late reply. It took me a while to setup the environment. I ran "sudo disk -l" and see the below thing for the SD burned with rpi image in the external card reader. It looks like the "/dev/sda1" and "/dev/sda2" don't take up the whole disk space, which is 8GB. I think they are adding up to the image file size of a little bit more than 3GB. Do you have any comment on that? What is the state of the rest of the disk space? How can I expand the /dev/sda2 via command line without using the GUI tool?
rpi sd
Gerwin Jansen, EE MVETopic Advisor Commented:
Can you run raspi-config ?
It is text based and you select the expand option from the menu.
condor888Author Commented:
Hi Gerwin, as I mentioned before, I know that I could expand it using the raspi-config GUI tool. But how can I do it through the command line? And what is the status of the "missing" space at this point of time? Thanks!
Gerwin Jansen, EE MVETopic Advisor Commented:
What 'do_expand_rootfs' in raspi-config is doing is just delete the 2nd partition and creating a new one, check in /usr/bin/raspi-config (text based tool, no X env needed). You can try the commands manually using parted, first thing you can try is adding a new partition (use: n) - that should show you there is space available.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
condor888Author Commented:
Thanks, but if the 2nd partition is deleted then what about the data on it?
Gerwin Jansen, EE MVETopic Advisor Commented:
Hmm, that would be a rhetorical question, right? This is typically what you do first when setting up an SD card. Note that I didn't 'replay' the commands that are in the 'do_expand_rootfs' procedure but you can do this on an emty SD card if you like.
condor888Author Commented:
Thanks, Gerwin.
Gerwin Jansen, EE MVETopic Advisor Commented:
Just to add for completeness, the Apple disk utility is not showing you the 2nd partition (Linux part type 83), fdisk is showing that, for example this:
host:~ gerwin $ sudo fdisk /dev/disk2
Disk: /dev/disk2	geometry: 1923/255/63 [30898176 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
 1: 0C    0 130   3 -    7 165  30 [      8192 -     114688] Win95 FAT32L
 2: 83  896   0   1 -  479   3  16 [    122880 -   30775296] Linux files*
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused   

Open in new window

16Gb disk
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.