Web lists-archives.com

Re: "Invalid arch-independent ELF magic" in grub after SSD migration




On Wed, 2017-02-22 at 18:56 +0100, Lucio Crusca wrote:
> Il 22/02/2017 17:40, Tixy ha scritto:
> > On Wed, 2017-02-22 at 09:18 +0100, Lucio Crusca wrote:
> >> I booted a live Ubuntu from CD media, checked with fdisk that every
> >> partition is starting 4K aligned and used the following command to
> >> copy the disk contents:
> >>
> >> dd if=/dev/sda of=/dev/sdb status=progress bs=4K
> >
> > Did you unmount all partitions on /dev/sda and /dev/sdb first?
> 
> Yes I did. But, even if I didn't, I fail to understand how that could break grub.

If the target disk (your SSD) already had partitions with filesystem and
Ubuntu mounted them, then any activity that modified those filesystem
could be written back to the disk at any time, e.g. to the sectors where
grub was copied to it after it was copied there.

At the very least, Ubuntu would cause writes to the SSD due to things
like superblock updates for mount time and count, and possibly access
timestamps in file inodes. But if it's a GUI desktop live CD, I wouldn't
be surprised if there wasn't background file indexing and thumbnailing
tasks running too, writing who knows what to the filesystem.

-- 
Tixy


If you don't think Ubuntu would write to a file-system unnecessarily,
(which I do, because I'm sure it'll have indexing an thumbnailing tasks
running in the backround)


 you coppied it could cause modifications to be written to the SSD at
any time, say to the sectors where grub got copied to. If you don't
think Ubuntu would cause
 Who knows what background tasks Ubuntu has indexi

then you copying a disk image to the SSD could result in corruption if
Ubuntu caused modifications to the SSD to happen in the same sectors
where Grub was. Say a filesystem superblock was near the start of the
original contents, an the loast mount time or file access times were
written out to that after grub was coppied there