nfs v3 test (by quqi99)

Posted quqi99

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nfs v3 test (by quqi99)相关的知识,希望对你有一定的参考价值。

作者:张华 发表于:2021-08-28
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
(http://blog.csdn.net/quqi99 )

刚工作需要做了一个nfs v3的测试,记录一下。

# set up nfs v3 server
sudo apt-get install nfs-kernel-server -y
cat <<EOF | sudo tee -a /etc/exports
/nfs *(rw,sync,no_subtree_check)
EOF
sudo mkdir -p /nfs && sudo chown -R $USER /nfs/
sudo systemctl restart nfs-server

# set up nfs client
showmount -e node1
sudo mkdir -p /mnt/nfs && sudo chown -R $USER /mnt/nfs/
sudo mount -t nfs -o vers=3,proto=tcp,nolock node1:/nfs /mnt/nfs

# prepare backing file
mkdir -p /nfs/images && sudo cp -v /images/kvm/bionic.qcow2 /nfs/images/
chmod 777 /nfs/image/bionic.qcow2

# create two snapshots on the same backing file hosted in NFSv3 server
qemu-img create -f qcow2 -o backing_file=/mnt/nfs/image2/bionic.qcow2 /mnt/nfs/image2/bionic-snap.qcow2
chmod 777 /mnt/nfs/image2/bionic-snap.qcow2
qemu-img create -f qcow2 -o backing_file=/mnt/nfs/image2/bionic.qcow2 /mnt/nfs/image2/bionic-snap2.qcow2
chmod 777 /mnt/nfs/image2/bionic-snap2.qcow2

# create two test VMs with two snapshots

# run dd command on one VM, then restart another VM, but my both VMs run well so I didn't reproduce the problem.


do test with sparse file test with: dd if=/dev/zero of=flat2.img bs=1024k count=0 seek=2048

do test with non-sparse file test with: dd if=/dev/zero of=flat1.img bs=1024k count=1000

20210904更新 - 安装samba

买了个老母鸡(星客云),安装了armbian, 但运行nfs有问题(无法启动nfs-idmapd)

nfs-idmapd.service: Job nfs-idmapd.service/start failed with result 'dependency'

尝试了很多方法无法解决,还是换成samba吧(在windows上直接设置共享文件夹即可,但这里是linux).
安装配置samba服务端如下:

sudo apt install samba samba-common
sudo chmod 777 /mnt/sda4

# modify smb.conf
root@OneCloud:~# grep -r 'security' /etc/samba/smb.conf -B1
   max log size = 1000
   security = user
root@OneCloud:~# cat /etc/samba/smb.conf |tail -n5
[win_share]
  comment = sda4
  path = /mnt/sda4
  browseable = yes
  writeable = yes

testparm
useradd nfs
smbpasswd -a nfs
systemctl restart smbd

配置samba客户端

# sudo mount -t cifs -o username=nfs,password=password //storage/win_share /mnt/tmp/
# autofs
/mnt/win_share    -fstype=cifs,rw,username=nfs,password=password,file_mode=0777,dir_mode=0777 ://win/win_share

[1] https://sq.sf.163.com/blog/article/218146701477384192

以上是关于nfs v3 test (by quqi99)的主要内容,如果未能解决你的问题,请参考以下文章

Testing ovn manually based on LXD (by quqi99)

set up ovn based sr-iov test env (by quqi99)

set up ovn based sr-iov test env (by quqi99)

charm zaza functional test (by quqi99)

charm zaza functional test (by quqi99)

Testing ovn manually based on LXD (by quqi99)