使用 dd 转储单个分区(不是整个磁盘)

使用 dd 转储单个分区(不是整个磁盘)

我使用以下命令转储了通过 ssh 从外部系统转储的原始分区:

ssh [email protected] 'dd if=/dev/xvda2 bs=1M | gzip' | gunzip | dd of=xvda2.raw

正如你所看到的,只有分区被转储/dev/xvda2(是的,这是故意的),因为这是 / 分区,其中包含系统启动的所有重要数据,而我们只需要它,因为整个服务器与其他分区的大小约为 1TB存储分区,因此我们需要首先移动根分区,启动服务器,然后对其余数据进行 rsync。

接下来我尝试恢复分区:

  1. 在临时系统上创建了一个新磁盘,其大小仅比 xvda2.raw 转储大一点。在我的例子中是 50GB,所以我创建的磁盘是 52GB。
  2. 在磁盘上创建与原始分区相同的新分区,格式为 ext4。
  3. 将内容添加回来:dd if=xvda2.raw of=/dev/sde1 bs=1M conv=notrunc,noerror,sync

当我尝试安装以检查它时,出现错误:

# mount /dev/sde1 /mnt/temp/
mount: /dev/sde1: can't read superblock

对我可能犯的错误有什么建议吗?

一些背景故事

通常我会克隆整个磁盘。然而,在这种情况下,源系统非常大,因此方法是仅克隆根驱动器,尝试像这样启动新系统,然后 rsync 其他存储分区的内容。就我而言,我相信这会起作用,因为 / 分区包含服务器的所有内容。

编辑:谢谢您的指点。我挂载分区后,失败,可以在以下位置找到dmesg

[ 3530.757481] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587756: comm mount: lblock 30700 mapped to illegal pblock (length 1)
[ 3530.768332] jbd2_journal_bmap: journal block not found at offset 30700 on sde1-8
[ 3530.768334] JBD2: bad block at offset 30700
[ 3530.768336] JBD2: IO error -5 recovering block 30700 in log
[ 3530.768339] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587757: comm mount: lblock 30701 mapped to illegal pblock (length 1)
[ 3530.776409] jbd2_journal_bmap: journal block not found at offset 30701 on sde1-8
[ 3530.776411] JBD2: bad block at offset 30701
[ 3530.776412] JBD2: IO error -5 recovering block 30701 in log
[ 3530.776415] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587758: comm mount: lblock 30702 mapped to illegal pblock (length 1)
[ 3530.790785] jbd2_journal_bmap: journal block not found at offset 30702 on sde1-8
[ 3530.790788] JBD2: bad block at offset 30702
[ 3530.790789] JBD2: IO error -5 recovering block 30702 in log
[ 3530.790793] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587759: comm mount: lblock 30703 mapped to illegal pblock (length 1)
[ 3530.802422] jbd2_journal_bmap: journal block not found at offset 30703 on sde1-8
[ 3530.802425] JBD2: bad block at offset 30703
[ 3530.802426] JBD2: IO error -5 recovering block 30703 in log
[ 3530.802430] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587760: comm mount: lblock 30704 mapped to illegal pblock (length 1)
[ 3530.804867] jbd2_journal_bmap: journal block not found at offset 30704 on sde1-8
[ 3530.804869] JBD2: bad block at offset 30704
[ 3530.804870] JBD2: IO error -5 recovering block 30704 in log
[ 3530.804873] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587761: comm mount: lblock 30705 mapped to illegal pblock (length 1)
[ 3530.805166] jbd2_journal_bmap: journal block not found at offset 30705 on sde1-8
[ 3530.805167] JBD2: bad block at offset 30705
[ 3530.805168] JBD2: IO error -5 recovering block 30705 in log
[ 3530.805170] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587762: comm mount: lblock 30706 mapped to illegal pblock (length 1)
[ 3530.805467] jbd2_journal_bmap: journal block not found at offset 30706 on sde1-8
[ 3530.805468] JBD2: bad block at offset 30706
[ 3530.805469] JBD2: IO error -5 recovering block 30706 in log
[ 3530.805471] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587763: comm mount: lblock 30707 mapped to illegal pblock (length 1)
[ 3530.805980] jbd2_journal_bmap: journal block not found at offset 30707 on sde1-8
[ 3530.805981] JBD2: bad block at offset 30707
[ 3530.805982] JBD2: IO error -5 recovering block 30707 in log
[ 3530.805984] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587764: comm mount: lblock 30708 mapped to illegal pblock (length 1)
[ 3530.806322] jbd2_journal_bmap: journal block not found at offset 30708 on sde1-8
[ 3530.806324] JBD2: bad block at offset 30708
[ 3530.806325] JBD2: IO error -5 recovering block 30708 in log
[ 3530.806327] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587765: comm mount: lblock 30709 mapped to illegal pblock (length 1)
[ 3530.806644] jbd2_journal_bmap: journal block not found at offset 30709 on sde1-8
[ 3530.806645] JBD2: bad block at offset 30709
[ 3530.820916] JBD2: recovery failed
[ 3530.820919] EXT4-fs (sde1): error loading journal
[ 4016.957490] EXT4-fs (sde1): mounted filesystem with ordered data mode. Opts: (null)
[ 8947.062786] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587756: comm mount: lblock 30700 mapped to illegal pblock (length 1)
[ 8947.063597] jbd2_journal_bmap: journal block not found at offset 30700 on sde1-8
[ 8947.063599] JBD2: bad block at offset 30700
[ 8947.063600] JBD2: IO error -5 recovering block 30700 in log
[ 8947.063602] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587757: comm mount: lblock 30701 mapped to illegal pblock (length 1)
[ 8947.064111] jbd2_journal_bmap: journal block not found at offset 30701 on sde1-8
[ 8947.064113] JBD2: bad block at offset 30701
[ 8947.064114] JBD2: IO error -5 recovering block 30701 in log
[ 8947.064116] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587758: comm mount: lblock 30702 mapped to illegal pblock (length 1)
[ 8947.064540] jbd2_journal_bmap: journal block not found at offset 30702 on sde1-8
[ 8947.064541] JBD2: bad block at offset 30702
[ 8947.064542] JBD2: IO error -5 recovering block 30702 in log
[ 8947.064544] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587759: comm mount: lblock 30703 mapped to illegal pblock (length 1)
[ 8947.064960] jbd2_journal_bmap: journal block not found at offset 30703 on sde1-8
[ 8947.064961] JBD2: bad block at offset 30703
[ 8947.064962] JBD2: IO error -5 recovering block 30703 in log
[ 8947.064964] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587760: comm mount: lblock 30704 mapped to illegal pblock (length 1)
[ 8947.065338] jbd2_journal_bmap: journal block not found at offset 30704 on sde1-8
[ 8947.065340] JBD2: bad block at offset 30704
[ 8947.065340] JBD2: IO error -5 recovering block 30704 in log
[ 8947.065342] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587761: comm mount: lblock 30705 mapped to illegal pblock (length 1)
[ 8947.066019] jbd2_journal_bmap: journal block not found at offset 30705 on sde1-8
[ 8947.066020] JBD2: bad block at offset 30705
[ 8947.066021] JBD2: IO error -5 recovering block 30705 in log
[ 8947.066023] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587762: comm mount: lblock 30706 mapped to illegal pblock (length 1)
[ 8947.080135] jbd2_journal_bmap: journal block not found at offset 30706 on sde1-8
[ 8947.080138] JBD2: bad block at offset 30706
[ 8947.080139] JBD2: IO error -5 recovering block 30706 in log
[ 8947.080142] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587763: comm mount: lblock 30707 mapped to illegal pblock (length 1)
[ 8947.088046] jbd2_journal_bmap: journal block not found at offset 30707 on sde1-8
[ 8947.088049] JBD2: bad block at offset 30707
[ 8947.088051] JBD2: IO error -5 recovering block 30707 in log
[ 8947.088054] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587764: comm mount: lblock 30708 mapped to illegal pblock (length 1)
[ 8947.088677] jbd2_journal_bmap: journal block not found at offset 30708 on sde1-8
[ 8947.088679] JBD2: bad block at offset 30708
[ 8947.088680] JBD2: IO error -5 recovering block 30708 in log
[ 8947.088683] EXT4-fs error (device sde1): ext4_map_blocks:581: inode #8: block 587765: comm mount: lblock 30709 mapped to illegal pblock (length 1)
[ 8947.089133] jbd2_journal_bmap: journal block not found at offset 30709 on sde1-8
[ 8947.089134] JBD2: bad block at offset 30709
[ 8947.104770] JBD2: recovery failed
[ 8947.104773] EXT4-fs (sde1): error loading journal

相关内容