我正在尝试使用NBD服务器和NBD客户端将一台计算机上的磁盘映像导出到另一台计算机。
在NBD服务器将运行的服务器端(主机名GPU),我使用dd命令创建了一个磁盘映像,并使用mke2fs命令在映像文件上创建了一个文件系统。
图像文件如下所示。

hadoop@gpu:~/nbd_test$ file disk_image
disk_image: Linux rev 1.0 ext2 filesystem data, UUID=058e181f-6461-46b1-ba7c-ead455ae83c9 (large files)

然后,我配置/etc/nbd server/config如下。
[generic]
# If you want to run everything as root rather than the nbd user, you
# may either say "root" in the two following lines, or remove them
# altogether. Do not remove the [generic] section, however.
user = nbd
group = nbd
includedir = /etc/nbd-server/conf.d

# What follows are export definitions. You may create as much of them as
# you want, but the section header has to be unique.

[nbd-test]
exportname = /home/hadoop/nbd_test/disk_image
# The following line will be ignored unless the
# "oldstyle = true" line in the generic section above is
# enabled.
port = 12345
#authfile = /export/nbd/export1-authfile
#timeout = 30
#filesize = 10000000
readonly = false
multifile = false
copyonwrite = false
#prerun = dd if=/dev/zero of=%s bs=1k count=500
#postrun = rm -f %s

然后,我运行NBD服务器如下
hadoop@gpu:~/nbd_test$ sudo nbd-server -C /etc/nbd-server/config

** (process:17264): WARNING **: A port was specified, but oldstyle exports were not requested. This may not do what you expect.

** (process:17264): WARNING **: Please read 'man 5 nbd-server' and search for oldstyle for more info

然后,在客户机(pcl-mr1)上,在安装块特殊文件/dev/nbd0之后得到以下结果。
hadoop@pcl-mr1:~$ sudo nbd-client gpu -N nbd-test /dev/nbd0
Negotiation: ..size = 1953MB
bs=1024, sz=2048000000 bytes
hadoop@pcl-mr1:~$ sudo mount /dev/nbd0  nbd_disk/
mount: block device /dev/nbd0 is write-protected, mounting read-only

即使我在服务器端配置了配置文件,使磁盘映像可读写,
磁盘映像在客户端显示为只读。
我刚才走过的台阶怎么了?如何使用读写权限导出磁盘映像?
任何帮助都将不胜感激。

最佳答案

您可能已经注意到了,但作为参考:这是nbd client中的一个bug,在nbd client v3.11中已修复。

10-08 03:02