public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* ext4 and dd of emmc
@ 2020-10-22 17:46 Radivoje Jovanovic
  2020-10-23 13:54 ` Theodore Y. Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Radivoje Jovanovic @ 2020-10-22 17:46 UTC (permalink / raw)
  To: linux-ext4

Hello,
I am creating empty  4GB ext4 partition on emmc with parted like this:
parted -s -a optimal /dev/emmcblk0 mkpart data ext4 1024 5120
mkfs.ext4 /dev/mmcblk0p7 (this is the partition that was created in
the previous step)

I do not mount this partition before I do dd of the emmc.
dd of the emmc is done like this:
dd if=/dev/emmcblk0 | gzip -c | dd of=./image.bin

after this I write back the emmc with the same binary file:
dd if=./image.bin | gunzip -c | dd of=. /dev/emmcblk0

now I boot the system and mount the partition from the emmc.

at the boot the kernel reports:
EXT4-fs (mmcblk0p7): warning: mounting fs with errors, running e2fsck
is recommended

after the system is fully booted I see errors such as:
EXT4-fs error (device mmcblk0p7): ext4_journal_check_start:61:
Detected aborted journal
Buffer I/O error on dev mmcblk0p7, logical block 0, lost sync page write
EXT4-fs (mmcblk0p7): I/O error while writing superblock

All other partitions on the system are ReadOnly so probably that is
why I do not see errors for them

I am running custom Yocto build on this.
the kernel is vanilla 5.4.57 with an additional pci driver we have.

Any idea why this is happening?

Thanks
Ogi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ext4 and dd of emmc
  2020-10-22 17:46 ext4 and dd of emmc Radivoje Jovanovic
@ 2020-10-23 13:54 ` Theodore Y. Ts'o
  2020-10-23 16:13   ` Radivoje Jovanovic
  0 siblings, 1 reply; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-23 13:54 UTC (permalink / raw)
  To: Radivoje Jovanovic; +Cc: linux-ext4

On Thu, Oct 22, 2020 at 10:46:18AM -0700, Radivoje Jovanovic wrote:
> Hello,
> I am creating empty  4GB ext4 partition on emmc with parted like this:
> parted -s -a optimal /dev/emmcblk0 mkpart data ext4 1024 5120
> mkfs.ext4 /dev/mmcblk0p7 (this is the partition that was created in
> the previous step)
> 
> I do not mount this partition before I do dd of the emmc.
> dd of the emmc is done like this:
> dd if=/dev/emmcblk0 | gzip -c | dd of=./image.bin
> 
> after this I write back the emmc with the same binary file:
> dd if=./image.bin | gunzip -c | dd of=. /dev/emmcblk0

Is the root file system (or any file system mounted read/write)
located on /dev/emmcblk0?  You seem to imply that /dev/emmcblk0p7 was
mounted read write, so that would appear to be the case.  If so,
that's a bad idea.  Don't do that.   It's not safe.

> at the boot the kernel reports:
> EXT4-fs (mmcblk0p7): warning: mounting fs with errors, running e2fsck
> is recommended

That's probably because of the fact that mmcblk0p7 was moounted
read/write at the time when you tried to save and restore img.bin.
*Never* mess with a block device containing a mounted file system like
this.

> Buffer I/O error on dev mmcblk0p7, logical block 0, lost sync page write
> EXT4-fs (mmcblk0p7): I/O error while writing superblock

That implies that an I/O error from the eMMC device.  That's a
hardware issue, *probably* not related to the fact that partition was
not mounted, but rather by lousy hardware Quality Assurance along the
way.  If the hardware device is throwing I/O errors, you need to root
cause that issue first before worrying about any file system
complaints.

Cheers,

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ext4 and dd of emmc
  2020-10-23 13:54 ` Theodore Y. Ts'o
@ 2020-10-23 16:13   ` Radivoje Jovanovic
  0 siblings, 0 replies; 3+ messages in thread
From: Radivoje Jovanovic @ 2020-10-23 16:13 UTC (permalink / raw)
  To: Theodore Y. Ts'o; +Cc: linux-ext4

Thank you for responding Theodore,
My answers inline below.

On Fri, Oct 23, 2020 at 6:54 AM Theodore Y. Ts'o <tytso@mit.edu> wrote:
>
> On Thu, Oct 22, 2020 at 10:46:18AM -0700, Radivoje Jovanovic wrote:
> > Hello,
> > I am creating empty  4GB ext4 partition on emmc with parted like this:
> > parted -s -a optimal /dev/emmcblk0 mkpart data ext4 1024 5120
> > mkfs.ext4 /dev/mmcblk0p7 (this is the partition that was created in
> > the previous step)
> >
> > I do not mount this partition before I do dd of the emmc.
> > dd of the emmc is done like this:
> > dd if=/dev/emmcblk0 | gzip -c | dd of=./image.bin
> >
> > after this I write back the emmc with the same binary file:
> > dd if=./image.bin | gunzip -c | dd of=. /dev/emmcblk0
>
> Is the root file system (or any file system mounted read/write)
> located on /dev/emmcblk0?  You seem to imply that /dev/emmcblk0p7 was
> mounted read write, so that would appear to be the case.  If so,
> that's a bad idea.  Don't do that.   It's not safe.

No emmc partitions are mounted ever before binary copy takes place.
The partitions are mounted only after the binary copy is fully completed.
>
> > at the boot the kernel reports:
> > EXT4-fs (mmcblk0p7): warning: mounting fs with errors, running e2fsck
> > is recommended
>
> That's probably because of the fact that mmcblk0p7 was moounted
> read/write at the time when you tried to save and restore img.bin.
> *Never* mess with a block device containing a mounted file system like
> this.
>
Again, the partitions were not mounted before dd was performed.

> > Buffer I/O error on dev mmcblk0p7, logical block 0, lost sync page write
> > EXT4-fs (mmcblk0p7): I/O error while writing superblock
>
> That implies that an I/O error from the eMMC device.  That's a
> hardware issue, *probably* not related to the fact that partition was
> not mounted, but rather by lousy hardware Quality Assurance along the
> way.  If the hardware device is throwing I/O errors, you need to root
> cause that issue first before worrying about any file system
> complaints.
>
Yes this message does look like a HW failure. However, I am able to
reproduce this
on two different emmc models and over 10 different emmc chips across 2
different plarforms,
so I would not think it is really a HW issue.

Thanks.,
Ogi

> Cheers,
>
>                                                 - Ted
Thanks
Ogi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-23 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-22 17:46 ext4 and dd of emmc Radivoje Jovanovic
2020-10-23 13:54 ` Theodore Y. Ts'o
2020-10-23 16:13   ` Radivoje Jovanovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox