Linux disk and file System (ii) Linux under disk naming and partitioning

Source: Internet
Author: User

Before adding a hard disk to a host, you need to know the command method for the hard disk and partition under the Linux system

First, disk naming

Linux for SCSI and SATA devices are named after the SD, the first SCSI device is SDA, the second is SDB .... And so on There are two SCSI interfaces on the motherboard, so you can install 4 SCSI devices altogether. The two devices on the primary SCSI correspond to SDA and SDB respectively, and the device on the second SCSI port corresponds to SDC and SDD. The general hard disk is installed on the SCSI main interface, so it is SDA and SDB, and the optical drive is generally installed on the second SCSI main interface, so it is SDC. The IDE has two ports, and the first IDE port is called an adapter, which can be connected to two disks, main disk (HDA) and slave disk (HDB). Second IDE Port master (HDC) slave disk (HDD)

Second, the Division name

The so-called disk partition refers to the area that the operating system can access is the block between the magnetic column, so that the operating system can know that he can be in the specified block file data read, write, search and other actions. That is, the disk partition specifies the start and end of the splitter slot.

Partition naming is named with the device name plus a number. For example, HDA1 represents the first partition on HDA on this hard drive device. There are up to four primary partitions on each hard disk. Multiple primary partitions can have only one primary partition as the boot partition. Logical partitions start at 5, with each partition having up to 24 extended partitions on each disk.

Iii. Partitioning steps

To view partitions:

Fdisk-l//List all hard drive information

Fdisk-l device//list specified drive information

To manage disk partitions:

Fdisk disk//Create new disk partition, delete old disk partition

M: View Help

P: Displays the partition of the current hardware, including unsaved changes

N: Create a new partition

E: Extended partition

P: Primary partition

D: Delete a partition

W: Save exit

Q: Do not save exit

T: Modify the file system type of the partition type//partition

L: Show all supported types

Partprobe command: Notifies the kernel to reread the hard disk table

Cat/proc/partitions

The newly created new partition must be formatted before it can be used

Iv. purpose of the zoning

1. The system can be re-installed in the case of data failure. For example, when you set up the/home mount point independently, the system is re-installed directly marked back to//, the data will not have any loss

2. Assign the appropriate file system for the characteristics of different mount points to play a reasonable performance. For example, use ReiserFS for/var and xfs for/home

3. Turn on different mount options for different mount points, such as whether you need instant sync, whether to turn on logging, whether to enable compression

4. Large hard drive search range, low efficiency

5. Disk quotas can only be set for partitions

V. Formatting partitions

MKFS-T EXT3/DEV/SDA1//formatted partition into EXT3

MKFS-T EXT2/DEV/SDA1//formatted partition into ext2

Six, Mount Partition

To mount the mount command, you need to know

Mount command: View the files that are currently mounted on the system

-A: Mount all file systems defined in the file

-N: Do not let mount success information written in/etc/mtable

Unmount: To Mount

Note: Mount mounted file system does not exist after reboot, and the mount information can be permanently automatically mounted when it is written to/etc/fstab.

Mount Information Format: Mounted device mount point file system type (default = defalut) Dump frequency (a full backup of files every few days) file system self-test order (0 means no check, only root is 1, other files can be 2 at the same time, after the inspection is finished)

Add directly to the format:/dev/sda1/test ext3 defaults 1 1

Summarize
    • The mount point must be a directory.
    • A partition is mounted on an existing directory, and this directory may not be empty, but the previous content in this directory will not be available after mounting. The same is true for the mounting of file systems created by other operating systems, and after uninstallation, the previous files of the directory are still there and there will be no loss.
    • The directory occupies only one inode in the disk, storing information such as file attributes.
    • Any partition must be mounted on a directory.
    • A directory is a logical distinction. Partitioning is a physical distinction.
    • Disk Linux partitions must be mounted to a specific directory in the directory tree for read and write operations.
    • The root directory is where all Linux files and directories reside, and the previous disk partition needs to be mounted.
    • A partition can be hung in multiple directories, but in turn a directory can only be a mount point for a partition.

Linux disk and file System (ii) Linux under disk naming and partitioning

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.