2

I have a disk, with two partitions:

# 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

where /dev/mmcblk0p2 holds the overlay filesystem.

I umount and copy the 2nd partition in a file on an ext4 usb stick (/media/usb/sda1) :

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

The file shows:

# 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)

If I try to mount it, it fails :

# 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

and the mount changes the file:

# file overlay.img 
overlay.img: data

My device is an ARM, with busybox v1.24.1 on it.

So, how to copy whole partition? How to mount it, and is it modifying my file? Do I need to do something additionally to mount it properly?

  • Your filesystem is corrupted. Try fsck.ext4. – 炸鱼薯条德里克 Sep 10 '19 at 11:38
  • @炸鱼薯条德里克 I forgot to say, that my filesystem is an overlay filesystem, which is mounted with mount -t overlay overlay -o noatime,lowerdir=/,upperdir=${OVERLAY_UPPER},workdir=${OVERLAY_WORK} /mnt Can I copy it with dd? – BЈовић Sep 10 '19 at 11:57
  • No. Because overlay filesystem is not a typical data structure that can be stored on disk. Also it's completely different than what you said in the Q – 炸鱼薯条德里克 Sep 10 '19 at 12:44

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.