RaspberryPi-script icon indicating copy to clipboard operation
RaspberryPi-script copied to clipboard

希望可以更新一下脚本!

Open angeluslove opened this issue 7 years ago • 43 comments

我说下我的问题,我使用树莓派3,系统是带界面的官方系统 7月5号的版本。 备份过程中出现了错误,首先是挂载U盘后.img文件超出4G问题,这个我把U盘格式化为了exfat模式。 然后安装了需要的文件,修改了脚本去掉了 -t fat 。可以正常挂载,并建立了一个6G大小的.img

在第二步的时候出错了: ...省略了一些rsync帮助的输出。 Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at main.c(1640) [Receiver=3.1.1] ./piback.sh: 141: ./piback.sh: --exclude: not found ./piback.sh: 143: ./piback.sh: --exclude: not found ./piback.sh: 145: ./piback.sh: --exclude: not found ./piback.sh: 147: ./piback.sh: --exclude: not found ./piback.sh: 149: ./piback.sh: --exclude: not found ./piback.sh: 151: ./piback.sh: --exclude: not found ./piback.sh: 153: ./piback.sh: --exclude: not found ./piback.sh: 155: ./piback.sh: --exclude: not found ./piback.sh: 157: ./piback.sh: --exclude: not found ./piback.sh: 159: ./piback.sh: --exclude: not found ./piback.sh: 161: ./piback.sh: --exclude: not found ./piback.sh: 163: ./piback.sh: //: Permission denied ls: cannot access /mnt/backup_root//home/pi/: No such file or directory ...Root partition done sed: can't read /mnt/backup_root//etc/fstab: No such file or directory sed: can't read /mnt/backup_root//etc/fstab: No such file or directory ==== All done. You can un-plug the backup device

希望可以得到帮助,这个项目还是很棒的,特别是可以实现官方一样的效果就太酷了! 希望可以更新脚本,维护下项目。

angeluslove avatar Aug 05 '17 10:08 angeluslove

pi@raspberrypi:~ $ sudo ./piback.sh no argument, assume the mount device is /dev/sda1 ? Y/N y FUSE exfat 1.1.0 Reading package lists... Done Building dependency tree
Reading state information... Done dosfstools is already the newest version. kpartx is already the newest version. parted is already the newest version. rsync is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ===================== part 1, create a new blank img =============================== 6211636+0 records in 6211636+0 records out 6360715264 bytes (6.4 GB) copied, 3094.85 s, 2.1 MB/s boot: 8192 >>> 93596, root: 94208 >>> end mkfs.fat 3.0.27 (2014-11-12) mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows unable to get drive geometry, using default 255/63 mke2fs 1.43.3 (04-Sep-2016) Creating filesystem with 1540864 4k blocks and 385536 inodes Filesystem UUID: 523e4157-7d1e-48aa-ae8e-c14192913909 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done

===================== part 2, fill the data to img ========================= ...Boot partition done rsync version 3.1.1 protocol version 31 Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence for details.

rsync is a file transfer program capable of efficient remote update via a fast differencing algorithm.

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done

===================== part 2, fill the data to img ========================= ...Boot partition done rsync version 3.1.1 protocol version 31 Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence for details.

rsync is a file transfer program capable of efficient remote update via a fast differencing algorithm.

Usage: rsync [OPTION]... SRC [SRC]... DEST or rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST or rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST or rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST or rsync [OPTION]... [USER@]HOST:SRC [DEST] or rsync [OPTION]... [USER@]HOST::SRC [DEST] or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST] The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect to an rsync daemon, and require SRC or DEST to start with a module name.

Options -v, --verbose increase verbosity --info=FLAGS fine-grained informational verbosity --debug=FLAGS fine-grained debug verbosity --msgs2stderr special output handling for debugging -q, --quiet suppress non-error messages --no-motd suppress daemon-mode MOTD (see manpage caveat) -c, --checksum skip based on checksum, not mod-time & size -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) --no-OPTION turn off an implied OPTION (e.g. --no-D) -r, --recursive recurse into directories -R, --relative use relative path names --no-implied-dirs don't send implied dirs with --relative -b, --backup make backups (see --suffix & --backup-dir) --backup-dir=DIR make backups into hierarchy based in DIR --suffix=SUFFIX set backup suffix (default ~ w/o --backup-dir) -u, --update skip files that are newer on the receiver --inplace update destination files in-place (SEE MAN PAGE) --append append data onto shorter files --append-verify like --append, but with old data in file checksum -d, --dirs transfer directories without recursing -l, --links copy symlinks as symlinks -L, --copy-links transform symlink into referent file/dir --copy-unsafe-links only "unsafe" symlinks are transformed --safe-links ignore symlinks that point outside the source tree --munge-links munge symlinks to make them safer (but unusable) -k, --copy-dirlinks transform symlink to a dir into referent dir -K, --keep-dirlinks treat symlinked dir on receiver as dir -H, --hard-links preserve hard links -p, --perms preserve permissions -E, --executability preserve the file's executability --chmod=CHMOD affect file and/or directory permissions -A, --acls preserve ACLs (implies --perms) -X, --xattrs preserve extended attributes -o, --owner preserve owner (super-user only) -g, --group preserve group --devices preserve device files (super-user only) --specials preserve special files -D same as --devices --specials

上边是第一部分,和第二部分的一部分输出,不明白为什么会打印 rsync 的帮助信息出来。

angeluslove avatar Aug 05 '17 10:08 angeluslove

这个项目只是我之前做项目的时候随手写的工具,备份在这里,发现有不少人在用,真的很惊讶…… 看起来你的问题是rysnc造成的,你手动跑一下rsync的那句话试试,感觉好像你的rsync版本不同导致不接受传进去的参数。你的打印信息里面,貌似像—force这种就没有列出来,可能不支持。

在 2017年8月5日,18:55,angeluslove [email protected] 写道:

pi@raspberrypi:~ $ sudo ./piback.sh no argument, assume the mount device is /dev/sda1 ? Y/N y FUSE exfat 1.1.0 Reading package lists... Done Building dependency tree Reading state information... Done dosfstools is already the newest version. kpartx is already the newest version. parted is already the newest version. rsync is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ===================== part 1, create a new blank img =============================== 6211636+0 records in 6211636+0 records out 6360715264 bytes (6.4 GB) copied, 3094.85 s, 2.1 MB/s boot: 8192 >>> 93596, root: 94208 >>> end mkfs.fat 3.0.27 (2014-11-12) mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows unable to get drive geometry, using default 255/63 mke2fs 1.43.3 (04-Sep-2016) Creating filesystem with 1540864 4k blocks and 385536 inodes Filesystem UUID: 523e4157-7d1e-48aa-ae8e-c14192913909 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done

===================== part 2, fill the data to img ========================= ...Boot partition done rsync version 3.1.1 protocol version 31 Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence for details.

rsync is a file transfer program capable of efficient remote update via a fast differencing algorithm.

Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done

===================== part 2, fill the data to img ========================= ...Boot partition done rsync version 3.1.1 protocol version 31 Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence for details.

rsync is a file transfer program capable of efficient remote update via a fast differencing algorithm.

Usage: rsync [OPTION]... SRC [SRC]... DEST or rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST or rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST or rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST or rsync [OPTION]... [USER@]HOST:SRC [DEST] or rsync [OPTION]... [USER@]HOST::SRC [DEST] or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST] The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect to an rsync daemon, and require SRC or DEST to start with a module name.

Options -v, --verbose increase verbosity --info=FLAGS fine-grained informational verbosity --debug=FLAGS fine-grained debug verbosity --msgs2stderr special output handling for debugging -q, --quiet suppress non-error messages --no-motd suppress daemon-mode MOTD (see manpage caveat) -c, --checksum skip based on checksum, not mod-time & size -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) --no-OPTION turn off an implied OPTION (e.g. --no-D) -r, --recursive recurse into directories -R, --relative use relative path names --no-implied-dirs don't send implied dirs with --relative -b, --backup make backups (see --suffix & --backup-dir) --backup-dir=DIR make backups into hierarchy based in DIR --suffix=SUFFIX set backup suffix (default ~ w/o --backup-dir) -u, --update skip files that are newer on the receiver --inplace update destination files in-place (SEE MAN PAGE) --append append data onto shorter files --append-verify like --append, but with old data in file checksum -d, --dirs transfer directories without recursing -l, --links copy symlinks as symlinks -L, --copy-links transform symlink into referent file/dir --copy-unsafe-links only "unsafe" symlinks are transformed --safe-links ignore symlinks that point outside the source tree --munge-links munge symlinks to make them safer (but unusable) -k, --copy-dirlinks transform symlink to a dir into referent dir -K, --keep-dirlinks treat symlinked dir on receiver as dir -H, --hard-links preserve hard links -p, --perms preserve permissions -E, --executability preserve the file's executability --chmod=CHMOD affect file and/or directory permissions -A, --acls preserve ACLs (implies --perms) -X, --xattrs preserve extended attributes -o, --owner preserve owner (super-user only) -g, --group preserve group --devices preserve device files (super-user only) --specials preserve special files -D same as --devices --specials

上边是第一部分,和第二部分的一部分输出,不明白为什么会打印 rsync 的帮助信息出来。

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/conanwhf/RaspberryPi-script/issues/4#issuecomment-320437147, or mute the thread https://github.com/notifications/unsubscribe-auth/ANfwN4TFzFcA8jtbhapGvAhLjUV7TPDgks5sVEoRgaJpZM4Oubjt.

conanwhf avatar Aug 05 '17 15:08 conanwhf

以树莓派的销量来看,这种需求的人一定不会少,这个脚本还是非常有价值的!

angeluslove avatar Aug 06 '17 06:08 angeluslove

非常感谢你的脚本,经过排错和修改,已经完美备份成功,树莓派3的备份后,写入img到zero中也可以正常启动运行。 以后可以发布自己修改过的镜像了,非常完美!再次感谢你的工作!

angeluslove avatar Aug 11 '17 07:08 angeluslove

太客气了!如果是脚本本身有什么bug,欢迎提交你的修改方案!

在 2017年8月11日,15:13,angeluslove [email protected] 写道:

非常感谢你的脚本,经过排错和修改,已经完美备份成功,树莓派3的备份后,写入img到zero中也可以正常启动运行。 以后可以发布自己修改过的镜像了,非常完美!再次感谢你的工作!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/conanwhf/RaspberryPi-script/issues/4#issuecomment-321745360, or mute the thread https://github.com/notifications/unsubscribe-auth/ANfwN_elM_inGiKaTkt4ljDtFBMLoqztks5sW_7_gaJpZM4Oubjt.

conanwhf avatar Aug 11 '17 07:08 conanwhf

sudo rsync --force -rltWDEgopt --delete --stats --progress
最后一个参数和换行标记中间缺少空格
--progress\ 应该修改为 --progress \ ,不然会引起rsync报错,主要是缺少空格后会和后边的参数粘连起来,导致过程报错!

angeluslove avatar Aug 12 '17 00:08 angeluslove

-rltWDEgopt 参数里边的t 重复了,不过不会报错,我不清楚这个是否有影响

angeluslove avatar Aug 12 '17 00:08 angeluslove

sudo apt-get -y install rsync dosfstools parted kpartx exfat-fuse 可以把工具下载的语句添加到最开始,添加exfat-fuse支持挂载exfat格式u盘 然后修改挂载的两个语句为 sudo mount -o uid=1000 /dev/sda1 $usbmount 这样可以支持大于4g的单个img文件

angeluslove avatar Aug 12 '17 00:08 angeluslove

好的,下周我看看merge进去,感谢!

在 2017年8月12日,08:50,angeluslove [email protected] 写道:

-rltWDEgopt 参数里边的t 重复了,不过不会报错,我不清楚这个是否有影响

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/conanwhf/RaspberryPi-script/issues/4#issuecomment-321946610, or mute the thread https://github.com/notifications/unsubscribe-auth/ANfwN6q6urq2kUZY8q7-LDaSG0H6Hve2ks5sXPbvgaJpZM4Oubjt.

conanwhf avatar Aug 13 '17 07:08 conanwhf

rsync: chown "/mnt/backup_root/opt/Wolfram/WolframEngine/11.0/SystemFiles/Formats/XHTML/.Export.m.Beaje7" failed: Operation not permitted (1) 同步时候出现这个卡住了 你们都遇到过没

udpsec avatar Aug 30 '17 05:08 udpsec

可以尝试切换到root再运行脚本!

angeluslove avatar Aug 30 '17 07:08 angeluslove

@angeluslove 好的,谢谢了 刚刚用root备份成功现在实验看看

udpsec avatar Aug 30 '17 07:08 udpsec

@angeluslove 恢复镜像写入到别的SD卡 那个根目录cmdline.txt root这里要改吗

udpsec avatar Aug 30 '17 08:08 udpsec

@udpsec 我备份后,没有修改过任何东西,可以随意恢复到任何一个设备!

angeluslove avatar Aug 30 '17 08:08 angeluslove

@angeluslove 好的,我是想用U盘启动系统的恢复了结果没点亮 我自己再去研究研究吧。谢谢你解答了

udpsec avatar Aug 30 '17 08:08 udpsec

请问,我的系统备份之后可以启动,但是只能用tty1-6的命令行界面,桌面服务是挂掉了,而且startx直接就黑了。这个是什么原因?

bearinthesky avatar Sep 05 '17 13:09 bearinthesky

要看你startx以后有什么错误打印信息才知道

发自我的 iPhone

在 2017年9月5日,21:59,bearinthesky [email protected] 写道:

请问,我的系统备份之后可以启动,但是只能用tty1-6的命令行界面,桌面服务是挂掉了,而且startx直接就黑了。这个是什么原因?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

conanwhf avatar Sep 05 '17 17:09 conanwhf

@conanwhf 感谢博主的开源,终于搞定了,因为是插在显示屏上而且开机就出问题,报错信息是跳过去看不到了。不过我运行了几次脚本发现在运行第一部分的时候每次产生的文件大小并不是脚本里面的1.3倍,只有大概4G,应该是文件大小被限制了导致文件拷贝不完全,按照上面那个哥么提到的需要删除第60行的-t vfat,就好了。

bearinthesky avatar Sep 07 '17 02:09 bearinthesky

OK,如果你说文件大小的问题,那么确实是fat32的原因,当时我自己是为了做个更精简无界面的系统才写的脚本,没有考虑到这个问题。 前几天我已经更新过脚本,应该解决了。但我手头没有机器,所以只是手工修改给需要的人,如果你有时间可以帮忙测试一次。

在 2017年9月7日,10:57,bearinthesky [email protected] 写道:

@conanwhf https://github.com/conanwhf 感谢博主的开源,终于搞定了,因为是插在显示屏上而且开机就出问题,报错信息是跳过去看不到了。不过我运行了几次脚本发现在运行第一部分的时候每次产生的文件大小并不是脚本里面的1.3倍,只有大概4G,应该是文件大小被限制了导致文件拷贝不完全,按照上面那个哥么提到的需要删除第60行的-t vfat,就好了。

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/conanwhf/RaspberryPi-script/issues/4#issuecomment-327669443, or mute the thread https://github.com/notifications/unsubscribe-auth/ANfwN2ElHYe6YfD9znkrRnhyHj2-DBviks5sf1t8gaJpZM4Oubjt.

conanwhf avatar Sep 07 '17 05:09 conanwhf

脚本不会帮你格式化,你也不需要特意格式化,只要留出足够的空间来放img就行了。

第60行的mount只是mount system boot,跟U盘的格式无关,应该不会影响最终镜像。你说的镜像大小正常,是多大?

在 2017年9月20日,12:09,xcxc12344 [email protected] 写道:

还有就是运行脚本前需要将u盘格式化吗?还是脚本会帮我格式化?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/conanwhf/RaspberryPi-script/issues/4#issuecomment-330739766, or mute the thread https://github.com/notifications/unsubscribe-auth/ANfwNyi1I6cMWkZWpppszeDkxvzU8eVQks5skI_dgaJpZM4Oubjt.

conanwhf avatar Sep 20 '17 06:09 conanwhf

7个G左右

xcxc12344 avatar Sep 20 '17 06:09 xcxc12344

我在运行脚本前格式化U盘为FAT32格式,最后处理好的镜像都是正好4个G,所以我觉得首先要先格式化为exFAT格式

xcxc12344 avatar Sep 20 '17 06:09 xcxc12344

但是格式成exFAT格式后,出现了这个问题,请问如何解决 FUSE exfat 1.2.5 WARN: volume was not unmounted cleanly. fuse: mountpoint is not empty fuse: if you are sure this is safe, use the 'nonempty' mount option mount fail, exit now

xcxc12344 avatar Sep 20 '17 06:09 xcxc12344

是的,你需要自己先格式化成exFat,不然无法支持大于4G的img。 我没有用过linux下的exFAT,无法给你更多的建议,也许是版本兼容性的问题。你可以先更新你的exFat工具,然后自己手动尝试mount,成功以后再把脚本中的对应mount语句改成OK的。

在 2017年9月20日,14:28,xcxc12344 [email protected] 写道:

但是格式成exFAT格式后,出现了这个问题,请问如何解决 FUSE exfat 1.2.5 WARN: volume was not unmounted cleanly. fuse: mountpoint is not empty fuse: if you are sure this is safe, use the 'nonempty' mount option mount fail, exit now

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/conanwhf/RaspberryPi-script/issues/4#issuecomment-330757390, or mute the thread https://github.com/notifications/unsubscribe-auth/ANfwN5Bqs58rqyKahnSEjY1l8dICfw6wks5skLBygaJpZM4Oubjt.

conanwhf avatar Sep 20 '17 06:09 conanwhf

好的

xcxc12344 avatar Sep 20 '17 06:09 xcxc12344

@xcxc12344 我之前用的时候也出出fuse这个提示,树莓派系统不支持exfat格式,无法挂载。解决方法就是在命令行下单独运行脚本的第四行安装语句,主要是exfat-fuse,就ok了 应该。

bearinthesky avatar Sep 20 '17 06:09 bearinthesky

@bearinthesky 好的,我试下

xcxc12344 avatar Sep 20 '17 07:09 xcxc12344

@bearinthesky 你好,我命令行下单独运行脚本的第四行安装语句,还是这个问题: FUSE exfat 1.2.5 WARN: volume was not unmounted cleanly. fuse: mountpoint is not empty fuse: if you are sure this is safe, use the 'nonempty' mount option mount fail, exit now

xcxc12344 avatar Sep 20 '17 17:09 xcxc12344

我的系统是最新的官方界面系统

xcxc12344 avatar Sep 20 '17 17:09 xcxc12344

@xcxc12344 我的好像没出现你这个问题,不太懂。不过你可以就按照这个提示换上这个参数试下,把13行和19行的-o uid=1000改成-o nonempty试一试看行不行,不行可以问下楼上几个哥么都咋处理的。

bearinthesky avatar Sep 21 '17 01:09 bearinthesky