apt-get install nbd-server # modprobe nbd # mkdir -p /home/exported # dd if=/dev/zero of=/home/exported/trial.img count=256 bs=1024k # mkfs.ext3 /home/exported/trial.img # nbd-server 1234 /home/exported/trial.img # touch /root/empty # nbd-server 1234 /home/exported/trial.img -C /root/empty
# apt-get install nbd-client # nbd-client mine.my.flat 1234 /dev/nbd0 Negotiation: ..size = 262144KB bs=1024, sz=262144 # mkdir /mnt/remote # mount /dev/nbd0 /mnt/remote # for i in $(seq 1 100) ; do echo $i > /mnt/remote/$i; done # umount /mnt/remote root@vain:~# nbd-client 127.0.0.1 1234 /dev/nbd0 root@vain:~# mkdir /tmp/foo root@vain:~# mount /dev/nbd0 /tmp/foo root@vain:~# ls /tmp/foo/ 1 14 2 25 30 36 41 47 52 58 63 69 74 8 85 90 96 10 15 20 26 31 37 42 48 53 59 64 7 75 80 86 91 97 100 16 21 27 32 38 43 49 54 6 65 70 76 81 87 92 98 11 17 22 28 33 39 44 5 55 60 66 71 77 82 88 93 99 12 18 23 29 34 4 45 50 56 61 67 72 78 83 89 94 13 19 24 3 35 40 46 51 57 62 68 73 79 84 9 95 lost+found
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。