[Voyage-linux] Cloning a system
Frank Hoeflich
(spam-protected)
Thu Mar 8 04:00:05 HKT 2012
Julie:
The major bug that I found when trying to create a regular dd file by loopback mounting it for Voyage installation is documented and worked around in the code snippet below (appears in my project's voyage-<custom>.sh). Prior to this code block I had loopback mounted a 2Gb regular file intended for burning to CF on /dev/loop0 and partition 1 within that file on /dev/loop1.
...## Work around grub bug #1771:## http://savannah.gnu.org/bugs/?func=detailitem&item_id=11771## This simply allows the grub install to a loopback mounted file to succeed.#rm -f /dev/loop01ln -s /dev/loop1 /dev/loop01
...
You can read the original bug report for yourself. In a nutshell, legacy grub's device directive just takes what you supply and postpends a partition number to it. So in my special case:
res = `/usr/sbin/grub --batch --device-map=/dev/null 2>&1 <<EOMdevice (hd0) /dev/loop0 # usually something like /dev/hda or /dev/sdaroot (hd0,0)setup (hd0)quitEOM`
grub was hunting around for a /dev/loop01 for the partition (usually this would be something like /dev/hda1 or /dev/sda1, right?) and never finding it - and the setup always failed. Took me days to find the bug and five minutes to grok and work around it with this symlink.
There was indeed another more minor bug that I'd have to dig through the scripts to find - but it was nowhere near as intrusive as this one was.
For now I'm fine with staying with `legacy' grub v0.97 because upgrading to grub2 changes the whole show, including the partition semantics !? ... thank you GNU guys. But I suspect it will be a smarter grub overall and will be worth the investment.
--Frank
--- On Wed, 3/7/12, jfh at greenhousepc.com <jfh at greenhousepc.com> wrote:
From: jfh at greenhousepc.com <jfh at greenhousepc.com>
Subject: RE: [Voyage-linux] Cloning a system
To: "Frank Hoeflich" <frankhoeflich at yahoo.com>, "voyage-linux at list.voyage.hk" <voyage-linux at voyage.hk>, "Stanislav Sinyagin" <ssinyagin at yahoo.com>
Date: Wednesday, March 7, 2012, 11:18 AM
Frank,
What are these "grub legacy bugs" of which you speak? That's of particular interest since trying to update GRUB on my older Voyage systems results in being told GRUB is up to date ..
I am extremely disappointed in how GRUB works. Considering its importance, it should work far more reliably than it seems to work, particularly in the embedded space. The only reason I've not switched to LILO is because I can't seem to find ways to shut it up completely.
--
Julie Haugh
Senior Design Engineer
greenHouse Computers, LLC // jfh at greenhousepc.com // greenHousePC on Skype
-------- Original Message --------
Subject: Re: [Voyage-linux] Cloning a system
From: Frank Hoeflich <frankhoeflich at yahoo.com>
Date: Wed, March 07, 2012 12:21 pm
To: "voyage-linux at list.voyage.hk" <voyage-linux at voyage.hk>, Stanislav
Sinyagin <ssinyagin at yahoo.com>
Stanislav:
While I agree that cloning your ro system live ought to work, I didn't spend much time on it. Once I have a CF that works OK then I clone offline:
host# dd if=/dev/sdb of=mycf.bin bs=512 count=3931200host# eject /dev/sdb<switch CF in /dev/sdb to a new one><format new CF however you like>host# dd if=mycf.bin of=/dev/sdb bs=512 count=3931200host# eject /dev/sdb
Then the new CF works just fine. You'll have to adjust the count for your device. Is this good enough for you?
On my last project we went a step further and modified the SDK to produce a regular file from the gitgo, so you directly produce mycf.bin and then dd it to CF whenever you want to make a copy. Works great in Voyage 0.6.5 and 0.7.5 once you get past a couple of known grub legacy (v0.97) bugs, haven't verified in 0.8.0 yet ...
--Frank
--- On Wed, 3/7/12, Stanislav Sinyagin <ssinyagin at yahoo.com> wrote:
From: Stanislav Sinyagin <ssinyagin at yahoo.com>
Subject: [Voyage-linux] Cloning a system
To: "voyage-linux at list.voyage.hk" <voyage-linux at voyage.hk>
Date: Wednesday, March 7, 2012, 9:36 AM
hi,
I'm trying to clone a live system to a new CF, and GRUB fails. Please advise, as I'm not a too deep specialist in Grub.
My sequence is as follows. The board is alix2d13 from PC Engines. The new CF card is attached via USB card reader at /dev/sdb.
remountro
/usr/local/sbin/format-cf.sh -t /dev/sdb -b 1 -y
mkdir /tmp/cf
mount /dev/sdb1 /tmp/cf
cd /tmp/cf
dump -f - /dev/hda1 | restore -r -f -
That was easy, and now Grub fails:
root at alix102:~# /usr/sbin/grub-install --root-directory=/tmp/cf /dev/sdb
The file /tmp/cf/boot/grub/stage1 not read correctly.root at alix102:~# ls -al /tmp/cf/boot/grub/stage1
-rw-r--r-- 1 root root 512 Mar 7 17:31 /tmp/cf/boot/grub/stage1
root at alix102:~#
The system is 0.8.0 release.
-----Inline Attachment Follows-----
_______________________________________________
Voyage-linux mailing list
Voyage-linux at list.voyage.hk
http://list.voyage.hk/mailman/listinfo/voyage-linux
_______________________________________________
Voyage-linux mailing list
Voyage-linux at list.voyage.hk
http://list.voyage.hk/mailman/listinfo/voyage-linux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20120307/2cb8be75/attachment.html>
More information about the Voyage-linux
mailing list