In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Linux system mount command mount how to use, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
In the Linux system, if you want to mount a partition to a folder, you can use the mount command. After mounting, you will change the partition and directory practice. Later, as long as you access the folder, you can access the changed partition.
Hook command (mount)
First of all, let's introduce the use of the mount command. There are a lot of parameters for the mount command. Here we will mainly talk about what we are going to use today.
Command format: mount [- t vfstype] [- o options] device dir1,-t vfstype specify the type of file system, which is usually not required. Mount will automatically select the correct type.
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 share: smbfs UNIX (LINUX) file network share: nfs2,-o options are mainly used to describe the connection mode of the device or file.
Loop: used to mount a file as a hard disk partition to the system ro: read-only mount device rw: read-write mount device iocharset: specify the character set used to access the file system 3, device to mount (mount) to the device. 4. The mounting point (mount point) of the dir device on the system.
Hang the CD image file
1. Make a CD image file from the CD. Put the CD in the CD 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 CD in the current CD drive into a CD image file / home/sunky/mydisk.iso
2. Make the files and directories into CD-ROM image files and execute the following command.
# mkisofs-r-J-V mydisk-o / home/sunky/mydisk.iso / home/sunky/mydir Note: this command makes all directories and files in the / home/sunky/mydir directory into a CD image file / home/sunky/mydisk.iso. The CD volume is labeled: mydisk.
3. Mount of CD image files.
# mkdir / mnt/vcdrom Note: create a directory to use as mount point
# mount-o loop-t iso9660 / home/sunky/mydisk.iso / mnt/vcdrom Note: use / mnt/vcdrom to access all the files in the CD image file mydisk.iso.
Attach a removable hard disk
For linux systems, the removable hard disk with USB interface is treated as a SCSI device. Before inserting a removable hard drive, use fdisk-l or more / proc/partitions to check the hard drive and hard disk partitions of the system.
[root at pldyrouter /] # fdisk-l connect the removable hard drive, then use fdisk-l or more. / proc/partitions check the hard disk and hard disk partition of the system, you should find that there is an extra SCSI hard disk / dev/sdc and its two disk partitions / dev/sdc1, / dev/sdc2, where / dev/sdc5 is the logical partition of / 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 mounting point (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 disk partitions in ntfs format and-t vfat parameter should be used for disk partitions in fat32 format. If the Chinese character file name is displayed as 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/usbhd2linux system uses the fdisk partition command and the mkfs file system creation command to make the partition of the mobile hard disk into the ext2 and ext3 format unique to the linux system. In this way, it is more convenient to use under linux. Just hang up directly using the following command.
# mount / dev/sdc1 / mnt/usbhd1 mounting USB disk
Like the removable hard disk with USB interface, U disk is also treated as SCSI device for linux system. Use it in exactly the same way as a mobile hard drive. Before inserting a USB drive, use fdisk-l or more / proc/partitions to check the hard drive and hard disk partition of the system.
[root at pldyrouter root] # fdisk-l is inserted into the USB disk, and then use fdisk-l or more / proc/partitions to check the hard drive and hard disk partition of the system.
[root at pldyrouter root] # fdisk-l system with a SCSI hard drive / dev/sdd and a disk partition / dev/sdd1,/dev/sdd1 is the USB disk we want to attach.
# mkdir-p / mnt/usb Note: create a directory to use as mount point
# mount-t vfat / dev/sdd1 / mnt/usb Note: U disk can now be accessed through / mnt/usb. If the Chinese character file name is garbled or not, you can use the following command.
# mount-t vfat-o iocharset=cp936 / dev/sdd1 / mnt/usb mount Windows file share
The core of Windows network sharing is SMB/CIFS. If you want to mount windows disk sharing under linux, you must install and use samba software package. The vast majority of popular linux distributions already contain samba packages, so install samba first if you don't have samba installed when you install linux. Of course, you can also download the new version 3.0.10 from the www.samba.org website. When the windows system share is set up, you can mount (mount) on the linux client, as shown below:
# mkdir-p / mnt/samba Note: create a directory to use as mount point
# mount-t smbfs-o username=administrator,password=pldy123 / / 10.140.133.23 administrator / mnt/samba Note: administrator and pldy123 are a username and password for a computer with an ip address of 10.140.133.23, and c $is a disk share on this computer. This makes it possible to access the files on the windows system disk through / mnt/samba on the linux system. The above operations have been tested in redhat as server3, redflag server 4.1and suse server 9, as well as windows NT 4.0,windows 2000, windowsxp and windows 2003.
Hook up UNIX system NFS file sharing
Similar to windows network sharing, UNIX (Linux) system also has its own network sharing, that is, NFS (network file system). Let's take SUN Solaris2.8 and REDHAT as server 3 as examples to briefly introduce how to mount nfs network sharing under linux. Before the linux client mounts (mount) the NFS disk share, the NFS server must be configured.
1. The configuration method for NFS server of Solaris system is as follows:
(1) modify / etc/dfs/dfstab to add a shared directory
Share-F nfs-o rw / export/home/sunky (2) start the nfs service
# / etc/init.d/nfs.server start (3) after the NFS service starts, you can also use the following command to add new shares
# share / export/home/sunky1 # share / export/home/sunky2 Note: / export/home/sunky and / export/home/sunky1 are directories to be shared
2. The configuration method for NFS server of linux system is as follows:
(1) modify / etc/exports to add a shared directory
/ export/home/sunky 10.140.133.23 (rw) / export/home/sunky1 * (rw) / export/home/sunky2 linux-client (rw) Note: sunky, sunky1, sunky2 in the / export/home/ directory are the directories to be shared, and 10.140.133.23, *, linux-client are the IP addresses or hostnames that are allowed to mount this shared linux client. If you want to use the hostname linux-client, you must add the linux-client host ip definition to the server host / etc/hosts file. The format is as follows:
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 starts the NFS service / etc/rc.d/init.d/nfs stop stops the NFS service Note: if you modify the / etc/export file to add a new share, you should stop the NFS service before starting the NFS service for the newly added share to work. The same effect can be achieved with the command exportfs-rv.
3. Linux client hook-up (mount) NFS sharing of other linux systems or UNIX systems
# mkdir-p / mnt/nfs Note: create a directory to use as mount point
# mount-t nfs-o rw 10.140.133.9:/export/home/sunky / mnt/nfs Note: here we assume that 10.140.133.9 is the host IP address of the NFS server. Of course, the hostname can also be used here, but the server ip definition must be added in the local / etc/hosts file. / export/home/sunky is the directory shared by the server. In this way, files shared by other linux systems or UNIX systems can be accessed through / mnt/nfs on the linux client. The above operations have been tested in redhat as server 3, redflag server4.1, suse server 9 and Solaris 7, Solaris 8, Solaris 9 for x86&sparc environments.
Add:
Linux load optical drive: (1) before using the optical drive, mount:
# mount / dev/cdrom / mnt/cdrom then you can go to the / mnt/cdrom directory to read the contents of the CD. (2) when you want to exit the CD, you must use the umout command, otherwise the CD drive will remain deadlocked:
# umount / mnt/cdrom what is the Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-tasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.