The arm linux board of Linux and ubuntu use nfs for mount mounting for simple arrangement of file transfer

The arm linux board of Linux and ubuntu use nfs for mount mounting for simple arrangement of file transfer

Table of contents

The arm linux board of Linux and ubuntu use nfs for mount mounting for simple arrangement of file transfer

1. Brief introduction

2. Installation and configuration of nfs on Ubuntu

 3. Mount the corresponding Ubuntu nfs file directory on the arm board to realize folder mounting and transfer files

 Appendix: A brief description of the mount command


1. Brief introduction

Organize some knowledge developed by Linux/ Ubuntu , so that you can consult and use it in time when you encounter similar problems later.

This section introduces how arm linux and ubuntu use nfs for mount and file transfer. If there are deficiencies, welcome to point out, or if you have a better method, please leave a message.

NFS is an application based on the UDP/IP protocol. Its implementation mainly uses the remote procedure call RPC mechanism. RPC provides a set of operations for accessing remote files that are independent of machines, operating systems, and low-level transfer protocols. RPC uses XDR support. XDR is a machine-independent data description encoding protocol. It encodes and decodes data transmitted over the Internet in a format independent of any machine architecture, and supports data transmission between heterogeneous systems.

Operating environment:

  • Ubuntu 18.04
  • arm board STM32MP157

2. Installation and configuration of nfs on Ubuntu

1. Install nfs and rpcbind

命令:sudo apt-get install nfs-kernel-server rpcbind

As shown in the figure is because it has been installed, so as shown in the figure

 2. Create a folder for the folder bound by nfs

It doesn’t have to be called nfs, other names are fine, command: mkdir nfs

3. Open /etc/exports for related configuration, and bind the previously created folder to the settings

Command: sudo vi /etc/exports

Content (fill in the path according to your actual path): /home/qinxk8/linux/nfs *(rw,sync,no_root_squash)

 4. After modifying the configuration and saving it, restart the nfs service

Command: sudo /etc/init.d/nfs-kernel-server restart

 3. Mount the corresponding Ubuntu nfs file directory on the arm board to realize folder mounting and transfer files

1. First turn on the arm board, and then make sure that the arm board and Ubuntu are connected to the same network segment

Command: ifconfig

 

2. Ping the ip of Ubuntu on the arm board to ensure that it can be pinged

3. Mount the nfs folder corresponding to Ubuntu on the arm board

No error is reported, indicating that there is no problem with the mount. Command: mount -t nfs -o vers=3 192.168.54.200:/home/qinxk8/linux/nfs /mnt

 4. Add a file on Ubuntu as a test

Command: touch test_nfs.txt

 5. Use the cp command on the arm board to copy the Ubuntu files to the arm board

Command: cp /mnt/test_nfs.txt ./

/mnt is the directory folder where the Ubuntu nfs folder was mounted before, and test_nfs.txt is the file in the Ubuntu nfs folder

 

 Appendix: A brief description of the mount command

The Linux mount command is a frequently used command, which is used to mount files outside the Linux system.

1. Form of use:

mount [-hV]
mount -a [-fFnrsvw] [-t vfstype]
mount [-fnrsvw] [-o options [,...]] device | dir
mount [-fnrsvw] [-t vfstype] [-o options] device dir

2. Parameter description

  • -V: display program version
  • -h: display auxiliary information
  • -v: Display more information, usually used with -f for debugging.
  • -a: Mount all file systems defined in /etc/fstab.
  • -F: This command is usually used together with -a, it will generate a trip for each mount action to be responsible for execution. When the system needs to mount a large number of NFS file systems, it can speed up the mount action.
  • -f: Usually used for debugging purposes. It will cause mount not to perform the actual mount action, but to simulate the entire mount process. Usually used with -v.
  • -n: Generally speaking, mount will write a piece of data in /etc/mtab after mounting. However, this option can be used to cancel this action when there is no writable file system in the system.
  • -sr: equal to -o ro
  • -w: equal to -o rw
  • -L: Mount the hard disk partition with a specific label.
  • -U: Hang up the file system with the file partition sequence number as. -L and -U must be meaningful when a file such as /proc/partition exists.
  • -t: Specifies the type of file system, usually not necessary. mount will automatically choose the correct type.
  • -o async: Open asynchronous mode, all file read and write actions will be executed in asynchronous mode.
  • -o sync: Execute in synchronous mode.
  • -o atime, -o noatime: When atime is turned on, the system will update the "last call time" of the file every time it reads the file. When we use the flash file system, we may choose to turn off this option to reduce the number of writes.
  • -o auto, -o noauto: Turn on/off the automatic hangup mode.
  • -o defaults: Use default options rw, suid, dev, exec, auto, nouser, and async.
  • -o dev, -o nodev -o exec, -o noexec allow executable files to be executed.
  • -o suid, -o nosuid:
  • Allow executable files to be executed with root privileges.
  • -o user, -o nouser: users can perform mount/umount actions.
  • -o remount: Remount a file system that has been suspended in a different way. For example, the system that was originally read-only is now remounted in read-write mode.
  • -o ro: Mount in read-only mode.
  • -o rw: mount in read-write mode.
  • -o loop=: Use the loop mode to split a file into the system as a hard disk.

3. Examples

1) Hang /dev/hda1 under /mnt

mount /dev/hda1 /mnt

2) Mount 192.168.54.200:/home/qinxk8/linux/nfs to /mnt via nfs

mount -t nfs -o vers=3 192.168.54.200:/home/qinxk8/linux/nfs /mnt

Guess you like

Origin blog.csdn.net/u014361280/article/details/128094222