@@ -19,7 +19,7 @@ grub can be configured for this to be an officially supported way of
19
19
using rpi-clone.
20
20
21
21
#### Clone by initialization
22
- Source disk mounted partition file system types are compared to
22
+ Source disk mounted partition types are compared to
23
23
corresponding destination disk partitions.
24
24
If the types are not compatible, then the clone is an
25
25
initialization. First, the destination partition structure is
@@ -111,6 +111,7 @@ usage: rpi-clone sdN {-v|--verbose} {-f|--force-initialize}
111
111
{-s|--setup} {-e|--edit-fstab sdX }
112
112
{-m|--mountdir dir } {-l|--leave-sd-usb-boot}
113
113
{-a|--all-sync} {-F|--Force-sync} {-x} {-V|--version}
114
+ {--convert-fstab-to-partuuid}
114
115
115
116
-v - verbose rsync, list all files as they are copied.
116
117
-f - force initialize the destination disk by imaging the booted disk.
@@ -140,6 +141,25 @@ usage: rpi-clone sdN {-v|--verbose} {-f|--force-initialize}
140
141
-s option that has different meaning.
141
142
142
143
## rpi-clone Example Runs
144
+ #### An aside note
145
+ You will see in one example below that the clone command will need
146
+ to be run differently depending on if device names or PARTUUID is used
147
+ in /etc/fstab. If device names are used you will have to add a "-e sdX"
148
+ where sdX will be the "expected" disk name a USB disk is assigned during
149
+ boot. Usually this works, but if you have multiple disk devices plugged
150
+ into USB ports it may not work. While this may not be an issue for you now,
151
+ recent Raspbian releases now use PARTUUID as standard and in the long
152
+ run you may at some point want to convert.
153
+ So as a convenience, if you want to convert to using
154
+ PARTUUID, rpi-clone can do that for you, run:
155
+ ```
156
+ $ sudo rpi-clone --convert-fstab-to-partuuid
157
+ ```
158
+ You only need to ever do this once. Subsequent rpi-clone runs will propagate
159
+ PARTUUID usage to disks that you clone to. This also converts cmdline.txt.
160
+ But get some clone backups before doing this because this changes
161
+ your booted disk.
162
+
143
163
#### 1) First clone to a new SD card in USB card reader
144
164
In this example a new SD card in a USB card reader has been plugged in
145
165
that I want to clone to. It shows up as sdb because I have another USB
@@ -313,7 +333,44 @@ likely has the SD card /boot partition mounted, the SD card is in use
313
333
and using rpi-clone for a clone back to the SD card slot will not work.
314
334
315
335
316
- #### 6) Creating a Pi3 bootable USB hard drive with extra partitions
336
+ #### 6) Clone to smaller 4GB SD card
337
+ I happen to have an old 4GB SD card and here's a try to clone to it:
338
+ ```
339
+ root@rpi2: ~$ rpi-clone sda
340
+
341
+ Booted disk: mmcblk0 15.8GB Destination disk: sda 4.0GB
342
+ ---------------------------------------------------------------------------
343
+ Part Size FS Label Part Size FS Label
344
+ 1 /boot 58.4MB fat16 -- 1 58.4MB fat16 --
345
+ 2 root 15.8GB ext4 SD-RPI-16N 2 3.9GB ext4 --
346
+ ---------------------------------------------------------------------------
347
+ == SYNC mmcblk0 file systems to sda ==
348
+ /boot (22.5MB used) : SYNC to sda1 (58.4MB size)
349
+ / (5.9GB used) : SYNC to sda2 (3.9GB size)
350
+ ---------------------------------------------------------------------------
351
+ Run setup script : no
352
+ Verbose mode : no
353
+ -----------------------:
354
+ ** FATAL ** : Partition 2: source used > destination space.
355
+ -----------------------:
356
+
357
+ Aborting!
358
+ Use -F to override used > space fail.
359
+
360
+ ```
361
+ So even if rpi-clone thinks that the sync won't work because of lack of
362
+ space, there is a -F option which will allow the clone to proceed
363
+ anyway. The interesting thing about this case is that while this might
364
+ seem a bad idea, the sync will actually come close to succeeding. That's
365
+ because the root used space includes a 1.8GB file system based
366
+ swap file (/var/swap) that will be excluded from the sync. If this
367
+ clone is forced with -F, the card may boot, but there could be some missing
368
+ files if the rsync runs out of space and fails to complete and some things
369
+ would not work.
370
+ This is just a FYI.
371
+
372
+
373
+ #### 7) Creating a Pi3 bootable USB hard drive with extra partitions
317
374
I wanted to have a Pi3 hard drive USB boot with extra data partitions
318
375
and I want to be able to clone back to 2 partition SD cards for use
319
376
in other SD card booted Pis. So when I initially clone to the hard drive
@@ -370,10 +427,10 @@ and powered back on into a hard drive boot. I had previously boot
370
427
enabled the Pi3.
371
428
372
429
## Cloning from a USB booted Pi with extra partitions
373
- Now I have booted the USB hard drive I cloned to in example 6 and will
430
+ Now I have booted the USB hard drive I cloned to in example 7 and will
374
431
try a few clones.
375
432
376
- #### 7 ) USB disk routine clone to 16GB SD card
433
+ #### 8 ) USB disk routine clone to 16GB SD card
377
434
For this case I haven't mounted any of the extra partitions and
378
435
the Pi has only the /boot partition mounted. The kernel has seen my hard
379
436
drive as sdb but I'm using PARTUUID in fstab so there's no problem.
@@ -402,7 +459,7 @@ Verbose mode : no
402
459
Ok to proceed with the clone? (yes/no):
403
460
```
404
461
405
- #### 8 ) USB disk with mounted partition 5 clone to 16GB SD card
462
+ #### 9 ) USB disk with mounted partition 5 clone to 16GB SD card
406
463
Now I try the clone with one of my extra partitions mounted:
407
464
```
408
465
pi@rpi0: ~$ sudo rpi-clone sda
@@ -426,7 +483,7 @@ rpi-clone sees the mounted partition 5 and wants to clone it but finds
426
483
there's not enough space on the destination disk and won't let me.
427
484
A bigger disk is needed to clone all the way through partition 5.
428
485
429
- #### 9 ) USB disk with mounted partition 5 clone to 16GB SD card try 2
486
+ #### 10 ) USB disk with mounted partition 5 clone to 16GB SD card try 2
430
487
I've got things I'm working on and don't want to unmount the partition
431
488
to make the clone work, so I use the -m option to tell rpi-clone to
432
489
only clone root and /boot and exclude any other directory mounts not given
0 commit comments