Skip to content

Commit 7087dae

Browse files
committed
Adjusted some error messages and fixed README typos
1 parent 2b4bacd commit 7087dae

File tree

2 files changed

+32
-39
lines changed

2 files changed

+32
-39
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ creating clone backup disks for a desktop.
103103
To get a usage screen showing available options,
104104
run rpi-clone without any arguments:
105105
```
106-
pi@rpi0: $ sudo ./rpi-clone
106+
pi@rpi0: $ sudo rpi-clone
107107
No destination disk given.
108108
109109
usage: rpi-clone sdN {-v|--verbose} {-f|--force-initialize} {-f2}
@@ -155,6 +155,10 @@ names to PARTUUID. This is a helper if you wish to convert to PARTUUID as
155155
is standard in recent Raspbian distributions. After running, PARTUUID
156156
usage will propagate to subsequent clones. This changes the booted fstab
157157
and cmdline.txt, so have a backup first.
158+
+ FUSE mounts (ssh mounts) should be unmounted before cloning or else the
159+
directory mounted on will not stat and the directory will not be made on the
160+
clone. You will get a readlink stat error from rsync because root can't access
161+
a users FUSE mount - only the user can.
158162

159163
## rpi-clone Example Runs
160164
#### 1) First clone to a new SD card in USB card reader
@@ -173,7 +177,7 @@ bootable when plugged in to the SD card slot.
173177
+ If fstab and cmdline.txt use device names (mmcblk0), then no edits are
174178
necessary and the card will be bootable when plugged into a SD card slot.
175179
```
176-
pi@rpi0: $ sudo ./rpi-clone sdb
180+
pi@rpi0: $ sudo rpi-clone sdb
177181
178182
Booted disk: mmcblk0 16.0GB Destination disk: sdb 8.0GB
179183
---------------------------------------------------------------------------
@@ -206,7 +210,7 @@ different destination disk hostname.
206210
+ The setup script will set the hostnames in the destination disk files
207211
/etc/hostname and /etc/hosts to what I give with -s, in this case rpi2.
208212
```
209-
pi@rpi0: $ sudo ./rpi-clone sdb -s rpi2
213+
pi@rpi0: $ sudo rpi-clone sdb -s rpi2
210214
211215
Booted disk: mmcblk0 16.0GB Destination disk: sdb 8.0GB
212216
---------------------------------------------------------------------------
@@ -561,7 +565,7 @@ partition I might use later and an extended partition with two logical
561565
partitions. I run rpi-clone from a SD card boot and it will sync only
562566
the first two partitions:
563567
```
564-
pi@rpi0: $ sudo ./rpi-clone sdc
568+
pi@rpi0: $ sudo rpi-clone sdc
565569
566570
Booted disk: mmcblk0 16.0GB Destination disk: sdc 160.0GB
567571
---------------------------------------------------------------------------

rpi-clone

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
version=2.0.6
3+
version=2.0.7
44

55
# auto run grub-install if grub detected
66
grub_auto=1
@@ -969,8 +969,8 @@ do
969969
done
970970

971971
fs_match=1
972-
root_part_match=1
973-
first_mismatch=""
972+
root_part_match=0
973+
first_part_mismatch=0
974974

975975
initialize=$((force_initialize))
976976

@@ -992,18 +992,13 @@ do
992992
then
993993
tmp_match=1
994994
fi
995+
if ((tmp_match && p == root_part_num))
996+
then
997+
root_part_match=1
998+
fi
995999
if ((!tmp_match)) && ((src_sync_part[p]))
9961000
then
997-
if ((!force_initialize))
998-
then
999-
if ((p <= root_part_num))
1000-
then
1001-
first_mismatch="- types mismatch"
1002-
root_part_match=0
1003-
else
1004-
first_mismatch="$p ${src_mounted_dir[p]} - destination missing"
1005-
fi
1006-
fi
1001+
first_part_mismatch=$p
10071002
fs_match=0
10081003
break
10091004
fi
@@ -1100,28 +1095,22 @@ Use -U for unattended even if initializing.
11001095

11011096
if ((last_part_sectors < 7812))
11021097
then
1103-
if [ "$first_mismatch" != "" ]
1098+
printf "%-22s : %s\n" "** FATAL **" "destination disk is too small."
1099+
readable $((start_sector + 7812)) "512" min_size
1100+
printf "%-22s : %s\n" " " \
1101+
" Minimum destination disk size is $min_size"
1102+
if ((root_part_match && first_part_mismatch > root_part_num))
11041103
then
1105-
printf "%-22s : %s\n" "Initialize required" \
1106-
"partition $first_mismatch."
1107-
if ((root_part_match))
1108-
then
1109-
printf "%-22s : %s\n" " " \
1110-
" Unmount source partitions or use -m"
1111-
else
1112-
readable $((start_sector + 7812)) "512" min_size
1113-
printf "%-22s : %s\n" " " \
1114-
" The minimum destination disk size is $min_size"
1115-
printf "%-22s : %s\n" " " \
1116-
" The destination disk is too small."
1117-
if ((n_src_parts > 2))
1118-
then
1119-
printf "%-22s : %s\n" " " \
1120-
" You could try a two partition -f2 clone."
1121-
fi
1122-
fi
1123-
printf "%-23s:\n" "-----------------------"
1104+
printf "%-22s : %s\n" " " \
1105+
" Try unmounting source partitions or use -m"
1106+
elif ((n_src_parts > 2))
1107+
then
1108+
printf "%-22s : %s\n" " " \
1109+
" You could try a two partition -f2 clone if it"
1110+
printf "%-22s : %s\n" " " \
1111+
" is OK not to clone partitions above 2."
11241112
fi
1113+
printf "%-23s:\n" "-----------------------"
11251114
exit 1
11261115
fi
11271116

@@ -1146,8 +1135,8 @@ Use -U for unattended even if initializing.
11461135
" is too small to hold source used $used_readable."
11471136
if [ "$n_image_parts" == "$root_part_num" ] && ((!force_sync))
11481137
then
1149-
printf "%-22s : %s\n" "" \
1150-
" This is the root partition, so aborting!"
1138+
printf "%-22s : %s\n" "** FATAL **" \
1139+
"This is the root partition, so aborting!"
11511140
printf "%-22s : %s\n" "" \
11521141
" Use -F to override."
11531142
abort=1

0 commit comments

Comments
 (0)