HDD mount, partition, delete partition, format, mount, uninstall method under Linux

Source: Internet
Author: User

This paper briefly introduces the following file system and its operation (DF command), disk partitioning, formatting, and most notably Mount operations.

Here to "mount" to do a description, we all know that the file system is created on the disk, each file system has a separate inode, block and other information, and this file system to be able to connect to the directory tree to be accessed by us. The operation that associates the file system with the directory tree becomes a mount. Mount the file system to a directory that is the entry to the file system.

I. Creating a Partition

Check to see if there are no partitions on the disk

fdisk -L

The first box is a disk that has been partitioned, and the second to third hard disk does not have a partition. Start partition below

two. partitioning the/dev/vda with Fdisk
fdisk /dev/vdb

Enter m to view command actions

Enter P to view the current hard disk partition, there is currently no partition

Enter N to create a new partition, enter p to create a partition, enter the partition number 1

And then let you set the start sector, I filled in the start sector 2048, end, 20480

Last Enter W, enter save

In fact, this time, the establishment of a good partition can not be used, but also need to mount to use. But before it is mounted, it must be formatted before it can be done ...

Three. Formatting partitions

Why format it? Because the file attributes/permissions set by each operating system are not the same, in order to store the data required for these files, the partition needs to be formatted and has become a file system format that the operating system can take advantage of. From this we can also know that the file system format of each operating system is different. For example, Windows System file System format is Fat/fat16/ntfs, and CentOS is EXT2/EXT3/EXT3. The next step is to format the operation,

Format command: Format partition, and specify partition system/DEV/VDB, I am here to format into EXT4

MKFS.EXT4   /dev/vdb

Four. Mounting4.1 Mount Partition4.1.1 Create mount Directory first
mkdir /lutong
4.1.2 notifies the system of changes to the kernel partition table, otherwise the kernel does not know the partition (or restart the system)
Partprobe /dev/vdb
4.1.3 and then mount the partition
Mount /dev/vdb/lutong
4.1.4 last to see if the mount was successful
DF -H

4.2 Setting up auto mount on boot4.2.1 Viewing UUID

4.2.2 Adding a newly mounted partition
Vim /etc/fstab

Add the circled section above the red frame, and then Wq save to exit

Then restart, then use the reboot command to see if the setting is successful

Five. Uninstall and delete Partition 5.1 Uninstall
Umount /dev/vdb

Uninstalled, actually can be mounted, and the data will be in the

5.2 Deleting a partition
fdisk /dev/sdcmd1   d   #删除 w   #输入 W Save, this time partition and delete, you can recreate the

HDD mount, partition, delete partition, format, mount, uninstall method 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.