情况。通过 USB2 备份硬盘(是的,有点慢)
Udev-Rules 在 /media/partition-label 中挂载 /home-backup 分区(仅 1 个用户)。
/dev/sdb2 on /media/debianhome type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
` udev-rule 触发我创建的 systemd-unit。
cat /etc/systemd/system/backup-home-skript.service
[Unit]
Description=backup-home-skript
RequiresMountsFor=/media/debianhome
After=media-debianhome.mount
[Service]
Type=simple
User=alex
ExecStart=/usr/local/bin/backup-home-skript
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=15s
到目前为止,一切都很好。
systemctl status backup-home-skript.service
● backup-home-skript.service - backup-home-skript
Loaded: loaded (/etc/systemd/system/backup-home-skript.service; static; vendor preset: enabled)
Active: active (running) since Wed 2017-11-08 16:04:41 CET; 4h 26min ago
Main PID: 23143 (backup-home-skr)
Tasks: 4 (limit: 4915)
CGroup: /system.slice/backup-home-skript.service
├─23143 /bin/bash /usr/local/bin/backup-home-skript
├─23191 rsync -aAXEovvchx --ignore-existing --verbose --exclude=/home/alex/iso-image/ --exclude=/home/alex/.cache/ --excl
├─23192 rsync -aAXEovvchx --ignore-existing --verbose --exclude=/home/alex/iso-image/ --exclude=/home/alex/.cache/ --excl
└─23404 rsync -aAXEovvchx --ignore-existing --verbose --exclude=/home/alex/iso-image/ --exclude=/home/alex/.cache/ --excl
Nov 08 16:04:41 Taomon systemd[1]: Started backup-home-skript.
备份主页脚本
cat /usr/local/bin/backup-home-skript
#!/bin/bash
echo "wating for device to become ready" >> /home/alex/rsync.log
/bin/sleep 45
while ! \
rsync -aAXEovvchx --ignore-existing --verbose \
--exclude=/home/alex/iso-image/ \
--exclude=/home/alex/.cache/ \
--exclude=/home/alex/.thumbnails/ \
--exclude=/home/alex/rsync.log \
/home/alex/ /media/debianhome/alex >> /home/alex/rsync.log
do
sleep 60
echo "retrying" >> /home/alex/rsync.log
done
/usr/bin/aplay -q /home/alex/Musik/Wave/game-over.wav
echo "rsync done" >> /home/alex/rsync.log
exit 0
rsync卡在这里2小时
tail -n10 rsync.log
send_files mapped /home/alex/.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35CBBC56B8E501F758A3BED2CD20C52E5694F9E5 of size 53947
calling match_sums /home/alex/.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35CBBC56B8E501F758A3BED2CD20C52E5694F9E5
.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35CBBC56B8E501F758A3BED2CD20C52E5694F9E5
sending file_sum
false_alarms=0 hash_hits=0 matches=0
sender finished /home/alex/.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35CBBC56B8E501F758A3BED2CD20C52E5694F9E5
send_files(13899, /home/alex/.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35ED5D22AB261A928FEA2B5079701D5DF254CF71)
send_files mapped /home/alex/.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35ED5D22AB261A928FEA2B5079701D5DF254CF71 of size 17369
calling match_sums /home/alex/.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35ED5D22AB261A928FEA2B5079701D5DF254CF71
.cache/mozilla/firefox/tv7fce7g.default/cache2/entries/35ED5D22AB261A928FEA2B5079701D5DF254CF71
我不明白 rsync 在做什么。不要--排除意味着让这一切平静下来吗?有时有效,有时无效。dmesg 过滤
/usr/local/bin/backup-home-skript 或我的 systemd-unit 有问题吗?我希望我提供了所有相关信息。
新的尝试。
rsync -aAXEovvvchxs --ignore-existing \
--exclude={iso-image,*cache*,*thumb*,rsync.log*,.*}
现在它被一个图像卡住了。
mediainfo enna/enna-0.4.0/data/theme/default/images/unknown_cover.png
General
Complete name : enna/enna-0.4.0/data/theme/default/images/unknown_cover.png
Format : PNG
Format/Info : Portable Network Graphic
File size : 217 KiB
Image
Format : PNG
Format/Info : Portable Network Graphic
Width : 600 pixels
Height : 600 pixels
Bit depth : 32 bits
Compression mode : Lossless
Stream size : 217 KiB (100%)
是时候使用 smartmontools 了。
答案1
抱歉,结果是硬件故障。
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed: read failure 10% 1145 1887144880 - 168
`