HoboHaxor
Posts: 8
Joined: Fri May 25, 2018 5:58 pm

cloning images

Fri May 25, 2018 6:14 pm

I figured this is more a noob Q
But I have a small army of Pis, and once I get a Pi the way I like it, I typically just dd it back to an image file on my Mac.
Problem is they are *huge* Full 16/32GB of the SD card.
So my overall Q is:
Can I just copy/rsync the rootfs partition? ie:
dd the original (small) raspbian image to a new SD, then mount and copy over from a folder on my Mac that has all the files from my set up? (My Mac can read/write extfs partitions just fine.)

I guess more to the point, is the rootfs delicate? Like it needs certain files in a specific location? Or is all that (un)happiness in the boot partition?

(A real longshot, we can't PXE boot these, can we?)

TIA,
HH

jerrm
Posts: 202
Joined: Wed May 02, 2018 7:35 pm

Re: cloning images

Fri May 25, 2018 7:32 pm

For the Pi's where I want to keep a complete image backup for quick restore purposes I create a full baseline image stored on an NFS share acting as the backup server. To save space image can be a sparse file and/or stored file system that supports compression or de-duplication (zfs/btrfs/etc).

For daily/weekly/whatever backups I mount the image from the Pi over NFS and rsync the Pi to mounted image.

The backup server then uses zbackup to backup the image file(s) daily. Zbackup only stores changed blocks, so the daily delta is small.

This gives a fully updated, working image ready to mount or burn quickly. If I need to go further back, I can restore any prior daily image from zbackup.

EDIT: Also, yes, Pi's can be booted over the net, but I have not done so. See https://www.raspberrypi.org/documentati ... /README.md and search the forums.

User avatar
procount
Posts: 2211
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: cloning images

Fri May 25, 2018 7:35 pm

HoboHaxor wrote:
Fri May 25, 2018 6:14 pm
Can I just copy/rsync the rootfs partition? ie:
Yes. See if this thread helps ->viewtopic.php?f=28&t=214280

No, the rootfs is not delicate. It does not require files in specific places of the disk (nor does the boot partition). Just be sure you copy hidden files, preserve symlinks, attributes and ownership, which most copy tools will (like rsync or tar).

AIUI, Yes you can PXE boot a RPi. but I've never done it. Older models may need an SD card with bootcode.bin on it. Newer models can do it without. Search the forum for PXE.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

gkaiseril
Posts: 679
Joined: Mon Aug 08, 2016 9:27 pm
Location: Chicago, IL

Re: cloning images

Fri May 25, 2018 9:09 pm

You can use the desktop's SC Copy feature but you will need some way to change IP addresses, and network device name. This should be possible with some scripting or as part of the config.txt.

Using the SD Copier will automatically resize the OS being copied on the fly. Within the config.txt file, you can conditionally set variables or parameters based on the serial number of the Raspberry Pi card.
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

LTolledo
Posts: 3409
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: cloning images

Fri May 25, 2018 11:09 pm

HoboHaxor wrote:
Fri May 25, 2018 6:14 pm
I figured this is more a noob Q
But I have a small army of Pis, and once I get a Pi the way I like it, I typically just dd it back to an image file on my Mac.
Problem is they are *huge* Full 16/32GB of the SD card.
So you've got the same problem that I have...and still looking for viable "simple solution", hence the topic I opened up ( link provided here by procount)
procount wrote: Yes. See if this thread helps ->viewtopic.php?f=28&t=214280
At the moment a viable solution am looking at using rsync command to copy over the contents of the source's /boot (fat32 partition) and / (rootfs ext4 partition) to a temporary directory in a target drive, then tar/zip/lzh/rar that directory.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

HoboHaxor
Posts: 8
Joined: Fri May 25, 2018 5:58 pm

Re: cloning images

Sat May 26, 2018 11:00 am

Thanks guys!
Gave me a bunch to looking into and check out. (especially the network boot)
But I think I can get away with, for the time being, just snagging the /etc /root /home and a single apt-get line (for the extra apps)

Return to “Beginners”