[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] the /dev/xvda can not be mounted and read/write when using xl create domU



At 2014-04-17 00:47:15, "Ian Campbell" <Ian.Campbell@xxxxxxxxxx> wrote:
>On Wed, 2014-04-16 at 10:47 -0500, Wei Huang wrote:
>> On 04/16/2014 10:29 AM, duqi wrote:
>> > Hello everyone,
>> >
>> > I have tried to boot the domU folow the below instrctions:
>> > The domU kernel that I used is from 
>> > https://github.com/linux-sunxi/linux-sunxi.git  and the 'sunxi-devel' 
>> > branch. I  have compiled the ramdisk with the domu kernel to boot the domu.
>> >
>> > When I xl console the domU , I tried to mount the /dev/xvda to the /mnt 
>> > and I met this error:
>> > # mount /dev/xvda /mnt
>> > [  681.934232] end_request: I/O error, dev xvda, sector 2
>> > [  681.934401] EXT3-fs (xvda): error: unable to read superblock
>> > [  681.947103] end_request: I/O error, dev xvda, sector 2
>> > [  681.947244] EXT2-fs (xvda): error: unable to read superblock
>> > [  681.967089] end_request: I/O error, dev xvda, sector 2
>> > [  681.967226] EXT4-fs (xvda): unable to read superblock
>> > mount: mounting /dev/xvda on /mnt failed: Invalid argument
>> > #
>> >
>> > Then I tried "# dd if=/dev/zero of=/dev/xvda bs=1 count=1000 seek=10000" 
>> > to test the read and write of /dev/xvda, it also met error:
>> > [  632.851166] end_request: I/O error, dev xvda, sector 16
>> > dd: writing '/dev/xvda': Input/output error
>> > 1+0 records in
>> > 0+0 records out
>> >
>> > (2) the domu_all.cfg is here:
>> > root@linaro-alip:~# cat domu_all.cfg
>> > kernel = "/root/zImage"
>> > memory = "64"
>> > name = "dom11"
>> > vcpus = 1
>> > serial="pty"
>> > root="/dev/xvda"
>> > extra = "4 console=hvc0,xencons=tty"
>> > disk = [ 'phy:/dev/loop2,xvda,w' ]
>> > vif=[ 'mac=00:16:3e:56:af:69,bridge=xenbr0,type=netfront', ]
>> 
>> Based on the log, I think your loop2 might have problem. If you are 
>> using image from Linaro, you should specify the offset in losetup. Here 
>> is one:
>> 
>>  > losetup -o 54525952 /dev/loop2 ./rootfs.img
>

Thanks very much for your advices.
I want to know  how the "54525952" offset can be computed? 
Mr Huang, could you give me some advice? 

>Or use root=/dev/xvda2 on the guest command line/cfg, which would be
>more usual I think.
>
>(I'm not convinced this is the error though, since it seems xvda just
>isn't working).
>
>duqi could you post the output of "xenstore-ls -fp" while the guest is
>running but not able to access its disk.
>

Hi, here is my config of guest now:
kernel = "/root/zImage" 
memory = "64" 
name = "dom11" 
vcpus = 1 
serial="pty"
root="/dev/xvda2"
extra = "console=hvc0,xencons=tty"
disk = [ 'phy:/dev/loop2,xvda,w' ]
vif=[ 'mac=00:16:3e:56:af:69,bridge=xenbr0,type=netfront', ]

and here is the output of "xenstore-ls -fp" while the guest is running:
root@linaro-alip:~# xenstore-ls -fp
/tool = ""   (n0)
/tool/xenstored = ""   (n0)
/local = ""   (n0)
/local/domain = ""   (n0)
/local/domain/0 = ""   (n0)
/local/domain/0/name = "Domain-0"   (n0)
/local/domain/0/domid = "0"   (n0)
/local/domain/0/libxl = ""   (n0)
/local/domain/0/libxl/disable_udev = "1"   (n0)
/local/domain/0/backend = ""   (n0)
/local/domain/0/backend/vbd = ""   (n0)
/local/domain/0/backend/vbd/16 = ""   (n0)
/local/domain/0/backend/vbd/16/51712 = ""   (n0,r16)
/local/domain/0/backend/vbd/16/51712/frontend = 
"/local/domain/16/device/vbd/51712"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/params = "/dev/loop2"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/script = "/etc/xen/scripts/block"   
(n0,r16)
/local/domain/0/backend/vbd/16/51712/physical-device = "7:0"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/frontend-id = "16"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/online = "1"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/removable = "0"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/bootable = "1"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/state = "4"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/dev = "xvda"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/type = "phy"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/mode = "w"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/device-type = "disk"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/feature-flush-cache = "1"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/discard-granularity = "4096"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/discard-alignment = "0"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/discard-secure = "0"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/feature-discard = "1"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/feature-barrier = "1"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/feature-persistent = "1"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/feature-max-indirect-segments = "256"   
(n0,r16)
/local/domain/0/backend/vbd/16/51712/sectors = "2965504"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/info = "0"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/sector-size = "512"   (n0,r16)
/local/domain/0/backend/vbd/16/51712/physical-sector-size = "512"   (n0,r16)
/local/domain/0/backend/console = ""   (n0)
/local/domain/0/backend/console/16 = ""   (n0)
/local/domain/0/backend/console/16/0 = ""   (n0,r16)
/local/domain/0/backend/console/16/0/frontend = "/local/domain/16/console"   
(n0,r16)
/local/domain/0/backend/console/16/0/frontend-id = "16"   (n0,r16)
/local/domain/0/backend/console/16/0/online = "1"   (n0,r16)
/local/domain/0/backend/console/16/0/state = "1"   (n0,r16)
/local/domain/0/backend/console/16/0/domain = "dom11"   (n0,r16)
/local/domain/0/backend/console/16/0/protocol = "vt100"   (n0,r16)
/local/domain/0/backend/vif = ""   (n0)
/local/domain/0/backend/vif/16 = ""   (n0)
/local/domain/0/backend/vif/16/0 = ""   (n0,r16)
/local/domain/0/backend/vif/16/0/frontend = "/local/domain/16/device/vif/0"   
(n0,r16)
/local/domain/0/backend/vif/16/0/frontend-id = "16"   (n0,r16)
/local/domain/0/backend/vif/16/0/online = "1"   (n0,r16)
/local/domain/0/backend/vif/16/0/state = "4"   (n0,r16)
/local/domain/0/backend/vif/16/0/script = "/etc/xen/scripts/vif-bridge"   
(n0,r16)
/local/domain/0/backend/vif/16/0/mac = "00:16:3e:56:af:69"   (n0,r16)
/local/domain/0/backend/vif/16/0/bridge = "xenbr0"   (n0,r16)
/local/domain/0/backend/vif/16/0/handle = "0"   (n0,r16)
/local/domain/0/backend/vif/16/0/type = "vif"   (n0,r16)
/local/domain/0/backend/vif/16/0/feature-sg = "1"   (n0,r16)
/local/domain/0/backend/vif/16/0/feature-gso-tcpv4 = "1"   (n0,r16)
/local/domain/0/backend/vif/16/0/feature-gso-tcpv6 = "1"   (n0,r16)
/local/domain/0/backend/vif/16/0/feature-ipv6-csum-offload = "1"   (n0,r16)
/local/domain/0/backend/vif/16/0/feature-rx-copy = "1"   (n0,r16)
/local/domain/0/backend/vif/16/0/feature-rx-flip = "0"   (n0,r16)
/local/domain/0/backend/vif/16/0/feature-split-event-channels = "1"   (n0,r16)
/local/domain/0/backend/vif/16/0/hotplug-status = "connected"   (n0,r16)
/local/domain/16 = ""   (n0,r16)
/local/domain/16/vm = "/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194"   (n0,r16)
/local/domain/16/name = "dom11"   (n0,r16)
/local/domain/16/cpu = ""   (n0,r16)
/local/domain/16/cpu/0 = ""   (n0,r16)
/local/domain/16/cpu/0/availability = "online"   (n0,r16)
/local/domain/16/memory = ""   (n0,r16)
/local/domain/16/memory/static-max = "65536"   (n0,r16)
/local/domain/16/memory/target = "65537"   (n0,r16)
/local/domain/16/memory/videoram = "-1"   (n0,r16)
/local/domain/16/device = ""   (n0,r16)
/local/domain/16/device/suspend = ""   (n0,r16)
/local/domain/16/device/suspend/event-channel = ""   (n16)
/local/domain/16/device/vbd = ""   (n0,r16)
/local/domain/16/device/vbd/51712 = ""   (n16,r0)
/local/domain/16/device/vbd/51712/backend = 
"/local/domain/0/backend/vbd/16/51712"   (n16,r0)
/local/domain/16/device/vbd/51712/backend-id = "0"   (n16,r0)
/local/domain/16/device/vbd/51712/state = "4"   (n16,r0)
/local/domain/16/device/vbd/51712/virtual-device = "51712"   (n16,r0)
/local/domain/16/device/vbd/51712/device-type = "disk"   (n16,r0)
/local/domain/16/device/vbd/51712/protocol = "arm-abi"   (n16,r0)
/local/domain/16/device/vbd/51712/ring-ref = "8"   (n16,r0)
/local/domain/16/device/vbd/51712/event-channel = "3"   (n16,r0)
/local/domain/16/device/vbd/51712/feature-persistent = "1"   (n16,r0)
/local/domain/16/device/vif = ""   (n0,r16)
/local/domain/16/device/vif/0 = ""   (n16,r0)
/local/domain/16/device/vif/0/backend = "/local/domain/0/backend/vif/16/0"   
(n16,r0)
/local/domain/16/device/vif/0/backend-id = "0"   (n16,r0)
/local/domain/16/device/vif/0/state = "4"   (n16,r0)
/local/domain/16/device/vif/0/handle = "0"   (n16,r0)
/local/domain/16/device/vif/0/mac = "00:16:3e:56:af:69"   (n16,r0)
/local/domain/16/device/vif/0/tx-ring-ref = "768"   (n16,r0)
/local/domain/16/device/vif/0/rx-ring-ref = "769"   (n16,r0)
/local/domain/16/device/vif/0/event-channel-tx = "4"   (n16,r0)
/local/domain/16/device/vif/0/event-channel-rx = "5"   (n16,r0)
/local/domain/16/device/vif/0/request-rx-copy = "1"   (n16,r0)
/local/domain/16/device/vif/0/feature-rx-notify = "1"   (n16,r0)
/local/domain/16/device/vif/0/feature-sg = "1"   (n16,r0)
/local/domain/16/device/vif/0/feature-gso-tcpv4 = "1"   (n16,r0)
/local/domain/16/device/vif/0/feature-gso-tcpv6 = "1"   (n16,r0)
/local/domain/16/device/vif/0/feature-ipv6-csum-offload = "1"   (n16,r0)
/local/domain/16/control = ""   (n0,r16)
/local/domain/16/control/shutdown = ""   (n16)
/local/domain/16/control/platform-feature-multiprocessor-suspend = "1"   
(n0,r16)
/local/domain/16/control/platform-feature-xs_reset_watches = "1"   (n0,r16)
/local/domain/16/data = ""   (n16)
/local/domain/16/domid = "16"   (n0,r16)
/local/domain/16/store = ""   (n0,r16)
/local/domain/16/store/port = "1"   (n0,r16)
/local/domain/16/store/ring-ref = "540673"   (n0,r16)
/local/domain/16/console = ""   (n0,r16)
/local/domain/16/console/backend = "/local/domain/0/backend/console/16/0"   
(n0,r16)
/local/domain/16/console/backend-id = "0"   (n16,r0)
/local/domain/16/console/limit = "1048576"   (n0,r16)
/local/domain/16/console/type = "xenconsoled"   (n0,r16)
/local/domain/16/console/output = "pty"   (n0,r16)
/local/domain/16/console/tty = "/dev/pts/0"   (n0,r16)
/local/domain/16/console/port = "2"   (n0,r16)
/local/domain/16/console/ring-ref = "540672"   (n0,r16)
/vm = ""   (n0)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194 = ""   (n0,r16)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194/uuid = 
"3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194"   (n0,r16)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194/name = "dom11"   (n0,r16)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194/image = ""   (n0,r16)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194/image/ostype = "linux"   (n0,r16)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194/image/kernel = "/root/zImage"   
(n0,r16)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194/image/cmdline = "root=/dev/xvda2 
console=hvc0,xencons=tty"   (n0,r16)
/vm/3d9ec855-2ecd-4b5e-bd6a-9a0bda9b3194/start_time = "9452.17"   (n0,r16)
/libxl = ""   (n0)
/libxl/16 = ""   (n0)
/libxl/16/dm-version = "qemu_xen_traditional"   (n0)


>What is your rootfs device? (IOW what physical medium contains
>rootfs.img)
> 
>> You can also try to mount /dev/loop2 in Dom0.
>
>Yes, that would be a useful sanity check.
>

I have tested the /dev/loop2 in Dom0.

First, before boot the guest, I tried to test the /dev/2 in Dom0 as below:
(1)root@linaro-alip:~# losetup /dev/loop2 /root/rootfs.img 
root@linaro-alip:~# mount /dev/loop2 /mnt
[11315.974201] EXT4-fs (loop2): mounted filesystem with ordered data mode. 
Opts: (null)
root@linaro-alip:~# cd /mnt
root@linaro-alip:/mnt# ls
SHA256SUMS  env.sh   install     mnt             root     srv  var
bin         etc      lib         networkinfo.sh  run      sys
boot        home     lost+found  opt             sbin     tmp
dev         init.sh  media       proc            selinux  usr
root@linaro-alip:/mnt# 

(2)root@linaro-alip:~# dd if=/dev/loop2 of=test bs=1 count=10000
10000+0 records in
10000+0 records out
10000 bytes (10 kB) copied, 0.181345 s, 55.1 kB/s

Second, I tested the /dev/xvda in guest, I found that through I dan not mount 
/dev/xvda to 
the /mnt ,but I can read/write the /dev/xvda and the limit is 4096B, I don't 
know how to explain it.
the test result is here:
when I tried to write to the /dev/xvda:
# dd if=/dev/zero of=/dev/xvda bs=1 count=1000 seek=3096
1000+0 records in
1000+0 records out
# dd if=/dev/zero of=/dev/xvda bs=1 count=1000 seek=3097
[  109.879542] end_request: I/O error, dev xvda, sector 8
dd: writing '/dev/xvda': Input/output error
1000+0 records in
999+0 records out

when I tried to read from the /dev/xvda, if the count exceed the 4096 , like 
4097 , the guest's kernel crashed :
# dd if=/dev/xvda of=test bs=1 count=4096
[   92.017991] end_request: I/O error, dev xvda, sector 0
[   92.018047] Buffer I/O error on device xvda, logical block 0
[   92.018091] Buffer I/O error on device xvda, logical block 1
[   92.018117] Buffer I/O error on device xvda, logical block 2
[   92.018139] Buffer I/O error on device xvda, logical block 3
4096+0 records in
4096+0 records out
# dd if=/dev/xvda of=test bs=1 count=4097
[   95.300508] end_request: I/O error, dev xvda, sector 0
[   95.300563] Buffer I/O error on device xvda, logical block 0
[   95.319928] end_request: I/O error, dev xvda, sector 0
dd: /dev/xvda: Input/output error
# dd if=/dev/xvda of=test bs=1 count=4097
[   96.438770] end_request: I/O error, dev xvda, sector 0
[   96.438825] quiet_error: 4 callbacks suppressed
[   96.438845] Buffer I/O error on device xvda, logical block 0
[   96.438887] Buffer I/O error on device xvda, logical block 1
[   96.438911] Buffer I/O error on device xvda, logical block 2
[   96.438932] Buffer I/O error on device xvda, logical block 3
[   96.494271] end_request: I/O error, dev xvda, sector 32
[   96.494322] Buffer I/O error on device xvda, logical block 4
[   96.494350] Buffer I/O error on device xvda, logical block 5
[   96.494371] Buffer I/O error on device xvda, logical block 6
[   96.494393] Buffer I/O error on device xvda, logical block 7
[   96.494414] Buffer I/O error on device xvda, logical block 8
[   96.494434] Buffer I/O error on device xvda, logical block 9
[   96.534454] ------------[ cut here ]------------
[   96.534518] WARNING: CPU: 0 PID: 0 at drivers/block/xen-blkfront.c:1149 
blkif_interrupt+0x394/0x7b8()
[   96.534544] xvda: response to read (id 0) couldn't be recycled!
[   96.534562] Modules linked in:
[   96.534591] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
3.15.0-rc1-128773-gf7b9c0f-dirty #12
[   96.534642] [<c0216234>] (unwind_backtrace) from [<c0211e5c>] 
(show_stack+0x10/0x14)
[   96.534682] [<c0211e5c>] (show_stack) from [<c07f9210>] 
(dump_stack+0x88/0x98)
[   96.534719] [<c07f9210>] (dump_stack) from [<c0242f7c>] 
(warn_slowpath_common+0x6c/0x88)
[   96.534754] [<c0242f7c>] (warn_slowpath_common) from [<c0242fc8>] 
(warn_slowpath_fmt+0x30/0x40)
[   96.534787] [<c0242fc8>] (warn_slowpath_fmt) from [<c0553fd4>] 
(blkif_interrupt+0x394/0x7b8)
[   96.534825] [<c0553fd4>] (blkif_interrupt) from [<c0280788>] 
(handle_irq_event_percpu+0x38/0x130)
[   96.534859] [<c0280788>] (handle_irq_event_percpu) from [<c02808c0>] 
(handle_irq_event+0x40/0x60)
[   96.534893] [<c02808c0>] (handle_irq_event) from [<c0283380>] 
(handle_edge_irq+0xa0/0x188)
[   96.534924] [<c0283380>] (handle_edge_irq) from [<c027fec4>] 
(generic_handle_irq+0x2c/0x3c)
[   96.534957] [<c027fec4>] (generic_handle_irq) from [<c04ae010>] 
(evtchn_fifo_handle_events+0x190/0x1a0)
[   96.534995] [<c04ae010>] (evtchn_fifo_handle_events) from [<c04ab4e0>] 
(__xen_evtchn_do_upcall+0x70/0xa4)
[   96.535032] [<c04ab4e0>] (__xen_evtchn_do_upcall) from [<c020e4c4>] 
(xen_arm_callback+0x8/0x10)
[   96.535066] [<c020e4c4>] (xen_arm_callback) from [<c0283ae4>] 
(handle_percpu_devid_irq+0x6c/0x84)
[   96.535101] [<c0283ae4>] (handle_percpu_devid_irq) from [<c027fec4>] 
(generic_handle_irq+0x2c/0x3c)
[   96.535133] [<c027fec4>] (generic_handle_irq) from [<c020f5c0>] 
(handle_IRQ+0x40/0x90)
[   96.535163] [<c020f5c0>] (handle_IRQ) from [<c02087ec>] 
(gic_handle_irq+0x2c/0x5c)
[   96.535193] [<c02087ec>] (gic_handle_irq) from [<c02129c0>] 
(__irq_svc+0x40/0x50)
[   96.535216] Exception stack(0xc0d33f50 to 0xc0d33f98)
[   96.535237] 3f40:                                     ffffffed 00000000 
00000001 c021b860
[   96.535264] 3f60: c0d3a4c0 c0d32000 c0d3a458 00000000 00000000 c0d30098 
ffffffed c0d32000
[   96.535289] 3f80: 00000000 c0d33f98 c020f8dc c020f8e0 60000013 ffffffff
[   96.535318] [<c02129c0>] (__irq_svc) from [<c020f8e0>] 
(arch_cpu_idle+0x38/0x3c)
[   96.535351] [<c020f8e0>] (arch_cpu_idle) from [<c0276570>] 
(cpu_startup_entry+0x148/0x238)
[   96.535384] [<c0276570>] (cpu_startup_entry) from [<c0a90ae8>] 
(start_kernel+0x348/0x354)
[   96.535409] ---[ end trace 3327f9668d429059 ]---

Then I went back to Dom0  and test the /dev/loop2, it always works. Here is the 
test:
root@linaro-alip:/# mount /dev/loop2 /mnt
[11597.873141] EXT4-fs (loop2): mounted filesystem with ordered data mode. 
Opts: (null)
root@linaro-alip:/# cd /mnt
root@linaro-alip:/mnt# ls
SHA256SUMS  env.sh   install     mnt             root     srv  var
bin         etc      lib         networkinfo.sh  run      sys
boot        home     lost+found  opt             sbin     tmp
dev         init.sh  media       proc            selinux  usr
root@linaro-alip:/mnt# 


Many thanks again.

duqi.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.