当前位置:网站首页>Multipass Chinese documents - improve mount performance

Multipass Chinese documents - improve mount performance

2022-06-26 04:41:00 But the teacher

General catalogue ( To be translated and perfected )

1. overview

2. course

3. Directions for use

   3.1 install Multipass

     3.1.1 be based on Linux

     3.1.2 be based on macOS

     3.1.3 be based on Windows

   3.2 Manage instances

     3.2.1 Create examples

     3.2.2 Modify instance

     3.2.3 Using examples

     3.2.4 Use the instance command alias

     3.2.5 Share data with instances

     3.2.6 Remove instance

   3.3 management Multipass

     3.3.1 Set the drive

     3.3.2 Authorize the client to use Multipass service

     3.3.3 Remote use Multipass

     3.3.4 Improve mount performance

     3.3.5 Use Packer pack Multipass Mirror image

     3.3.6 Set image interface

     3.3.7 Use different macOS terminal

   3.4 Troubleshoot problems

     3.4.1 Connection log

     3.4.2 Network troubleshooting


How to improve Multipass Mount performance

See also : How to share data with instances , mount

Multipass By default SSHFS Mount the host folder on the instance . This provides a performance in , Better neutralization scheme between safety and function , Other methods can also accomplish this task manually .

We have thoroughly tested many mounting methods . ad locum , We will briefly describe how to create shares on each system using the efficient methods we have found , How to be in Multipass Mount them in the instance

Content :


SMB/CIFS mount

In our tests , SMB stay Multipass All the structures have excellent performance . Windows and MacOS Provides a system SMB The server , Linux It is also easy to install ( The newer core version provides a system server , And what we describe here can also be aimed at the old Linux edition ).

Use SMB Shared folders

Windows

First , This section is optional , We can start at Windows The built-in SMB On the server RDMA. In the control panel , We can find Windows Function switch . At this window , We need to enable SMB drive . Windows It may be necessary to start .

then , We can use PowerShell Shared folders . Look at the command below :

New-SmbShare -Name "share_name" -Path "C:\my_path"

We will create a host named \\hostname\share_name The share of . command New-SmbShare There are many options to control connection and encoding , But this is not the topic of this article .


MacOS

These can be operated with the interface (GUI) complete , Only some steps are relatively simple from the command line . If possible , We will show the latter later .

We need to start the shared system according to the following command :

$ sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist EnabledServices -aaray disk
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist

then , To share the specified folder :

$ sudo sharing -a /my_path/

Last , We need to allow users to pass SMB Connect to a shared folder . therefore , We need to navigate to system preferences (System Preferences), Find the sharing icon . There is an option button in the share menu . This button will open a window , We can choose which users can mount . Next, select the user you want to authorize and enter the password .

All of these steps create a file named on the host //hostname/my_path/ The mount point .


Linux

stay Ubuntu( Or anything else based on Debian Distribution version ) in , samba-common The bag contains SMB The server . We can use the command to install it

$ sudo apt update && sudp apt install -y samba-common

then , Edit the file /etc/samba/smb.conf, Enables us to add shares , Add a new entry , as follows :

[test_smb_mount]
  comment = smb mount test
  path = /my_path/
  read only = no
  browsable = yes
  kernel oplocks = yes

Use in instances SMB Shared mount folder

Once the host operating system can share folders , We can mount it in the instance . So , need cifs-tools package , You can install... With the following command

$ sudo apt upadte && sudo apt install -y cifs-utils

The following command line is required for the final mounting

$ sudo mount -t cifs //hostname/my_path_or_share_name mount_folder/ -o user=my_name,uid=1000

my_name Is the user of the shared folder on the host . You will be asked to enter the password in the terminal , The input is done .

This step is optional . We can do it in /etc/fstab Add a new line , Let the operating system automatically mount folders when it starts , Or at least you don't need to specify the mount name or options . The command line should look like this :

//hostname/my_path_or_share_name mount_folder/ cifs user=my_name,uid=1000 0 0

The entries in this file are separated by spaces or tabs . The first is the share name or path , The second is the directory to mount the folder , The third is the mount type , The fourth is a comma separated list of options ( add to noatuo Avoid mounting on startup ), The last two options are best left as 0.

hypothesis noauto Is specified in the options , The folder needs to be mounted in the following way

$ sudo mount mount_folder/

virtio-fs mount

If in Linux Upper use LXD Back end , We can benefit from having an excellent file system mounted , In view of the cost that the system cannot be mounted while running . Use the following command to mount the folder on the instance

$ lxc --project multipass config device add lxdinstance mount_lxd disk source=/my_path path=//mount_folder

Whereas lxdinstance Is the instance name , mount_lxd Is a device name that is attached too casually , source Share path specified , path Specifies the source file (source) The directory that needs to be mounted . Just this command , LXD Got everything done : There is no need to run the command on the instance .

virtio-fs Also in the qemu and libvirt Back end available , Although additional installation is required .


NFS mount

Linux and MacOS On the system NFS The server .


Use NFS Shared folders

MacOS

MacOS Upper NFS The server is using nfsd Orders and documents /etc/exports control . We share by adding new folders to the files , Use a line of text similar to the following :

/my_path -mapall=host_user -network 192.168.0.0 -mask=255.255.0.0

-network and -mask Control the network that the sharing can connect to . then , We use the command to start the server

$ sudo nfsd start

( Or the server is already running restart)


Linux

stay Ubuntu( Or anything else based on Debian Distribution version ), nfs-kernel-server The package contains the core that needs to be used NFS Server files . We can install it with the command

$ sudo apt update && sudo apt install -y nfs-kernel-server

Use the following command to share folders :

$ sudo exportfs *:/my_path

* Express " Export any host "; Here we can specify the host name or IP Address


Use in instances NFS Shared mount folder

We first need to use the following command to install in the instance NFS client

$ sudo apt update && sudo apt install -y nfs-common

then , We can mount the shared folder with the following command

$ sudo mount -t nfs HPST_IP:/my_path /mount_folder -o user=host_user, uid=instance_uid,gid=instance_gid

Link to the original text

How to improve mounts performance in Multipass

原网站

版权声明
本文为[But the teacher]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260435159446.html