El 13/03/12 15:19, Su Zhang escribió:> Hi All,
>
> I want to create a domU file system by copying necessary stuff from Dom0.
> However, I encountered an error. I first create a block device for DomU:
> " # mknod /dev/xvda1 b 202 0"
Are you doing that on Dom0? That is most certanly wrong.
/dev/xvda1 is a valid (might be valid) reference within DomU, not Dom0.
DomU''s block devices are visible to Dom0 as LVM logical volumes, or
partitions (rarely used), or files. Usually, you map those block devices
(LVM volumes of files) to DomU''s xvdaX.
> Then I want to temporarily attach this device to dom0 in order to copy
> the file system of dom0, so I used
> a command "# xm block-attach 0 duncan.img /dev/xvda1 w 0".
No need to do it with Dom0. Dom0 is a very special case. They call it
"privileged domain", it can see the hardware directly. Attach stuff to
it as if it where a physical machine.
> Anyone has any clue on that?
Lemme chew it a little bit (:
Create a LVM volume in Dom0 (or dd to raw file until it reaches desired
size).
Format it in Dom0.
Mount it in Dom0.
Copy files to the volume (debootstrap or xen-create-image would be more
advisable, but copy might work, if you have where to copy from).
Unmont the volume in Dom0.
Attach the volume to DomU (via xm command or config file, config file is
advisable).
Mount and read it as /dev/xvdXY in DomU.
When done (successfully), you will earn the privilege to write "X3N"
instead of "XEN".
--
Alexandre Kouznetsov