# 查看系统分区情况 df -h mkdir -p /data/pink # 使用 rsync 备份整个 /data 目录 time rsync -avlHt --progress --exclude=/data/media /data /sdcard/data sent 2,546,814,512 bytes received 439,395 bytes 26,396,413.54 bytes/sec total size is 2,547,073,319 speedup is 1.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at external/rsync/main.c(1178) [sen der=3.1.2] 1m36.63s real 0m34.66s user 0m50.07s system
addison:/sdcard/data/data # du -sh 2.4G
# 输出结果 sent 2,304,507,949 bytes received 422,353 bytes 22,487,124.90 bytes/sec total size is 2,304,882,629 speedup is 1.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at external/rsync/main.c(1178) [sen der=3.1.2] 1m41.64s real 0m31.24s user 0m47.07s system
# 测试删除的速度 addison:/sdcard # time rsync --delete-before -avH --progress --stats tmp data Number of files: 1 (dir: 1) Number of created files: 0 Number of deleted files: 23,961 (reg: 20,654, dir: 3,307) Number of regular files transferred: 0 Total file size: 0 bytes Total transferred file size: 0 bytes Literal data: 0 bytes Matched data: 0 bytes File list size: 0 File list generation time: 0.001 seconds File list transfer time: 0.000 seconds Total bytes sent: 60 Total bytes received: 1,669,739
sent 60 bytes received 1,669,739 bytes 477,085.43 bytes/sec total size is 0 speedup is 0.00 0m03.10s real 0m00.31s user 0m02.36s system
发现一个很僵硬的问题,使用 tar 或者 rsync 备份是无法保留所属信息的,虽然可以保留权限信息,但目录和文件的所属信息时无法保存的。那我们只好将 /data/data 目录里的内容删除了,删除 /data/data目录里第三放 app 的应用数据目录时不影响使用的。
# 备份 /data/data目录 time rsync -avlHt --progress /data/data /sdcard/data/data
sent 189,072,151 bytes received 50,969 bytes 16,445,488.70 bytes/sec total size is 413,158,141 speedup is 2.18 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at external/rsync/main.c(1178) [sen der=3.1.2] 0m10.71s real 0m02.84s user 0m05.04s system
# 备份 /data/app 目录 time rsync -avlHt --progress /data/app /sdcard/data/app
sent 1,099,653,619 bytes received 6,928 bytes 41,496,624.42 bytes/sec total size is 1,099,358,469 speedup is 1.00 0m25.94s real 0m10.91s user 0m08.29s system ## 看来备份数据的速度还是相当快的
# 禁用数据连接 svc data disable svc usb disable # 开启飞行模式 settings put global airplane_mode_on 1; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
# 禁用APN adb shell settings put global airplane_mode_on 0 adb shell am broadcast -a android.intent.action.AIRPLANE_MODE
# 将 usb 连接设置为 midi ,能禁用 adb ? svc usb setFunction midi
# down 掉所有网卡,优点暴力😂 ifconfig | grep Link | grep -v inet6 | cut -d ' ' -f1 for dev in \`ifconfig | grep Link | grep -v inet6 | cut -d ' ' -f1\` ;do ifconfig $dev down ;done
iptables -t nat -A OUTPUT -p tcp -j DROP iptables -t nat -A OUTPUT -p udp -j DROP iptables -t nat -A INPUT -p tcp -j DROP iptables -t nat -A INPUT -p udp -j DROP