Detailed procedures for mounting a Linux hard disk (1)

Source: Internet
Author: User
Tags scp command dmesg

Linux hard disk mounting is a solution for using external hard disks on Linux systems, here we will introduce several hard disks on the current machine, create a disk partition for the hard disk to be mounted, format the partition to be mounted, and mount the partition step by step, this section describes the first two steps of Linux hard disk mounting.

Steps 1,First, check that there are several hard disks on the current machine. There are two command types:

Command 1: # fdisk-l

Command 2: # dmesg | grep sd

The fdisk command is described as follows:

Usage of the fdisk command: Observe the physical usage of the hard disk and separate the hard disk.

How to Use the fdisk command:

1. Enter fdisk-l on the console to observe the physical usage of the hard disk.

2. Enter the disk name of fdisk/dev/sda on the console.

Enter m to display all commands.

Enter p to show hard disk segmentation.

Enter a to set the hard disk boot zone.

Enter n to set the new hard disk partition.

Enter the "e" hard drive as the [extended] partition (extend ).

Enter p hard drive as the [primary] partition (primary ).

Input t to change the partition property of the hard disk.

Enter d to delete the partition property of the hard disk.

The input q ends and is not saved to the hard disk partition.

Enter w and write it to the hard disk partition.

Dmesg commands are described as follows:

Function Description: displays the boot information.

Syntax: dmesg [-cn] [-s]

Note: The kernel stores the boot information in the ring buffer. You can use dmesg to view the information if you cannot view it at startup. The boot information is also saved in the/var/log directory and named dmesg.

Parameters:
-C: After the information is displayed, clear the content in the ring buffer.
-S is pre-configured as 8196, which is equal to the ring buffer size.
-N indicates the level of configuration record information.

Steps 2,Create a disk partition for the hard disk to be attached

The steps for creating a disk partition are as follows:

# Fdisk/dev/sdb

Enter the fdisk mode:

Command (m for help): m // view the help of the fdisk Command

Command (m for help): n // create a new partition

Command action:

E extended // input e to create an extended partition

P primary partition (1-4) // input p to create the primary partition. Here we select p

Partion number (1-4): 1 // The first extended partition, which can be divided into up to four primary partitions as needed

First Cylinder (1-1014, default 1): 1 // Number of disks starting from the First primary partition. You can select the default value.

Last cylindet or + siza or + sizeM or + sizeK: + 1024 MB // It Can Be A number in MB or

The number of disk blocks. In this example, we enter + MB to indicate that the partition size is 1 GB.

In this way, we have created a partition. If you want to create more partitions, you can continue to create the partition according to the above steps. After all the partitions are created, use w to save the partitions.

Command (m for help): w

The partition table has been altered!

After saving, restart the server. Run the # fdisk-l command to check the created partition. You can confirm the/dev/sdb1 information in the returned result.

Next we will continue to introduce how to format and mount the partitions to be mounted.

  1. Detailed command 1 for running Linux background)
  2. Parsing Linux NTFS partitions
  3. Differences between Linux and Unix
  4. Detailed analysis of Linux scp command Application
  5. Brief Introduction to Linux kernel Security Intrusion Detection System

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.