1

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

サーバー側で読み取りと書き込みの両方が可能なディスク イメージを使用して構成ファイルを構成したにもかかわらず、クライアント側ではディスク イメージが読み取り専用として表示されました。上記の手順で何が問題になっていますか? 読み取り/書き込み権限でディスク イメージをエクスポートするにはどうすればよいですか? どんな助けでも大歓迎です。

4

2 に答える 2