欢迎来到电脑知识学习网,专业的电脑知识大全学习平台!

手机版

win10恢复分区备份系统-(win10恢复分区备份系统还在吗)

电脑故障 发布时间:2022-12-27 21:08:15
win10恢复分区备份系统 (win10恢复分区备份系统还在吗)

前 提:

有root权限备份恢复boot/system分区为例

先查看分区信息:

方法一 :

命令:ls -l /dev/block/platform/mtk-msdc.0/by-name/

root@GiONEE_GBL7319:/ # ls -l /dev/block/platform/mtk-msdc.0/by-name/lrwxrwxrwx root root 2022-05-20 21:16 boot -> /dev/block/mmcblk0p7lrwxrwxrwx root root 2022-05-20 21:16 cache -> /dev/block/mmcblk0p21lrwxrwxrwx root root 2022-05-20 21:16 expdb -> /dev/block/mmcblk0p10lrwxrwxrwx root root 电脑 2022-05-20 21:16 flashinfo -> /dev/block/mmcblk0p23lrwxrwxrwx root root 2022-05-20 21:16 frp -> /dev/block/mmcblk0p17lrwxrwxrwx root root 2022-05-20 21:16 keystore -> /dev/block/mmcblk0p14lrwxrwxrwx root root 2022-05-20 21:16 lk -> /dev/block/mmcblk0p5lrwxrwxrwx root root 2022-05-20 21:16 logo -> /dev/block/mmcblk0p9lrwxrwxrwx root root 2022-05-20 21:16 metadata -> /dev/block/mmcblk0p19lrwxrwxrwx root root 2022-05-20 21:16 nvdata -> /dev/block/mmcblk0p18lrwxrwxrwx root root 2022-05-20 21:16 nvram -> /dev/block/mmcblk0p2lrwxrwxrwx root root 2022-05-20 21:16 oemkeystore -> /dev/block/mmcblk0p12lrwxrwxrwx root root 2022-05-20 21:16 para -> /dev/block/mmcblk0p6lrwxrwxrwx root root 2022-05-20 21:16 proinfo -> /dev/block/mmcblk0p1lrwxrwxrwx root root 2022-05-20 21:16 protect1 -> /dev/block/mmcblk0p3lrwxrwxrwx root root 2022-05-20 21:16 protect2 -> /dev/block/mmcblk0p4lrwxrwxrwx root root 2022-05-20 21:16 recovery -> /dev/block/mmcblk0p8lrwxrwxrwx root root 2022-05-20 21:16 seccfg -> /dev/block/mmcblk0p11lrwxrwxrwx root root 2022-05-20 21:16 secro -> /dev/block/mmcblk0p13lrwxrwxrwx root root 2022-05-20 21:16 system -> /dev/block/mmcblk0p20lrwxrwxrwx root root 2022-05-20 21:16 tee1 -> /dev/block/mmcblk0p15lrwxrwxrwx root root 2022-05-20 21:16 tee2 -> /dev/block/mmcblk0p16lrwxrwxrwx root root 2022-05-20 21:16 userdata -> /dev/block/mmcblk0p22

boot分区对应实际的目录是/dev/block/mmcblk0p7

方法二:

根目录/下的fstab.xxx和/dev/recovery.fstab也可查相关信息

备 份:

方法一:cat

命令:cat /dev/block/mmcblk0p7 > /sdcard/bootBAK.img

root@GiONEE_GBL7319:/ # cat /dev/block/mmcblk0p7 > /sdcard/bootBAK.img

查看结果:

root@GiONEE_GBL7319:/ # ls -l /sdcard/boot*-rw-rw---- root sdcard_r 7145472 2015-06-30 07:04 boot.img-rw-rw---- root sdcard_r 16777216 2022-05-20 21:45 bootBAK.img-rw-rw---- root sdcard_r 7485440 2022-02-28 08:22 bootF103_magisk.img

bootBAK.img大小是16777216字节

对比一下:

先查看分区大小

命令:cat /proc/partitions

root@GiONEE_GBL7319:/ # cat /proc/partitionsmajor minor #blocks name 254 0 491520 zram0 7 0 18944 loop0 179 0 15267840 mmcblk0 179 1 3072 mmcblk0p1 179 2 5120 mmcblk0p2 179 3 10240 mmcblk0p3 179 4 10240 mmcblk0p4 179 5 512 mmcblk0p5 179 6 512 mmcblk0p6 179 7 16384 mmcblk0p7 对应boot分区 179 8 16384 mmcblk0p8 179 9 8192 mmcblk0p9 179 10 10240 mmcblk0p10 179 11 512 mmcblk0p11 179 12 2048 mmcblk0p12 179 13 6144 mmcblk0p13 179 14 8192 mmcblk0p14 179 15 5120 mmcblk0p15 179 16 5120 mmcblk0p16 179 17 1024 mmcblk0p17 179 18 32768 mmcblk0p18 179 19 37888 mmcblk0p19 179 20 2097152 mmcblk0p20 179 21 409600 mmcblk0p21 179 22 12563968 mmcblk0p22 179 23 16384 mmcblk0p23 179 96 4096 mmcblk0rpmb 179 64 4096 mmcblk0boot1 179 32 4096 mmcblk0boot0

mmcblk0p7的blocks是16384块,每块大小1024字节

boot大小 = 16384 * 1024 = 16777216字节,与备份出来的大小一样。

方法二:dd

命令:dd if=/dev/block/mmcblk0p7 of=/sdcard/bootBAK2.img

1|root@GiONEE_GBL7319:/ # dd if=/dev/block/mmcblk0p7 of=/sdcard/bootBAK2.img32768+0 records in32768+0 records out16777216 bytes transferred in 2.001 secs (8384415 bytes/sec)

或者:

dd if=/dev/block/mmcblk0p7 of=/sdcard/bootBAK2.img bs=1024 count=16384

命令说明 :

if表示输入(数据源)of表示输出(备份到哪)bs即blockscount是多少个bs

结果:

root@GiONEE_GBL7319:/ # ls -l /sdcard/boot*-rw-rw---- root sdcard_r 7145472 2015-06-30 07:04 boot.img-rw-rw---- root sdcard_r 16777216 2022-05-20 21:45 bootBAK.img-rw-rw---- root sdcard_r 16777216 2022-05-20 21:56 bootBAK2.img-rw-rw---- root sdcard_r 7485440 2022-02-28 08:22 bootF103_magisk.img

方法三:cpio

命令:find /system -print | cpio -ovd -H newc > /sdcard/system.cpio 备份/system

root@GiONEE_GBL7319:/ # find /system -print | busybox cpio -ovd -H newc > /sdcard/system.cpioroot@GiONEE_GBL7319:/ # ls -l /sdcard/system*-rw-rw---- root sdcard_r 1916820332 2022-05-25 23:11 system.cpioroot@GiONEE_GBL7319:/ # file /sdcard/system.cpio/sdcard/system.cpio: ASCII cpio archive (SVR4 with no CRC)

方法四:tar

命令:tar cvzpf system-bak0526.tar.gz --exclude=/system/lost+found --exclude=/system/recovery-from-boot.bak /system

备份/system时排除掉./lost+found , recovery-from-boot.bak

先查看/system数据:

c:\tmp\fastboot>adb shellshell@GiONEE_GBL7319:/ $ suroot@GiONEE_GBL7319:/ # ls /systemappbinbuild.propdataetcfontsframeworkliblib64lost+foundmediapluginpriv-apprecovery-from-boot.bakresttsusrvendorxbin

执行备份:

root@GiONEE_GBL7319:/ # cd /sdcardroot@GiONEE_GBL7319:/sdcard # busybox tar cvzpf system-bak0526.tar.gz --exclude=/system/lost+found --exclude=/system/recovery-from-boot.bak /system

参数说明:

-c 建立压缩文件-x 解开压缩文件-v 显示列表-z 用gzip进行压缩-p 保留原来的属性-f 指定压缩文档名--exclude 排除的文件或目录

查看结果:

root@GiONEE_GBL7319:/sdcard # ll sys*-rw-rw---- root sdcard_r 1132545851 2022-05-26 16:04 system-bak0526.tar.gz130|root@GiONEE_GBL7319:/sdcard # busybox tar -tf system-bak0526.tar.gz|grep flash_imagesystem/xbin/flash_image

=================================

恢 复 分 区/数据:

方法一:dd

命令:dd if=/sdcard/bootBAK2.img of=/dev/block/mmcblk0p7

root@GiONEE_GBL7319:/ # dd if=/sdcard/bootBAK2.img of=/dev/block/mmcblk0p7

方法二:fastboot flash

命令:fastboot flash boot bootBAK2.img

c:\tmp\fastboot>adb reboot bootloaderc:\tmp\fastboot>fastboot devices8T8HBIZSBU9PCM4S fastbootc:\tmp\fastboot>fastboot flash boot bootBAK2.img

方法三:flash_image

命令:flash_image partition file.img

有时候partition不识别boot, 则改为/dev/block/mmcblk0p7试试

root@GiONEE_GBL7319:/ # flash_image boot /sdcard/bootBAK2.imgfailed with error: -1root@GiONEE_GBL7319:/ # flash_image /dev/block/mmcblk0p7 /sdcard/bootBAK2.img

方法四:cpio

命令:cpio -iuvd < /sdcard/system.cpio

参数说明:

-i 将数据文件复制到系统中,copy-in-o 将系统数据复制成文件,copy-out-u 自动将较新文件覆盖旧文件-v 显示清单-d 自动建立目录-p 原版备份,不进行额外处理-H format

format有如下格式:

bin : The obsolete binary format. (2147483647 bytes)odc : The old (POSIX.1) portable format. (8589934591 bytes)newc : The new (SVR4) portable format, which supports file systems having more than 65536 i-nodes. (4294967295 bytes)

另外说明 :

dd命令可备份 :文件、分区、磁盘、光盘等

用法说明:

Usage: dd [if=FILE] [of=FILE] [ibs=N obs=N/bs=N] [count=N] [skip=N] 电脑 [seek=N] [conv=notrunc|noerror|sync|fsync] [iflag=skip_bytes|fullblock] [oflag=seek_bytes|append]Copy a file with converting and formatting if=FILE Read from FILE instead of stdin of=FILE Write to FILE instead of stdout bs=N Read and write N bytes at a time ibs=N Read N bytes at a time obs=N Write N bytes at a time count=N Copy only N input blocks skip=N Skip N input blocks seek=N Skip N output blocks conv=notrunc Don't truncate output file conv=noerror Continue after read errors conv=sync Pad blocks with zeros conv=fsync Physically write data out before finishing conv=swab Swap every pair of bytes iflag=skip_bytes skip=N is in bytes iflag=fullblock Read 电脑 full blocks oflag=seek_bytes seek=N is in bytes oflag=append Open output file in append mode status=noxfer Suppress rate output status=none Suppress all outputN may be suffixed by c (1), w (2), b (512), kB (1000), k (1024), MB, M, GB, G

/dev/null : 回收站

/dev/zero :生成0字符


电脑 电脑
责任编辑:电脑知识学习网

电脑故障