系统相关
首页 > 系统相关> > ubuntu nbd-server nbd-client使用

ubuntu nbd-server nbd-client使用

作者:互联网

1 Install nbd-server

sudo apt-get install nbd-server

2 Create a file content

dd if=/dev/zero of=/mnt/dhini bs=1024 count=36000

Use mke2fs to make the /mnt/dhini as a filesystem.

mke2fs /mnt/dhini

3 config nbd-server

cat /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.

[export]
    exportname = /home/pandx/sdbdisk/dhini

4 run nbd-server

sudo nbd-server 1043  
                            
➜  sdbdisk netstat -tln|grep 1043
tcp6       0      0 :::1043                 :::*                    LISTEN

 

5 Install nbd-client

apt-get install nbd-client
modprobe nbd

6 connect nbd-server

sudo nbd-client -N export 10.0.1.57 1043 /dev/nbd0

 

done.

标签:1043,sudo,mnt,dhini,client,server,nbd
来源: https://www.cnblogs.com/longchang/p/12165853.html