【问题标题】:How can I export disk image file to a remote machine using ndb-server?如何使用 ndb-server 将磁盘映像文件导出到远程机器?
【发布时间】:2014-11-11 15:58:44
【问题描述】:

我正在尝试使用 nbd-server 和 nbd-client 将一台机器上的磁盘映像导出到另一台机器。 在将运行 nbd-server 的服务器端(主机名 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-server 如下

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

即使我在服务器端配置了配置文件,磁盘映像可读可写, 磁盘映像在客户端显示为只读。 我经历的上述步骤有什么问题?如何导出具有读写权限的磁盘映像? 任何帮助将不胜感激。

【问题讨论】:

    标签: linux permissions network-block-device


    【解决方案1】:

    您可能已经注意到,但仅供参考:这是 nbd-client 中的一个错误,已在 nbd-client v3.11 中修复。

    【讨论】:

    • 嗯,您可以添加对错误报告或类似内容的引用吗?
    • 没有正式的错误报告,只有邮件列表中的一封邮件,我现在无法立即找到。问题是 nbd-server 作为新式协商的一部分发送的两个标志字段之间存在一些混淆;因此,为 3.10 新引入的标志被误解为只读标志。我确信这一点;我写了这个错误(和修复;-)
    【解决方案2】:

    这里的答案有点晚了,但为了其他遇到此问题的人的利益而发布它 -

    选项#1:更改备份文件的所有权 -

    #  chown nbd:nbd disk_image
    

    选项#2:更改备份文件的权限 -

    # chmod a+w disk_image
    

    选项#3:更改 /etc/nbd-server/config 以以合适的用户身份运行 nbd-server(比如 hadoop)-

    # cat /etc/nbd-server/config
    [generic]
    user = hadoop
    group = hadoop
    ...
    

    【讨论】:

      猜你喜欢
      • 2016-02-25
      • 1970-01-01
      • 2014-02-24
      • 2016-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      相关资源
      最近更新 更多