On Wednesday 21 December 2005 17:31, Ian Smith-Heisters wrote:
> Sorry to be dense, but I couldn't quite figure out how to do that. My
> first stumbling block is that /dev/ubd1 and /dev/ubd2 don't exist.
> Indeed, there are no ubd* devices at all.. the kernel boot show this:

> # sudo -u uml vmlinux \
> ubd0=dubya-dev.breezy.rootfs \
> ubd1=dubya-dev.cow,breezy.rootfs.pristine \
> ubd2=dubya-dev.breezy.rootfs.bak \
> con=null con0=null,fd:2 con1=fd:0,fd:1 \
> eth0=tuntap,tap0 mem=512M
> ...
>   ubda: unknown partition table
> Creating "dubya-dev.cow" as COW file for "breezy.rootfs.pristine"
>   ubdb: unknown partition table
>   ubdc: unknown partition table

This is correct - you don't have run fdisk to partition the device (and for 
UML it's unusual), so it's perfectly correct.

>   * udev requires hotplug support, not started.

> But everything on the new server instance works fine. Thinking it was a
> udev error, I tried apt-getting udev and hotplug, but as I expected
> they're installed and upgraded to the newest versions. A kernel
> compilation misconfiguration?

It's possible, I don't remember the config, however it should be possible. For 
me:

$ grep HOTPLUG ../um-linux-2.6-git-build/.config

CONFIG_HOTPLUG=y
(also note vmlinux --showconfig option, you'll like it).

I'd first check that hotplug is started, and you can look at the script to see 
what's missing. If a missing file in /proc, it's likely what you say. 
However:

 mknod /dev/ubd1 b 98 16

would do the job. I've attached a script to create *all* the nodes. cd /dev 
and run it.

Note it also creates /dev/ubd{a,b,c,d..}, which are the newer names used by 
the kernel and by udev.

> However, even if I were to get that working, I'm not quite sure how to
> "compare block by block (512-byte blocks) the two files. replace the
> ubd1 block with ubd2 one when they don't match." Something using cmp and
> dd?

No, it should be coded in C, sorry. Well, at least so I intended it - it is 
indeed possible to do something like

cmp <(dd if=a PARAMS) <(dd if=b PARAMS)

where params is something like seek/skip=currently examined sector.

However, I would have said it's better coded in C - three forks (at least) for 
each sector is going to be a bit slow.

I coded it, it took one hour to do, I cursed about C a bit, and got it working 
- it is correct and makes the COW file as little as possible. Another hour 
more or less to do proper testing on it. And still, you'll like to use 
backup, and to verify the result.

Especially with large files (2G+) - I didn't test there, however I tried to 
cater to this opportunity.

Sample usage:

./makeEqualDev /dev/ubdA /dev/ubdB

which will modify only /dev/ubdB and make it equal to the other.

So, /dev/ubdA should be the modified root_fs, while /dev/ubdB should be setup 
as a COW laying over the original root_fs.

Please (for yourself), don't run it on mounted UBD devices - a mounted device 
read-write can alwasy be changed (by the kernel syncing) , and the tool 
changing an image already mounted (even read-only) could confuse the kernel 
leading it to crash.

> Thanks for the advice.
> -Ian

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

Attachment: UbdMAKEDEV
Description: application/shellscript

Reply via email to