PVE mount nfs virtual disk
1. Enter the pve node that needs to be mounted (here, take 192.168.122.3 as an example)
2. Enter the command line mode of this node and enter fdisk -l to confirm the disk path.
/dev/sda here is the disk that needs to be virtualized
3. Here you need to format /dev/sda into an etx4 format file, enter the command fdisk /dev/sda
The operation here is no different from Linux, partition formatting
Partition first: enter n (partition) - enter p (primary partition) - enter w (write partition)
Format (format to ext4 format):
mkfs -t ext4 /dev/sda (may not be needed)
4. Create the mapping directory and mount
mkdir -p /mnt/3
mount -t ext4 /dev/sda /mnt/3
5. Write the /mnt/sda1 mount to the system startup item:
echo /dev/sda /mnt/3 ext4 defaults 1 2 >> /etc/fstab
6.PVE mount hard disk
Added successfully
7. Continue to install the nfs service under the shell
apt-get install nfs-kernel-server
apt-get install nfs-common
. The first is to install the NFS server, and the second is to install the NFS client.
8. Add the NFS shared directory
nano /etc/exports
and add the file you want to share at the end of the file
/mnt/3 192.168.122.*(insecure,rw,sync,no_root_squash)
/mnt/3 is the directory to be shared, 192.168 .122.* means that all hosts in this network segment can mount it.
9. Grant the highest permissions to this folder
chmod -R 777 /mnt/3
chmod -R 777 /mnt/3/
10. Start nfs service
/etc/init.d/nfs-kernel-server start
/etc/init.d/nfs-kernel-server restart
11. Verify whether
showmount -e 192.168.122.3 is started
At this time we can enter the virtual machine and mount it.
12. Enter the Ubuntu virtual machine to install the nfs service
sudo apt install nfs-kernel-server
13. Create the location where the hard disk image needs to be installed
sudo mkdir /home/data*
14. Mount the image
sudo mount -t nfs 192.168.122.3:/mnt/3 /home/data3/
15.Success