Closed shaohao closed 6 years ago
how does it fail? What's the error message? Do you get a kernel message? If so, what? What does the server log say when it fails?
it's very wired. I run the server on a arm nas and run the client on a x86_64 Intel archlinux. the mkfs kept reporting failed on /dev/nbd0. but everything works okay if I run the whole flow on another network environment (both server and client run centos). I guess maybe the failed environment has some wired issues on network connection. I will try it again and paste the error report here.
Okay, I just test it on my home network environment.
ARM NAS: run nbd-server 3.16.2 to service an arch.img file
RaspberryPi Debian 9.3: run nbd-client 3.15.2 sudo nbd-client -N arch server_ip /dev/nbd0
then , run mkfs.btrfs:
sudo mkfs.btrfs /dev/nbd0
report:
btrfs-progs v4.7.3 See http://btrfs.wiki.kernel.org for more information. Detected a SSD, turning off metadata duplication. Mkfs with -m dup if you want to force metadata duplication. ERROR: failed to zero device '/dev/nbd0': Input/output error
If I run mkfs.ext4:
sudo mkfs.ext4 /dev/nbd0
report:
mke2fs 1.43.4 (31-Jan-2017) /dev/nbd0: Operation not permitted while setting up superblock
run dmesg | tail
output nothing about nbd-client.
again, please look at the log on the server side, and see if that gives you anything. It's very possible that you're trying to write to a readonly device or something, and then you should get a log entry for that...
I just solved the problem: chmod +w arch.img to add write permission to the file or chown this IMG file to the user defined in nbd-server config file.
truncate -s 4G my.img to create a blank img file and server it by nbd-server. use: nbd-client -N my myservip /dev/nbd0 to connect the img to /dev/nbd0 use: mkfs.btrfs /dev/nbd0 or other mkfs (ext4, ext3, xfs) all failed to mkfs this img. Tested on nbd-3.16.2