如何将覆盖分区复制到文件,以及如何挂载此类文件?

如何将覆盖分区复制到文件,以及如何挂载此类文件?

我有一个磁盘,有两个分区:

# fdisk -l

Disk /dev/mmcblk0: 7381 MB, 7381975040 bytes
4 heads, 16 sectors/track, 225280 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

        Device Boot      Start         End      Blocks  Id System
/dev/mmcblk0p1   *          33       32800     1048576  83 Linux
/dev/mmcblk0p2           32801       65568     1048576  83 Linux

其中/dev/mmcblk0p2保存覆盖文件系统。

我卸载并复制 ext4 USB 记忆棒上文件中的第二个分区 ( /media/usb/sda1):

# umount /overlay/
# dd if=/dev/mmcblk0p2 of=/media/usb/sda1/overlay.img

该文件显示:

# file overlay.img 
overlay.img: Linux rev 1.0 ext4 filesystem data, UUID=79213fb6-180c-474c-ba7b-2567a62a869a (needs journal recovery) (extents) (large files) (huge files)

如果我尝试安装它,它会失败:

# mount -t ext4 -o loop overlay.img mnt
[  931.883626] EXT4-fs error (device loop0): ext4_map_blocks:591: inode #8: block 131098: comm mount: lblock 26 mapped to illegal pblock 131098 (length 1)
[  931.921489] jbd2_journal_bmap: journal block not found at offset 26 on loop0-8
[  931.928718] JBD2: bad block at offset 26
[  931.932626] JBD2: IO error -5 recovering block 26 in log
[  931.937968] EXT4-fs error (device loop0): ext4_map_blocks:591: inode #8: block 131099: comm mount: lblock 27 mapped to illegal pblock 131099 (length 1)
[  931.998314] jbd2_journal_bmap: journal block not found at offset 27 on loop0-8
[  932.005560] JBD2: bad block at offset 27
[  932.009484] JBD2: IO error -5 recovering block 27 in log
[  932.014810] EXT4-fs error (device loop0): ext4_map_blocks:591: inode #8: block 131100: comm mount: lblock 28 mapped to illegal pblock 131100 (length 1)
[  932.041620] jbd2_journal_bmap: journal block not found at offset 28 on loop0-8
[  932.048834] JBD2: bad block at offset 28
[  932.052745] JBD2: IO error -5 recovering block 28 in log
[  932.058051] EXT4-fs error (device loop0): ext4_map_blocks:591: inode #8: block 131101: comm mount: lblock 29 mapped to illegal pblock 131101 (length 1)
[  932.082502] jbd2_journal_bmap: journal block not found at offset 29 on loop0-8
[  932.089716] JBD2: bad block at offset 29
[  932.093629] JBD2: IO error -5 recovering block 29 in log
[  932.098937] EXT4-fs error (device loop0): ext4_map_blocks:591: inode #8: block 131102: comm mount: lblock 30 mapped to illegal pblock 131102 (length 1)
[  932.127150] jbd2_journal_bmap: journal block not found at offset 30 on loop0-8
[  932.134369] JBD2: bad block at offset 30
[  933.372932] JBD2: recovery failed
[  933.376238] EXT4-fs (loop0): error loading journal
mount: mounting /dev/loop0 on mnt failed: Input/output error

mount更改文件:

# file overlay.img 
overlay.img: data

我的设备是ARM,上面有busybox v1.24.1。

那么,如何复制整个分区呢?如何挂载它,它是否修改了我的文件?我需要额外做一些事情才能正确安装它吗?

相关内容