1

I have dumped the raw partition dumped via ssh from an external system using the command:

ssh root@10.10.10.10 'dd if=/dev/xvda2 bs=1M | gzip' | gunzip | dd of=xvda2.raw

As you can see, only the partition is dumped /dev/xvda2 (yes this is on purpose) because this is the / partition with all the important data for the system to boot, and we need only that, because the whole server is ~1TB with the other storage partitions, so we need to move the root partition first, spin up the server and the rest of the data will be rsync-ed.

Next I tried to restore the partition:

  1. Created a new disk on a temporary system, with size just a little bit larger than the xvda2.raw dump. In my case 50GB so the disk that I created is 52GB.
  2. Create new partition on the disk same as original and format as ext4.
  3. dd the contents back: dd if=xvda2.raw of=/dev/sde1 bs=1M conv=notrunc,noerror,sync

And when I tried to mount to inspect it, I got an error:

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

Any suggestions of what I might be dong wrong?

A little backstory

Normally I clone the entire disk. However in this case the source system is very large so the approach is to clone just the root drive, attempt to start the new system like that and then rsync the contents for the other storage partitions. In my case I believe this would work, because the / partition has all of the contents of the server.

Edit: Thank you for the pointers. After I mount the partition, and it fails, the following can be found in 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
  • Is /dev/xvda2 mounted when you try to read it? If so, what makes you think you'll get a clean copy? (You almost certainly won't.) – roaima Mar 9 '18 at 17:59
  • 2
    If you have to copy a live system, is there any reason why you don't want to rsync the root partition? – roaima Mar 9 '18 at 18:00
  • Does your target server have support for whatever filesystem type you've copied? After you attempt the mount and it fails, are there any relevant error messages at the end of dmesg? – roaima Mar 9 '18 at 18:16
  • The source filesystem is ext4. /dev/xvda2 not /dev/sda2 because it is an EC2 from AWS that I am moving it on premise. Casual move with dd on the entire disk works, in this case I am just trying to move just the root partition for the sake of not moving a whole Terabyte. – Spirit Mar 9 '18 at 18:21
  • 1
    @Spirit, I would follow user Roaima's advice and use rsync to move the partition, This post may help you – kemotep Mar 9 '18 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.