Detailed description of Mount usage

Source: Internet
Author: User
Tags gz file
Like windows, the application software can be installed from a CD or floppy disk in Linux. However, the difference is that it needs to use the command mount to log on to the optical drive and the soft drive. In addition, most of the software is compressed, so you still need to know how to decompress it. Finally, it must be configured and compiled to run. The following is an introduction in four aspects:

1. Mount Logon  
The Linux drive device is represented by a special file/dev/fd0 and the file system is msdos. Therefore, use the following command to log on and read the content of the floppy disk:
# Mount-T msdos/dev/fd0/mnt/floppy
# Cd/mnt/floppy
Similarly, type the following command to read the disc:
# Mount-T iso9660/dev/HDC/mnt/CDROM
# Cd/mnt/CDROM
Then, run the CP command to copy the required software to the system.
Exit the software drive and use the umount command for the optical drive. Note: you cannot use this command in its directory, but should first CD to another directory before using: umount/mnt/CDROM

Ii. Install software 
Pin-to-link Software generally ends with .gzor .tarw..tar.gz. The former is compressed by gzip, and the latter is archived by tar and compressed by gzip.
1. Use the command gzip-D filenameto decompress the compressed file ending with .gz. The obtained file is in the current directory, but it has no. GZ file.
2. Run the tar-xvf filenamecommand to create an archive file ending with .tar. The generated file is in the same directory as the source file, and only .tar is missing.
3rd files ending with .tar.gz are the most common and can be directly installed with the command: gzip-CD filename | tar xfv. (You can also use this command to decompress: tar-zxvf filename.) In general, the first item of this type of files is a directory. Therefore, this directory will be created when the preceding command is used, and store all files in this directory. In special cases, run tar-tvf filename | more to view the first object. If it is not a directory, create a directory first, store the file under this directory, and run the command tar-xvf filename to install the file. After the preceding steps, files such as readme and install are generated. Use VI to carefully read the relevant parts of these files,
Configuration is more specific. The general steps are: (1)./config, (2) make install, (3) make. The main change is in the first step. parameters are required later. You can see that you can use the command to select./config -- help.

    
Iii. Example of practice: Installation of Apache (Web Server) and php3
  
Download the Linux software apache.tar.gz?php3.tar.gz from the Internet.
1. Because apache.tar.gz is greater than 1.44 m, you can use msdos of securecrt to log on to Linux using the Telnet command and upload it through put.
2. Place the two software under the/usr/src directory and run the gzip-CD apache.tar.gz(php3.tar.gz) | tar-xvf command to install the software. This will see two directories: apache_1.3.6 and php-3.0.7.
3. Under the first directory, you will see the most important files: readme and install. If it is in the GUI, you can open two xterms, one for careful reading, and the other for configuration according to the prompts of the file. 4. In the second directory, you will soon find the files: Install, install. DSO, and readme. QNX. Steps are similar to 3. Because these two files are correlated, you must configure the former.
5. After configuration, enter/apache_1.3.6/CONF/httpd. conf. In the file, understand its comments, delete or add some options before "#". After saving the file, run the command/usr/src/apache_1.3.6/bin/apachectl start to open the HTTP service and then browse the Web page in Netscape Communication.

Iv. File System metadata
Linux is an excellent open-source operating system, which can run on various computer systems, from large to small, with the increasingly mature and stable Linux system and its unique advantages of open source code, Linux has been widely used in the world. Nowadays, many enterprise computer systems are a hybrid system consisting of UNIX, Linux, and Windows systems. Data Exchange is often required between different systems. Next, based on my actual work experience, I will introduce how to mount a CD image file, a mobile hard disk, a USB flash disk, Windows network sharing, and Unix NFS network sharing in Linux.

Mount command)
First, we will introduce how to use the mount command. The mount command has many parameters. Here we will focus on what we will use today.
Command Format: Mount [-T vfstype] [-O options] device dir
Where:
1.-T vfstype specifies the type of the file system, which is usually not required. Mount automatically selects the correct type.

Common types include:
CD or CD image: iso9660
DOS fat16 File System: msdos
Windows 9x FAT32 File System: vfat
Windows nt ntfs file system: NTFS
Mount Windows File network sharing: smbfs
Network Sharing for Unix (Linux) files: NFS
2.-O options is used to describe the mounting method of a device or file.
Common parameters include:
Loop: used to connect a file to the system as a hard disk partition.
RO: mounting a device in read-only mode
RW: mounting a device in read/write mode
Iocharset: Specifies the character set used to access the file system
3. the device to be mounted.
4. mount point of the Dir device on the system ).
  
Attach a CD image file  
Thanks to the huge advances in disk technology in recent years, new computer systems are equipped with large-capacity disk systems. In Windows, many people are used to making software and materials into disc image files and using virtual optical drives. Doing so has many advantages:

(1) reduces the wear and tear of the optical drive;
(2) Currently, it is not a problem to store dozens of CD image files with a huge hard disk capacity, and it is very convenient to use as needed;
(3) The read speed of the hard disk is much higher than the read speed of the disc, and the CPU usage is greatly reduced.

In fact, it is more convenient to create and use a CD image in a Linux system than in a Windows system. You do not have to borrow any third-party software package.
1. Create a CD image file from the CD.
Put the CD in the optical drive and execute the following command.

# Cp/dev/CDROM/home/sunky/mydisk. ISO or # dd If =/dev/CDROM of =/home/sunky/mydisk. ISO
Note: execute any of the above commands to make the current optical drive into a CD image file/home/sunky/mydisk. ISO 2, and make the files and directories into a CD image file.
Run the following command.
# Mkisofs-r-J-V mydisk-o/home/sunky/mydisk. ISO/home/sunky/mydir
Note: This command creates all directories and files under the/home/sunky/mydir Directory into a CD file/home/sunky/mydisk. ISO, the disc size is: mydisk 3, the attachment of the disc image file (Mount)
# Mkdir/mnt/vcdrom Note: create a directory for mount point)
# Mount-o loop-T iso9660/home/sunky/mydisk. ISO/mnt/vcdrom Note: Use/mnt/vcdrom to access the disk image file mydisk. all the files in ISO.

Mount a mobile hard drive 
For Linux systems, mobile hard disks with USB interfaces are treated as SCSI devices. Before inserting a mobile hard disk, use fdisk-l or more/proc/partitions to view the system's hard disk and hard disk partition.

[Root @ pldyrouter/] # fdisk-l

Disk/dev/SDA: 73.4 GB, 73407820800 bytes

255 heads, 63 sectors/track, 8924 cylinders Units = cylinders of 16065*512 = 8225280 bytes device boot start end blocks ID system/dev/sda1 1 4 32098 + de Dell utility/dev/sda2 * 5 2554 20482875 7 HPFs /NTFS/dev/sda3 2555 7904 42973875 83 Linux/dev/sda4 7905 8924 8193150 F Win95 ext 'd (LBA) /dev/sda5 7905 8924 8193118 + 82 Linux swap
Here we can clearly see that the system has a SCSI hard disk/dev/SDA and its four Disk Partitions/dev/sda1 --/dev/sda4, /dev/sda5 is the logical partition of/dev/sda4. After the mobile hard disk is connected, use fdisk-l or more/proc/partitions to view the hard disk and hard disk partition of the system.

[Root @ pldyrouter/] # fdisk-l
Disk/dev/SDA: 73.4 GB, 73407820800 bytes 255 heads, 63 sectors/track, 8924 cylinders Units = cylinders of 16065*512 = 8225280 bytes device boot start end blocks ID system/dev/sda1 1 4 32098 + de Dell utility/dev/sda2 * 5 2554 20482875 7 HPFs /NTFS/dev/sda3 2555 7904 42973875 83

Linux/dev/sda4 7905 8924 8193150 F Win95 ext 'd (LBA)

/Dev/sda5 7905 8924 8193118 + 82 Linux swap
Disk/dev/SDC: 40.0 GB, 40007761920 bytes 255 heads, 63 sectors/track, 4864 cylinders Units = cylinders of 16065*512 = 8225280 bytes device boot start end blocks ID system/dev/sdc1 1 510 4096543 + 7 HPFs/NTFS/dev/sdc2 511 4864 34973505 F Win95 EXT 'd (LBA) /dev/sdc5 511 4864 34973473 + B Win95 FAT32
We should be able to find one SCSI hard disk/dev/SDC and two other disk partitions/dev/sdc1 and/dev/sdc2, /dev/sdc5 is the logical partition of the/dev/sdc2 partition. We can use the following command to mount/dev/sdc1 and/dev/sdc5.
# Mkdir-P/mnt/usbhd1
# Mkdir-P/mnt/usbhd2 Note: create a directory for mount point)
# Mount-t ntfs/dev/sdc1/mnt/usbhd1
# Mount-T vfat/dev/sdc5/mnt/usbhd2 Note: The-t ntfs parameter should be used for NTFs-format disk partitions, the-T vfat parameter should be used for Disk Partitions In the FAT32 format. If the Chinese character file name is garbled or not displayed, you can use the following command format.
# Mount-t ntfs-O iocharset = cp936/dev/sdc1/mnt/usbhd1
# Mount-T vfat-O iocharset = cp936/dev/sdc5/mnt/usbhd2 use the fdisk partition command and The mkfs file system creation command in Linux to create partitions on a mobile hard disk as Linux ext2 and ext3 formats specific to the system. In this way, it is more convenient to use in Linux. Use the following command to directly mount the file.
# Mount/dev/sdc1/mnt/usbhd1

Mount a USB flash drive 
Like a USB-based mobile hard drive, USB flash drives are also treated as SCSI devices for Linux systems. The usage is exactly the same as that of a mobile hard disk. Before inserting a USB flash drive, use fdisk-l or more/proc/partitions to view the hard disk and hard disk partition of the system.
[Root @ pldyrouter root] # fdisk-l

Disk/dev/SDA: 73.4 GB, 73407820800 bytes

255 heads, 63 sectors/track, 8924 cylinders Units = cylinders of 16065*512 = 8225280 bytes device boot start end blocks ID system/dev/sda1 1 4 32098 + de Dell utility/dev/sda2 * 5 2554 20482875 7 HPFs /NTFS/dev/sda3 2555 7904 42973875 83 Linux/dev/sda4 7905 8924 8193150 F Win95 ext 'd (LBA) /dev/sda5 7905 8924 8193118 + 82 Linux swap
After the USB flash drive is inserted, use fdisk-l or more/proc/partitions to view the hard disk and hard disk partition of the system. [Root @ pldyrouter root] # fdisk-l
Disk/dev/SDA: 73.4 GB, 73407820800 bytes 255 heads, 63 sectors/track, 8924 cylinders Units = cylinders of 16065*512 = 8225280 bytes device boot start end blocks ID system/dev/sda1 1 4 32098 + de Dell utility/dev/sda2 * 5 2554 20482875 7 HPFs /NTFS/dev/sda3 2555 7904 42973875 83 Linux/dev/sda4 7905 8924 8193150 F Win95 ext 'd (LBA) /dev/sda5 7905 8924 8193118 + 82 Linux swap [root @ pldyrouter root] # fdisk-ldisk/dev/SDD: 131 MB, 131072000 bytes 9 heads, 32 sectors/track, 888 cylinders Units = cylinders of 288*512 = 147456 bytes device boot start end blocks ID system/dev/sdd1 * 1 889 127983 + B Win95 FAT32 partition 1 has different physical/logical endings: phys = (1000, 8, 32) logical = (888, 7, 31)
The system has a SCSI hard disk/dev/SDD and a disk partition/dev/sdd1./dev/sdd1 is the USB flash drive to be attached.
# Mkdir-P/mnt/USB Note: create a directory for mount point)
# Mount-T vfat/dev/sdd1/mnt/USB Note: You can now access the USB flash disk through/mnt/USB,
If the Chinese character file name is garbled or not displayed, use the following command.
# Mount-T vfat-O iocharset = cp936/dev/sdd1/mnt/USB

Mount Windows File Sharing  
The core of Windows Network Sharing is SMB/CIFS. To mount Windows disk sharing in Linux, you must install and use the samba software package. Currently, most popular Linux distributions already contain Samba packages. If Samba is not installed on Linux, install Samba first. You can also download the Samba package at www.samba.org. The latest version is 3.0.10. After windows sharing is configured, you can mount the file on the Linux client as follows:
 
# Mkdir-P/mnt/samba Note: create a directory for mount point)
# Mount-T smbfs-O username = Administrator Password = pldy123 // 10.140.133.23/C $/mnt/samba Note: Administrator and pldy123 are the usernames and passwords of Windows computers whose IP addresses are 10.140.133.23, C $ is a disk shared by this computer so that files on Windows disks can be accessed through/mnt/samba on Linux. The preceding operations are successfully performed in RedHat as Server 3, redflag Server 4.1, Suse Server 9, Windows NT 4.0, Windows 2000, Windows XP, and Windows 2003 environments.

Mount nfs file sharing in UNIX systems 
Similar to Windows Network Sharing, Unix (Linux) systems also have their own network sharing, that is, NFS (Network File System ), next we will take Sun solaris2.8 and RedHat as Server 3 as an example to briefly introduce how to mount nfs network sharing in Linux.
Before mounting an NFS disk to a Linux client, you must configure the NFS server.
1. Configure the NFS server of the Solaris system as follows:
(1) Modify/etc/dfs/dfstab and add the shared directory: Share-F nfs-o rw/export/home/share.
(2) Start the NFS service: #/etc/init. d/nfs. Server start
(3) After the NFS service is started, you can also use the following command to add a new share: # Share/export/home/share1 # Share/export/home/share2 note: /export/home/share and/export/home/share1 are the directories to be shared. 2. Configure NFS server in Linux as follows:
(1) Modify/etc/exports to add a shared directory.
/Export/home/share 10.140.133.23 (RW)
/Export/home/share1 * (RW)
/Export/home/share2 Linux-client (RW)

Note: Share, share1, and share2 in the/export/home/directory are the directories for sharing, 10.140.133.23, *, and Linux-client are IP addresses or host names allowed to connect to the shared Linux client. If you want to use the host name Linux-client, you must add the Linux-client host IP definition to the server host/etc/hosts file: Format: 10.140.133.23 Linux-client (2) start and Stop the NFS service
/Etc/rc. d/init. d/Portmap start (Portmap is started by default in RedHat)
/Etc/rc. d/init. d/nfs start the NFS service
/Etc/rc. d/init. d/nfs Stop NFS service note: if a new share is added to the/etc/export file, stop the NFS service and then start the NFS service to enable the new share. The command exportfs-RV can also achieve the same effect. 3. Mount the NFS share of other Linux or Unix systems on the Linux Client
# Mkdir-P/mnt/nfs Note: create a directory for mount point)
# Mount-T nfs-o rw 10.140.133.9:/export/home/share/mnt/nfs Note: here we assume 10.140.133.9 is the Host IP address of the NFS server. Of course, the host name can also be used here, however, the server IP definition must be added to the local/etc/hosts file. /Export/home/share is the directory shared by the server. In this way, you can use/mnt/NFS on the Linux client to access files shared by NFS on other Linux or UNIX systems. The preceding operations are performed on Redhat as Server 3, redflag server4.1, Suse Server 9, Solaris 7, Solaris 8, and Solaris 9
The test is successful in the x86 & iSCSI environment.

After Samba is installed in Linux, accessing files in Linux in Windows is very simple as accessing other Windows computers on the LAN. However, if Linux wants to access windows resources on the LAN, it is not that easy. In fact, as long as you know how to operate, in fact, to access data in Windows in Linux, it is also very simple, just use the following command:
Mount-T smbfs-O username = STI Password = Sti // Terminal/software/home1/tournet/soft_bk

// Terminal/software indicates the software shared directory under the terminal host. /Home1/tournet/soft_bk indicates the directory in the local Linux. After this command is executed, the content in the Software Directory is mounted to the local/home1/tournet/soft_bk directory. Now you need to operate the Software Directory under terminal on the Windows machine, it is actually the local/home1/tournet/soft_bk directory.

From: http://hi.baidu.com/tintua/blog/item/6fc5f40c9a8fa2d13ac763b5.html

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.