The most basic commands in the Linux mount command

Source: Internet
Author: User

The features of Linux mount command system can be used as a Linux mount command for computer science in colleges and universities, as well as an open-source Linux mount Command System enthusiast and a Linux mount command system user.

I. Basic Linux mount commands;

1. Command fdisk-l for viewing disk partitions;
For example, [root @ localhost beinan] #/sbin/fdisk-l
Disk/dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

 
 
  1. Device Boot      Start         End      Blocks   Id  System  
  2. /dev/hda1   *           1         765     6144831    7  HPFS/NTFS  
  3. /dev/hda2             766        2805    16386300    c  W95 FAT32 (LBA)  
  4. /dev/hda3            2806        7751    39728745    5  Extended  
  5. /dev/hda5            2806        3825     8193118+  83  Linux  
  6. /dev/hda6            3826        5100    10241406   83  Linux  
  7. /dev/hda7            5101        5198      787153+  82  Linux swap / Solaris  
  8. /dev/hda8            5199        6657    11719386   83  Linux  
  9. /dev/hda9            6658        7751     8787523+  83  Linux 

Through the above, we can know that/dev/hda1 is in NTFS format;/dev/hda2 is in FAT32 format;

2. Linux mount command;

Is the mount command for Disk Partitions. If the kernel supports this, the Linux mount command can mount almost all file systems, such as reiserfs; ext2; ext3; ntfs; fat32; jfs; in Linux, we usually use reiserfs, ext3, and ext3. in Windows, we mainly use NTFS, FAT32, and FAT; linux mount command:

Linux mount command-t file format-o option parameter disk partition mount point directory name this may not be clear to new users, what is the file format, what is the mount point directory name, if we want to load a partition to Linux, do we have to store it somewhere? For example, Mount/dev/hda1 to the/mnt/winc directory. First, check whether winc exists in the/mnt directory. If there is no winc, create one; of course, the directory name of the mount point should be named by yourself. It is best to use English. The example is later, just let the novice man know this;

3. Linux mount command for df-lh disk usage; this is important;

 
 
  1. [Root @ localhost beinan] # df-lh
  2. Filesystem capacity in use available % mount point
  3. /Dev/hda8 11G 5.9G 4.5G 57%/
  4. /Dev/shm 236 M 0 236 M 0%/dev/shm
  5. /Dev/hda1 5.9G 3.2G 2.7G 55%/mnt/winc
  6. /Dev/hda2 16g 8.1G 7.7G 52%/mnt/wind
  7. /Dev/hda5 7.9G 5.8G 2.1G 74%/mnt/slack

4. file and directory permissions;

I have written this in the Forum and have time to sort it out. I know that umask = 000 can be read and written by any user. Some things are easy to understand, and it is OK to execute a few more commands.

5. Linux mount command kernel version;

 
 
  1. [root@localhost beinan]# uname -a  
  2. Linux localhost.localdomain 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux 

I learned from the above that the current kernel version is 2.6.11-1.1369 _ FC4

6. The command to obtain the root user is su.

 
 
  1. [Beinan @ localhost ~] $ Su
  2. Password: enter your root Password here. Even if you enter the Password, it will not be displayed. to install the RPM package, you must use the root Super permission;
  3. [Root @ localhost beinan] #

Ii. NTFS file system Loading

1. First, we need to confirm the kernel of the system. We need to download Kernel patches that support ntfs Based on the kernel version of the system;

We have learned from fdisk-l that/dev/hda1 is an NTFS partition. How can we load it? In Fedora core 4.0, NTFS loading is not supported by the system by default. We can only install the ntfs plug-in or compile the kernel of a third-party kernel. The plug-in is the most convenient for compiling the kernel, is also the simplest;

 
 
  1. [root@localhost beinan]# uname -a  
  2. Linux localhost.localdomain 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux 

Be sure to check carefully. It is 2.6.11-1.1369_FC4, Which is i686 and does not contain smp. smp supports multi-processor kernels. If you use this kernel, download the smp version. Where can we download it? Kernel ntfs project in http://linux-ntfs.sourceforge.net Fedora core 4.0 kernel ntfs rpm package in: i686, download should be: kernel-module-ntfs-2.6.11-1.1369_FC4-2.1.22-0.rr.6.0.i686.rpm address: http://prdownloads.sourceforge.net/linux-ntfs/kernel-module-ntfs-2.6.11-1.1369_FC4-2.1.22-0.rr.6.0.i686.rpm

Select an image to download:
Install the kernel ntfs module:
[Root @ localhost beinan] # rpm-ivh kernel-module-ntfs *

2. Determine which partition is in NTFS format and load the NTFS partition;

 
 
  1. [root@localhost beinan]# /sbin/fdisk -l  
  2. Disk /dev/hda: 80.0 GB, 80026361856 bytes  
  3. 255 heads, 63 sectors/track, 9729 cylinders  
  4. Units = cylinders of 16065 * 512 = 8225280 bytes  
 
 
  1.  Device Boot      Start         End      Blocks   Id  System  
  2. /dev/hda1   *           1         765     6144831    7  HPFS/NTFS  
  3. /dev/hda2             766        2805    16386300    c  W95 FAT32 (LBA)  
  4. /dev/hda3            2806        7751    39728745    5  Extended  
  5. /dev/hda5            2806        3825     8193118+  83  Linux  
  6. /dev/hda6            3826        5100    10241406   83  Linux  
  7. /dev/hda7            5101        5198      787153+  82  Linux swap / Solaris  
  8. /dev/hda8            5199        6657    11719386   83  Linux  
  9. /dev/hda9            6658        7751     8787523+  83  Linux 

We have installed the kernel ntfs mode and now enters the NTFS partition loading process. From the above view, we know that/dev/hda1 is in NTFS format;

1] create a directory for the mount point. For example, create a winc directory under the/mnt/directory:
[Root @ localhost beinan] # mkdir/mnt/winc

2] Mount/dev/hda1 to/mnt/winc, so that if we view the/dev/hda1 disk content, we will find it in/mnt/winc;
[Root @ localhost beinan] # mount-t ntfs-o nls = utf8, umask = 000/dev/hda1/mnt/winc
Note:-t ntfs indicates that the file system format is ntfs;-o is an option. What are the options? Nls = utf8, Which Means Native Language Support supports local Language) is utf8, which is commonly used Language encoding; Fedora core 4.0 uses utf8 by default, in this way, Chinese characters are displayed. umask = 000 indicates that all user groups can read and write data. However, because NTFS is not secure in Linux, it can only be read and cannot be written. If you want to write data, you can only compile the kernel for implementation, but the meaning is not too great;

Is it mounted?

 
 
  1. [Root @ localhost beinan] # df-lh
  2. Filesystem capacity in use available % mount point
  3. /Dev/hda8 11G 5.9G 4.5G 57%/
  4. /Dev/shm 236 M 0 236 M 0%/dev/shm
  5. /Dev/hda1 5.9G 3.2G 2.7G 55%/mnt/winc

It seems that the mounting is complete; we can go to/mnt/winc to see if there is any content;

 
 
  1. [root@localhost beinan]# cd /mnt/winc   
  2. [root@localhost beinan]# ls  


3] How to automatically load NTFS file system partitions at startup;
Based on the disk location, we can see/dev/hda1 above, right? Therefore, add the following line to the/etc/fstab file;
/Dev/hda1/mnt/winc ntfs umask = 000, nls = utf8

4] How can I put this disk partition on the GNOME or KDE Desktop?
In KDE, you just need to click the mouse and right-click the blank area on the desktop to find it. It's too simple to talk about it;
It is also very simple in GNOME:
For example, if I log on to the beinan system as a user and want to put it on the GNOME Desktop OF THE beinan user;
[Beinan @ localhost ~] $ Ln-s/mnt/winc /~ Beinan/Desktop/winc

3. Loading partitions of the FAT32 File System;

Through fdisk-l, we also know that/dev/hda2 is in FAT32 format;
/Dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)
The support for FAT32 in Linux is readable and writable, so there is no need to install any modules or the like;

1. Create a directory for the mount point. For example, create a directory for wind under the/mnt/directory:
[Root @ localhost beinan] # mkdir/mnt/wind

2. Mount/dev/hda2 to/mnt/wind.
[Root @ localhost beinan] # mount-t vfat-o iocharset = utf8, umask = 000/dev/hda2/mnt/wind/

Check whether the mounting is complete?

 
 
  1. [Root @ localhost beinan] # df-lh
  2. Filesystem capacity in use available % mount point
  3. /Dev/hda8 11G 5.9G 4.5G 57%/
  4. /Dev/shm 236 M 0 236 M 0%/dev/shm
  5. /Dev/hda1 5.9G 3.2G 2.7G 55%/mnt/winc
  6. /Dev/hda2 16g 8.1G 7.7G 52%/mnt/wind

It seems that the mounting is complete. You should check it in;

 
 
  1. [Root @ localhost beinan] # cd/mnt/wind
  2. [Root @ localhost beinan] # ls-lh
  3. Drwxrwxrwx 3 root 8.0 K 11:45 capture
  4. Drwxrwxrwx 2 root 8.0 K test file August 12 10:21
  5. Drwxrwxrwx 4 root 8.0 K July 27 11:45 computer hardware
  6. Drwxrwxrwx 5 root 8.0 K July 27 11:45 Internet Express

There is no problem with Chinese support; this is in my machine;

3. How to automatically load the partition of the FAT file system at startup;

Based on the disk location, we can see/dev/hda1 above, right? Therefore, add the following line to the/etc/fstab file;
/Dev/hda2/mnt/wind vfat umask = 000, nls = utf8

4] How can I put this disk partition on the GNOME or KDE Desktop?
In KDE, you just need to click the mouse and right-click the blank area on the desktop to find it. It's too simple to talk about it;
It is also very simple in GNOME:
For example, if I log on to the beinan system as a user and want to put it on the GNOME Desktop OF THE beinan user;
[Beinan @ localhost ~] $ Ln-s/mnt/wind /~ Beinan/Desktop/wind

4. Garbled text files;

For example, if we see that some text files are garbled, we can use gedit to open them and save them as utf8 format. Note: although the content is detailed, however, I cannot guarantee that all beginners can perform the operation, but I feel that 80% beginners still follow the steps and there will be no problems; they are being revised. You are welcome to provide some comments and suggestions. Thank you ~

  1. Configure Linux YUM source settings to use a proxy
  2. Add Linux smb service to firewall and start automatically
  3. Use the source code to compile and install the Linux Mysql Server
  4. Introduction to Linux XDMCP accessing Linux desktop functions is similar to Remote Desktop in Windows
  5. Linux mplayer uses configuration files and loads subtitles

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.