calanor
Posts: 27
Joined: Wed Feb 24, 2016 1:30 pm

Copy partitions with rsync?

Thu Sep 27, 2018 9:43 am

Is it possible to copy the boot and root partitions from one raspberry pi to another without copying the entire sd image?

I have a raspberry with 3 partitions and my idea is to empty the boot and root partitions with jessie lite and copy with rsync the boot and root partitions of another sd with stretch lite.
Otherwise, I would have a problem with the space of the partitions.

Source SD:

Code: Select all

Device         Boot    Start       End   Sectors   Size Id Type
/dev/mmcblk0p1       8192    96663    88472 43.2M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      98304 30318591 30220288 14.4G 83 Linux

pi@raspberrypi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  1.3G   13G  10% /
devtmpfs        213M     0  213M   0% /dev
tmpfs           217M     0  217M   0% /dev/shm
tmpfs           217M  5.8M  211M   3% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           217M     0  217M   0% /sys/fs/cgroup
/dev/mmcblk0p1   43M   22M   21M  51% /boot
tmpfs            44M     0   44M   0% /run/user/1000

Target SD:

Code: Select all

Device         Boot    Start       End   Sectors   Size Id Type
/dev/mmcblk0p1          8192    137215    129024    63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2        137216  15548415  15411200   7,4G 83 Linux
/dev/mmcblk0p3      15548416 250085375 234536960 111,9G 83 Linux

pi@radiopi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7,3G  3,0G   4,0G  43% /
devtmpfs        213M     0   213M   0% /dev
tmpfs           218M     0   218M   0% /dev/shm
tmpfs           218M  4,5M   213M   3% /run
tmpfs           5,0M  4,0K   5,0M   1% /run/lock
tmpfs           218M     0   218M   0% /sys/fs/cgroup
/dev/mmcblk0p1   63M   21M    42M  34% /boot
/dev/mmcblk0p3  110G   67G    38G  64% /home/pi/var/media


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

Re: Copy partitions with rsync?

Thu Sep 27, 2018 10:25 am

rsync wont do it stuff proper on vfat partitions however
if you
mount whatever to /mnt/
rsync -vax / /mnt/dst it will only do the one file system
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
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: Copy partitions with rsync?

Thu Sep 27, 2018 10:37 am

I don't know vfat. However rsync SD cards would work.

I did that before with rsync -avx --delete SRC/ DEST

Return to “General discussion”