gandar
Posts: 215
Joined: Sat Feb 01, 2014 5:45 pm

Cloning different sized SD cards? problems?

Wed Feb 12, 2014 2:59 pm

I am interested in cloning my current SD card to make a backup but don't have an identical SD card. Will size and class differences harm the cloning process?

User avatar
DougieLawson
Posts: 41310
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Cloning different sized SD cards? problems?

Wed Feb 12, 2014 3:09 pm

As long as the one you're cloning to is big enough it's not a problem. There's a couple of scripts available to makes cloned filesystems bigger or smaller.

Search on here for resize filesystem.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Cloning different sized SD cards? problems?

Wed Feb 12, 2014 3:24 pm

The problem is that not all say 4GB cards are the same actual size and if your master is bigger than the slaves then you'll get errors or be unable to do it (depending on method used)

AFAIK the only certain way to avoid problems is to mount the SD Card on a Linux system and reduce the size of the last partition by about 100K for safety and then you should be fine.

For future use - find your smallest card - use that as a master and then you'll be fine whatever you clone it to.

I have a 4GB for this purpose

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

User avatar
DougieLawson
Posts: 41310
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Cloning different sized SD cards? problems?

Wed Feb 12, 2014 4:12 pm

The scripts I know about but can find with my tablet do the resizing. It knocked my 32GB raspbian card down to 5GB.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2876
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Cloning different sized SD cards? problems?

Wed Feb 12, 2014 10:04 pm

DougieLawson wrote:The scripts I know about but can find with my tablet do the resizing. It knocked my 32GB raspbian card down to 5GB.
I use an old laptop with Ubuntu on for backing up and flashing SD card images (using dd)

Once I've copied an SD card onto the HDD I shrink it with a utility called autosizer.sh written by SirLagz. It shrinks the image down to its smallest size for storage and reflashing.

http://sirlagz.net/2013/03/10/script-au ... downsizer/

Then you flash the SD card, then re-expand the partition to fill the card. (I do that in Ubuntu, but you can do it on the Pi too)

autosizer works brilliantly :)
Alex Eames RasPi.TV, RasP.iO

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Cloning different sized SD cards? problems?

Wed Feb 12, 2014 10:06 pm

What do you use to expand back up again?

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2876
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Cloning different sized SD cards? problems?

Wed Feb 12, 2014 10:07 pm

simplesi wrote:What do you use to expand back up again?

Simon
GParted (you may have to install it. Not sure if it's in by default)
Alex Eames RasPi.TV, RasP.iO

User avatar
DougieLawson
Posts: 41310
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Cloning different sized SD cards? problems?

Wed Feb 12, 2014 11:58 pm

DougieLawson wrote:The scripts I know about but can find with my tablet do the resizing. It knocked my 32GB raspbian card down to 5GB.
As promised:
http://www.raspberrypi.org/phpBB3/viewt ... 91&t=58069
http://www.raspberrypi.org/phpBB3/viewt ... 91&t=60918
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Cloning different sized SD cards? problems?

Thu Feb 13, 2014 7:41 am

All good stuff :)

I think the final piece of icing on the cake would be to autorun raspi-config on 1st boot and do the resizing and then reboot again :)

This would be very useful in class situations where a teacher sets up one Pi, clones and shrinks, spends the evening copying the cards - or hands it to technican 30 mins before lesson to do so :) and then hands them out in class and all pupils have to do is plug in and switch on and 2 mins later are up and running with new image :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2876
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Cloning different sized SD cards? problems?

Thu Feb 13, 2014 9:29 am

Others have had different experience, but I've found resizing partitions on the Pi can be horribly slow. That's why I do it in Ubuntu straight after flashing the smaller image onto the card. Was talking to people about this on Saturday at CamJam. Others said they hadn't experienced this, so it may be SD card dependent? Or it may be something which changed with newer Raspbian versions.
(We often assume that our experience is representative of the world, when it may not be.)
Alex Eames RasPi.TV, RasP.iO

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Cloning different sized SD cards? problems?

Thu Feb 13, 2014 10:35 am

You'd thought that just extending the last partition wouldn't take much time - maybe the raspi-config script does more than that

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

User avatar
DougieLawson
Posts: 41310
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Cloning different sized SD cards? problems?

Thu Feb 13, 2014 10:42 am

The raspi-config expand filesystem option simply creates a special script in /etc/init.d that will run parted at the next boot (before the filesystems are mounted as rw). Takes microseconds to create that.

You can edit /usr/bin/raspi-config (it's a shell script) to see what it's doing.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

gandar
Posts: 215
Joined: Sat Feb 01, 2014 5:45 pm

Re: Cloning different sized SD cards? problems?

Sat Feb 15, 2014 3:32 am

Thank you dougie and everyone. Cloned it today without a hitch.

Great discussions. Enjoyed reading and learning.

Return to “General discussion”