16vmonkey
Posts: 4
Joined: Wed Jun 13, 2012 12:54 pm

Move to smaller SD card...

Mon Jul 16, 2012 9:51 am

Hi all,

I've got my Pi working great as a Kiosk for a client and i'm using a 16gb SD card. I need to move to a smaller SD card but Win32 Disk Imager creates a 16gb file when reading from the SD as an image - obviously too big to fit on a smaller card like a 4gb.

How can I move from larger to smaller SD??

Mike.
Last edited by 16vmonkey on Mon Jul 16, 2012 9:59 am, edited 1 time in total.

recantha
Posts: 209
Joined: Mon Jun 25, 2012 10:41 am

Re: Move top smaller SD card...

Mon Jul 16, 2012 9:55 am

The way I sort this kind of thing is:
* Use a Windows machine
* Boot up using the Live CD/USB from gparted.
* This gives you a Linux environment with the re-partitioning tool installed
* Use gparted to move/resize the partitions.

Take a look at:
http://www.raspberrypi-spy.co.uk/2012/0 ... artitions/

I think that link is for expanding a partition, but should be fairly similar to shrink.
HOWEVER, make sure you back up your 16GB first just in case it doesn't work.
You may have problems going from 16GB to 4GB. Give it a try.
My Raspberry Pi blog with all my latest projects and links to articles
http://raspberrypipod.blogspot.com. +++ Current project: PiPodTricorder - lots of sensors, lots of mini-displays, breadboarding, bit of programming.

dukla2000
Posts: 190
Joined: Tue Jan 10, 2012 12:02 am
Location: Reading.UK.EU

Re: Move to smaller SD card...

Mon Jul 16, 2012 9:57 pm

Think it is much easier if you have a linux machine, but a Live CD will do. I have been cloning my install to a variety of SD cards for benchmarking and am pretty much in a groove as follows:
Take new SD card - usually formatted as 1 DOS partition
Use fdisk to check the start sector (on the assumption the manufacturer aligns the partition with erase block sizes) - has been 8192 sectors for 8GB Sandisk cards)
Use YaST (the main toolbox utility that comes with my SuSE desktop linux) to shrink the 1st partition to about 50MB
Back to fdisk to create second partition with start sector on an erase block boundary (all of this cribbed from Terje's blog!)
Format the new partition
Copy the DOS partition from old card to new card - can be done on any machine
In linux mount both old and new cards - check in /media what they are called but for this example assume they are newcard and oldcard
The magic copy command is
rsync -axvS /media/oldcard /media/newcard

Yup I don't bother formatting a swap partition. I do add a swapfile once the card is running and can be done on the Pi itself, all done as root
dd if=dev/zero of=/swapfile bs=1024 count=262144
creates a 256MB file
mkswap /swapfile
chown root:root /swapfile
chmod 0600 /swapfile
swapon /swapfile
edit /etc/fstab so the swap line looks like
/swapfile none swap sw 0 0
Daily driver: Pi3B, 64GB Samsung Evo+ @100MHz, DVB-T, onboard WiFi for internet, BT/USB dongle for KB/mouse, 250GB HDD via USB for media, Raspbian Jessie Lite with Openbox desktop.
Museum: Pi B

roblegge
Posts: 14
Joined: Tue Aug 28, 2012 12:20 pm

Re: Move to smaller SD card...

Wed Oct 03, 2012 9:13 am

Unfortunately there's a problem here. Running a Terminal session in Ubuntu, the device partitions are shown as /media/<guid1> and /media/<guid2>. using rsync -avxS as suggested results in a folder being created in the target partition and all the files being created in that.

All sensible suggestions welcome :-)

User avatar
RaTTuS
Posts: 10415
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Move to smaller SD card...

Wed Oct 03, 2012 9:17 am

you probably have to make
/media/oldcard
to be
/media/oldcard/

IIRC
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

roblegge
Posts: 14
Joined: Tue Aug 28, 2012 12:20 pm

Re: Move to smaller SD card...

Wed Oct 03, 2012 12:30 pm

Thanks Rattus, one typo is all it takes to cause maximum outrage :-)

R

User avatar
RaTTuS
Posts: 10415
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Move to smaller SD card...

Wed Oct 03, 2012 12:33 pm

I know ...
I've done it before with nearly a terrabyte of data from site to site ,,,,
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

Return to “Beginners”