Use the parted command in Linux to implement hard disk partitions larger than 2 TB

Source: Internet
Author: User

In general, we use the fdisk command for disk partitions. However, if the disk capacity is greater than 2 TB, this command does not work because MBR partition tables only support 2 TB disks; therefore, the GPT partition table must be used for disks larger than 2 TB. In this case, we need to use the parted command.

Parted command details
 
Usage: parted [option]... [device [command [parameter]...]
 
Apply the Command with "parameter" to "device ". If no "command" is provided, it is run in interactive mode.
Help options:
-H, -- help displays this help information
-L, -- list lists information about all the specified partitions.
-I, -- interactive prompts users when necessary
-S, -- script never prompts users
-V, -- version display version
Operation Command:
Check MINOR # perform a simple check on the file system
Cp [FROM-DEVICE] FROM-minor to-MINOR # copy the file system TO another partition
Help [COMMAND] # Print common help information or COMMAND information
Mklabel label type # Create a new disk label (partition table)
Mkfs MINOR file system type # Create a file system of the "file system type" in MINOR
Mkpart partition type [file system type] start point termination point # Create a partition
Mkpartfs partition type start point of the file system type # Create a partition with a file system
Move MINOR start point termination point # move the Shard numbered MINOR
Name MINOR name # name the partition numbered MINOR as "name"
Print [MINOR] # print the partition table or partition
Quit # exit the program
Rescue start point ending point # save the lost partition near "start point" and "end point"
Resize MINOR start point ending point # change the size of the file system in the partition numbered MINOR
Rm MINOR # delete a partition numbered MINOR.
Select Device # select the device to edit
Set MINOR flag status # indicates the Shard ID changed to MINOR.
 

I. Partitioning

# Parted/dev/sdb # use parted to operate on the GPT disk and enter interactive mode

(Parted) mklabel gpt # format the MBR disk as GPT

(Parted) mkpart primary ext4 0% 100% divides all capacity into one primary partition

(Parted) p # print the current partition

(Parted) q # exit

II. Format

# Mkfs. ext4/dev/sdb1

III. Mount partitions

Mount-t ext4/dev/sdb1/cache1 # mount to cache1

Df-h # view the partition result

4. Self-start upon startup
Modify the/etc/fstab file and add the following code:

/Dev/sdb1/cache1 ext4 defaults, noatime 1 2

FAQ:
1. Warning: The resulting partition is not properly aligned for best performance.
When you set the partition capacity in step 1, the mkpart primary 0 4 TB command is used at the beginning. No matter how the numbers are combined, a Warning message is displayed, because parted is differentiated by sectors, if you enter a number forcibly, the system prompts that the alarm is not the optimal solution. So we use % ratio to test the normal pass

(Parted) mkpart primary ext4 0% 100

Related Article

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.