Mount and Uninstall

Source: Internet
Author: User
Tags clear screen

First, the hardware device number in Linux
Device Device number
IDE hard disk/dev/hd[a-d] (parallel hard disk)
SCSI HDD/dev/sd[a-p] (Serial hard disk)
U disk/dev/sd[a-p]
Optical/dev/cdrom
Floppy/dev/fd[0-1]
Printer/dev/lp[0-2]
Mouse/dev/mouse
Lcd/dev/fb0
System Terminal/dev/tty0

For example:
<1> when the first USB drive is inserted, its device number is SDA1
When inserting a second USB drive, its device number is SDB1
<2> when the first hard disk is inserted, its device number is HDA1
When you insert a second hard disk, its device number is HDB1

Second, the equipment mount
Routine: Inserting a USB stick into the arm Development Board
In a Linux system, devices are mapped to device files on the upper layer, such as IDE hard disks that are mapped to device files/dev/hda1,u disks are mapped to device files/dev/ Sda1. If the user accesses these device files directly, a heap of binary code is obtained. Therefore, in order to facilitate the user's use, Linux requires that the device files must be mounted to a directory (commonly known as the/MNT directory), the user to the directory (such as the/MNT directory) operation (read/write) Is the operation of the device files, that is, the operation of the device. Of course, in practical applications, you often create a new subdirectory in the/MNT directory, such as the Hdisk (IDE hard disk), Udisk (USB stick), and then mount the device files to that subdirectory.
Step 1: Burn the appropriate file system into the ARM Development Board to support USB devices, etc.
Step 2: Insert the USB flash drive, at this time on the Arm Development Board terminal (Putty Software or HyperTerminal) will display the corresponding information of the USB flash drive, the most important is the device file name of the USB flash drive.
When you insert the first USB flash drive, the device file name of the USB flash drive is/dev/sda1.
When you insert a second USB drive, the device file name of the USB flash drive is/dev/sdb1.
Step 3: Enter the command under Putty Software (or HyperTerminal):
[[email protected]/] #cd/mnt
[[email protected] mnt] #mkdir udisk
This creates a new subdirectory Udisk under the/mnt directory.
Note that entering commands under the Putty software (or HyperTerminal) is done on the ARM board, This is the operation of the file system in the ARM Development Board. Remember not to operate under a Linux virtual machine. Since the USB drive is now mounted on the arm board instead of the Linux virtual machine, the ARM Development Board must be operated on.
Step 4: Enter the command under Putty Software (or HyperTerminal):
[[email protected]/] #mount-t-vfat/dev/sda1/mnt/udisk
In this way, the device file/dev/sda1 of the USB flash drive is mounted to the/mnt/udisk directory of the ARM Development Board and mounted in fat format. When the user needs to access the USB stick, it can be achieved by/mnt/udisk the file.
Note that the USB drive uses the FAT format file system more.
Step 5: Enter the command under Putty Software (or HyperTerminal):
[[email protected] udisk] #cd.
This exits the Udisk directory.
[[email protected] udisk] #umount/mnt/udisk
This will successfully uninstall the USB flash drive (before uninstalling the USB stick, you need to exit the/mnt/udisk directory).

Iii. Mounting of documents
Routines: Mount the/home/lishuai directory of a Linux virtual machine under the/mnt/arm_linux file of an arm system
Step 1: Burn the appropriate file system into the arm Development Board.
Step 2: Establish an NFS server on the Linux virtual machine and use the/home/lishuai directory as the shared directory, and set the host IP address to 192.168.0.*.
Step 3:<1> The IP address is set by the Ifconfig command on the Linux virtual machine Terminal: 192.168.0.20, and the IP address is queried through the ifconfig command.
<2> set the IP address in the Windows Network Place to: 192.168.0.40, and query the IP address through the "Run >cmd>ipconfig" command.
<3> set the ARM board IP address on Putty software or HyperTerminal via ifconfig command: 192.168.0.60, subnet mask 255.255.255.0 (#ifconfig eth0 192.168.0.60 netmask 255.255.255.0) and query the IP address via the ifconfig eth0 command.
In this way, Windows, Linux virtual machines, and arm development boards are on the same network segment.
Step 4: Enter the command on the Putty Software or HyperTerminal:
#ping 192.168.0.20//See if the ARM board can ping Linux hosts
#ping 192.168.0.40//View ARM Development Board can ping through windows
Step 5: Enter the command on the Putty Software or HyperTerminal:
[[email protected]/] #cd/mnt
[[email protected] mnt] #mkdir arm_linux
This creates a new subdirectory arm_linux under/MNT in the file system of the arm Development Board.
Step 6: Enter the command on the Putty Software or HyperTerminal:
#mount-O nolock,wsize=1024,rsize=1024 192.168.0.20:/home/lishuai/mnt/arm_linux

This mounts the/home/lishuai under the IP address 192.168.0.20 (Linux virtual machine) to the/mnt/arm_linux directory (ARM system).
Comments:
<1> if the above Mount command is entered on the Putty software or HyperTerminal, the user is operating on the arm system. Since the file system has been burned into the arm,/MNT/ARM_ Linux is a directory of file systems within arm. Therefore, when the user executes the command, it means to mount the/home/lishuai with the IP address 192.168.0.20 to the (arm system)/mnt/arm_ Linux directory. Therefore, when the user needs to operate the/home/lishuai directory of the Linux virtual machine under the ARM system, the operation of the/mnt/arm_linux directory can be done directly.
At this point, enter the command on the Putty Software or HyperTerminal: #cd/home, but cannot find the Lishuai directory because the CD command is executed on Putty software or HyperTerminal. is access to the arm system. Instead of accessing the Linux host, the Lishuai directory is not necessarily available in the/home directory, although the arm system has been burned into the file system.
<2> If you enter the above Mount command on the terminal of a Linux virtual machine, it indicates that the user is operating on the Linux host. Of course, there is a corresponding file system in the Linux host./mnt/arm_ Linux is a directory of Linux hosts. Therefore, when the user executes the command, the/home/lishuai with IP address 192.168.0.20 is mounted to the Linux host/mnt/arm_ Linux directory. Therefore, when the user needs to operate the/home/lishuai directory of the device with IP address 192.168.0.20 under the Linux host, the operation of the/mnt/arm_linux directory can be done directly.
As can be seen from the above description, the objects executed are different, and the implementation of the mount purposes is different.

Iv. integrated implementation of equipment mounting and file mounting
Routine: Placing a file under Windows into a USB flash drive via the ARM Development Board
Step 1: Put the file hehe.txt under Windows into the shared directory/home/lishuai (Linux and Windows) via the Samba server.
Step 2: Mount the/home/lishuai directory of the Linux host to the/mnt/arm_linux directory on the ARM board through the NFS server.
Enter the command on the Putty Software or HyperTerminal:
#mount-O nolock,wsize=1024,rsize=1024 192.168.0.20:/home/lishuai/mnt/arm_linux
Step 3: Mount the USB drive to the/mnt/udisk directory on the arm Development Board.
Enter the command on the Putty Software or HyperTerminal:
#mount-T-vfat/dev/sda1/mnt/udisk
Step 4: Enter the command on the Putty Software or HyperTerminal:
#cd/mnt/udisk
#cp: /arm_linux/hehe.txt./
This makes it possible to put a file under Windows into the USB drive via the ARM Development Board.
Step 5: Uninstall the/home/lishuai directory of the USB flash drive and Linux virtual machine.
Enter the command on the Putty Software or HyperTerminal:
[[email protected] udisk] #cd.
[[email protected] mnt] #umount/mnt/arm_linux
[[email protected] mnt] #umount/mnt/udisk Five, device number of alternative applications
1. Configure the Linux host IP address: 192.168.220.54
2. Configuring the ARM board IP address: 192.168.220.1
3. Configure the IP address of Windows: 192.168.220.55
4. Under Putty Software or HyperTerminal: #ping 192.168.220.54
5. Attach the/home/lishuai directory of the Linux host to the/mnt/arm_linux directory on the ARM board:
#mount-O Nolock,wsize=1024,rsize=1024192.168.220.54:/home/lishuai/mnt/arm_linux
6. Create the HEHE.C source code in the/home/lishuai directory of the Linux host.
#vim hehe.c
#include <stdio.h>
int main (void)
{
printf ("Hello embeded!/n");
return 0;
}
7. Use ARM-LINUX-GCC to compile hehe.c in the/home/lishuai directory of the Linux host (the ARM-LINUX-GCC compiler must be used to run on the arm platform).
#arm-LINUX-GCC Hehe.c-o Hehe.arm
After the compilation succeeds, a hehe.arm executable file is created in the/mnt/arm_linux directory under the Putty software or HyperTerminal. As a result, the/home/lishuai of the Linux host and the/mnt/arm_ of the arm Development Board The Linux directory is updated synchronously.
8. Under Putty Software or HyperTerminal:
#./hehe.arm >/dev/tty0//print Hehe.arm execution results to LCD
#clear >/dev/tty0//Clear screen
#ls >/dev/tty0//will display the files and directories under the current path (/mnt/arm_linux)

Attention!!! (1) Usually write these redirects to the LCD, which is written to tty0, not fb0. (2) When using NFS to implement file mounts, the following points must be guaranteed.
The NFS server for the <1>linux host is in normal use.
If there is a problem, you can restart the server by instruction: #service NFS Restart
or query Server Status: #service NFS Status
The IP address of the <2>windows, Linux host, and arm Development Board is within the same network segment, and the other two devices can be ping through the arm Development Board. Because file mounts are implemented over the network.      (3) in the actual embedded development, it is often impossible to attach a directory of Linux hosts to the arm Development Board, you can start from the following three aspects: <1> because this mount depends on the NFS server, you can query the status of the NFS server, or restart the NFS server. #service NFS Restart #service NFS Status <2> Reconfigure the IP address of the Linux virtual machine. This mount is based on the arm boards, Linux hosts, and Windows NICs on the same network segment, sometimes pinging each other   But cannot be mounted.      <3> enter commands within the Linux host to see if the Linux host can mount itself. #ifconfig eth0 192.168.0.50 #mount-o nolock 192.168.0.50:/home/lishuai/mnt//mount the/home/lishuai directory of the Linux host to the native/MN Under the T directory

Mount and Uninstall

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.