Linux new disk partition format and Mount-fdisk command

Source: Internet
Author: User

This paper mainly solves the problem of disk partition formatting and mount of Linux system.
Attention:
Partitioning operations for disk VDA,SDA, etc.
VDA1,SDA1, etc. is the name of the partition

1. Check the current disk partition status

1.1. View the partition Mount situation

DF -H

-------------------------------------------------------------------------------

[Email protected]:~#DF-hfilesystem Size used Avail use%Mounted Onudev7.9G0 7.9G0% /Devtmpfs1.6G3.2M 1.6G1% /Run/DEV/VDA1 50G5.7G 41G -% /Tmpfs7.9G0 7.9G0%/dev/Shmtmpfs5.0M 0 5.0M 0%/run/Locktmpfs7.9G0 7.9G0%/sys/fs/Cgrouptmpfs1.6G0 1.6G0%/run/user/0

1.2. View the disk that the server is mounted on

Fdisk-l
[Email protected]:~# fdisk-Ldisk/dev/vda: -GiB,53687091200bytes104857600sectorsunits:sectors of1* += +bytessector size (logical/physical): +Bytes/ +Bytesi/o Size (minimum/optimal): +Bytes/ +Bytesdisklabel type:dosdisk Identifier:0xd6804155Device Boot Start End sectors Size Id Type/DEV/VDA1 *2048 104855551 10485350450G theLinuxdisk/DEV/VDB: -GiB,53687091200bytes104857600sectorsunits:sectors of1* += +bytessector size (logical/physical): +Bytes/ +Bytesi/o Size (minimum/optimal): +Bytes/ +bytes
2. Partitioning the disk into a formatted operation

2.1. Partitioning the VDB disk

Fdisk/dev/vdb

The following are common partitioning operations:

M print Menu
N New Partition
D Delete Partition
P Print Partition Table
W Write partition Table Save
Q exit

P Select Primary Partition
E Select an extended partition
1 Select a partition number
Select initial position, default is 1
Until the end of the selection, the default is the end of disk

[Email protected]:~# fdisk/dev/vdbwelcome to fdisk (util-linux2.27.1). Changes'll remaininchMemory only,untilYou decide toWritethem. Be careful before using theWritecommand. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier0x63c3e6e0. Command (M forHelp ): Npartition Typep Primary (0Primary0Extended4  Free) e Extended (Container forlogical partitions) Select (default p): Ppartition number (1-4, default1): First Sector (2048-104857599, default2048): Last sector,+sectors or +size{k,m,g,t,p} (2048-104857599, default104857599): Created a new partition1of type'Linux'and of size -Gib.command (M forHelp):WThe partition table has been altered. Calling IOCTL () to re-read partition table. Syncing disks.

2.2. Re-view the disk partition table

[Email protected]:~# fdisk-Ldisk/dev/vda: -GiB,53687091200bytes104857600sectorsunits:sectors of1* += +bytessector size (logical/physical): +Bytes/ +Bytesi/o Size (minimum/optimal): +Bytes/ +Bytesdisklabel type:dosdisk Identifier:0xd6804155Device Boot Start End sectors Size Id Type/DEV/VDA1 *2048 104855551 10485350450G theLinuxdisk/DEV/VDB: -GiB,53687091200bytes104857600sectorsunits:sectors of1* += +bytessector size (logical/physical): +Bytes/ +Bytesi/o Size (minimum/optimal): +Bytes/ +Bytesdisklabel type:dosdisk Identifier:0x63c3e6e0Device Boot Start End sectors Size Id Type/dev/vdb12048 104857599 10485555250G theLinux

2.3: Reload Disk partition information

Partprobe/dev/vdb1

Using the Fdisk tool simply writes the partition information to the disk,
You need to use Partprobe to let kernel re-read the partition information before formatting the partition value, and if unsuccessful, restart the system
No return is the read success

2.4. Format the partition of the disk

Mkfs.ext4/dev/vdb1

[Email protected]:~# mkfs.ext4/dev/VDB1MKE2FS1.42. -( --may- -) Creating filesystem with131069444k blocks and3276800Inodesfilesystem uuid:047fb8b0-e6ed-42db-bf5c-2a6d388fc34dsuperblock backups stored on blocks:32768,98304,163840,229376,294912,819200,884736,1605632,2654208, 4096000,7962624,11239424Allocating group tables: DoneWriting inode tables: DoneCreating Journal (32768Blocks): DoneWriting Superblocks and filesystem accounting information: DoneThis filesystem'll be automatically checked every -Mounts or theDays, whichever comes first. Use Tune2fs-c or-i to override.

2.5. Format to complete the subsequent optimization of the configuration

Tune2fs-c-1
[Email protected]:~# tune2fs-c-1 /dev/1.42.  (-may-)Mount count to-1 
3. Mount Partitions

3.1. Mount the partition to the specified directory

mkdir -P/dataMount /dev/vdb1/data

3.2. Configure the boot auto-mount partition

Add the following content

inch 20180327 0 0

Finished, hehe hehe

Linux new disk partition format and Mount-fdisk command

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.