Detailed steps for mounting a Linux hard disk (2)

Source: Internet
Author: User

Before mounting a Linux hard disk, let's first check how many hard disks exist on the current machine and how to create a disk partition for the hard disk to be mounted, this section describes how to format and mount partitions to complete Linux hard disk mounting.

Linux hard disk mounting step 3,Format the partition to be mounted

Use the following command to format the new partition to ext3

# Mkfs-t ext3-c/dev/sdb1

Mkfs commands are described as follows:

Function Description: create various file systems.

Syntax: mkfs [-vV] [fs] [-f <file system type>] [device name] [number of blocks]

Note: mkfs does not create a file system, but calls relevant programs for execution.

Parameters:
Fs specifies the parameter when a file system is created.
-T <file system type> specifies the file system to be created.
-V displays the version information and detailed usage.
-V shows a brief usage method.

Step 4 of Linux hard disk mounting,Mount a partition

After formatting, we need to mount the partition, for example:

# Mkdir/test

# Mount/dev/sdb1/test

# Df // use the df command to view

Filesystem 1K-blocks Used Available Use % Mounted on

/Dev/sda1 101089 9463 86407 10%/boot

None 62988 0 62988 0%/dev/shm

/Dev/sdb1 485906 8239 452580 2%/test // newly mounted Partition

To automatically mount a new partition when the system starts, you need to modify the/etc/fstab file for automatic mounting. Add the following line to the last position of the file:

/Dev/sdb1/test ext3 defaults 1 2

In this way, the partition is automatically attached to the server every time it is started, and the hard disk mounting process ends.

The mkdir command is described as follows:

Function: create a directory similar to the md command under MSDOS ).

Syntax: mkdir [Option] dir-name

Note: This command creates a directory named by dir-name. The user who creates a directory must have the write permission in the parent directory of dir-name in the current directory. the dir-name cannot be an existing directory or file name in the current directory.

Parameters:
-M sets the access permission for the new directory. You can also set it using the chmod command.
-P can be a path name. If some directories in the path do not exist, after this option is added, the system automatically creates those directories that do not exist, that is, multiple directories can be created at a time.

The mount command is described as follows:

Function: load the specified file system.

Syntax: mount [-afFhnrvVw] [-L <tag>] [-o <option>] [-t <file system type>] [device name] [load point]

Usage Description: mount can load the file system specified in the specified device to the Linux directory, that is, the mount point ). You can write frequently used devices to the/etc/fastab file to enable the system to automatically load each time the device is started. The mount device information is recorded in the/etc/mtab file. When you run the umount command to uninstall a device, the record is cleared.

Parameter description:

There are many descriptions, so we will not record them here.

Df commands are described as follows:

Function: displays the status information of the Linux File System, including the capacity, used, unused, and mount points of each partition.

Syntax: df [Option]... [file]...

Parameter description:
-A, -- all includes a file system with a size of 0 blocks.
-B, -- block-size = size block, in bytes of the specified <size>
-H, -- human-readable print the file system size in an easy-to-understand format (for example, 1 K 234 M 2G)
-H, -- si is similar to-h, but takes the power of 1000 instead of 1024.
-I, -- inodes: displays inode information instead of block usage.
-K is -- block-size = 1 K
-L, -- local only displays the local file system
-- No-sync: do not perform the sync action before getting the used data (default)
-P, -- portability uses POSIX output format
-- Sync before getting the used data
-T, -- type = type: only the specified <type> file system information is printed.
-T, -- print-type indicates the file system type.
-X, -- exclude-type = type: only file system information that is not specified <type> is printed
-V (this option is not processed)
-- Help: displays the help information and leaves
-- Version: displays the version information and leaves.

Common Operations:
Df-k displays information about each partition in kilobytes of KB.
Df-a displays all partitions, including partitions with a size of 0.
Df-T: Display partition types such as EXT2 or EXT3

Now all the Linux hard disk mounting tasks have been completed.

  1. Detailed introduction to Linux hard disk mounting step 1)
  2. Summary: how to install Oracle in Linux
  3. Describes how to manage Linux User Accounts
  4. Describes how to create a Linux wap Gateway.
  5. Linux mounting commands

Related Article

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.