Partitioning, file system creation, mount, and uninstallation of disks under Linux

Source: Internet
Author: User

Cause of the task: because the newly purchased server needs to mount the disk to the operating system, in order to mount the disk first to partition the disk, then create the file system, and finally mount the disk to a directory on the operating system.

The MBR (Master Boot Record) is a traditional partitioning mechanism that is applied to the vast majority of PC devices that use the BIOS.

1.MBR supports 32bit and 64bit systems

2.MBR limited number of supported partitions

3.MBR only supports hard drives up to 2T, more than 2T drives can only use 2T space (using other methods)

1. Primary partition: Up to 4 primary partitions can be created (available)

2. Extended partition: An extended partition occupies a primary partition location (not available, can be converted into logical partition)

3. Logical partitioning: Linux supports up to 63 IDE partitions and 15 SCSI partitions (available)

Fdisk Partitioning tool: Fdisk is an old partition tool from IBM that supports most operating systems, and almost all Linux distributions are equipped with FDISK, which is an MBR-based partitioning tool.

First, Disk Partitioning:

1. go to root.

2. Enter fdisk-l (This command will show all disks that are not partitioned)

such as: disk/dev/sdb:8589 MB, 8589934592 bytes

Is the newly mounted hard disk to be operated on.

3. Partition The SDB, enter: Fdisk/dev/sdb means partition the SDB disk and enter M to view help.

Second, To create a primary partition:

N Create a new partition

P View current partition

W Save changes and exit

Enter P return (this time to create a primary partition)

Enter the partition number, enter 1 to return the car

then return .

set the size of this partition (for example, enter +5g; unit k,m,g) and return to

enter P return to show that a primary partition has been seen.

Third, To create an extended partition:

Enter n return

Enter e carriage return

Enter the partition number and enter 2 to return the car (1 area code has been used in front of)

then return .

Enter the size of the extended partition to be allocated (if you want to use all remaining space, you do not need to enter, direct carriage)

Enter p to display the partition

Four, to partition an extension into a logical partition:

Save Settings:

Enter W return, which shows the end of the following partition.

Five. Browse File System Scenarios

Input: DUMPE2FS/DEV/SDB1 and DUMPE2FS/DEV/SDB2

Output: for example:

As you can see, both SDB1 and SDB5 have no file system.

Six, To create a file system:

The operating system manages files and data through the file system, the disk or partition needs to create a file system before it can be used for the operating system, and the process of creating a file system is called formatting.

Input: mke2fs-t ext4/dev/sdb1 (Create file system for SDB1 primary partition with command MKE2FS)

Input: mke2fs-t ext4/dev/sdb5 (Create file system for SDB5 logical partition)

Seven, mount File System:

Input: Mount/dev/sdb1/mnt (mount the SDB1 primary partition on the MNT)

Input: mount/dev/sdb5/mnt (attach SDB5 logical partition to MNT)

Viii. Uninstalling the file system

For example,/DEV/HDA5 has been mounted on the/MNT/HDA5, using three commands can be uninstalled mounted file system
Umount/dev/hda5
Umount/mnt/hda5
Umount/dev/hda5/mnt/hda5

Partitioning, file system creation, mount, and uninstallation of disks under Linux

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.