One task at hand is to make a local backup of some of the company's important data. Use Seagate's 4TB hard drive.
For a 4TB hard disk, the following warning appears if you use the partition directly with Fdisk:
Warning:gpt (GUID Partition Table) detected on '/DEV/SDE '! The util Fdisk doesn ' t support GPT. Use GNU Parted.
and the result of partitioning is that only 2TB is left.
So there is a problem: How to mount a 4TB hard disk on the system, only 1 zones.
The parted command can divide a single partition that is larger than 2T in GPT format, or partition a normal MBR partition, and the FDISK command cannot be partitioned for partitions larger than 2T, so you cannot see the parted partition in GPT format with FDISK.
The need here is to use a tool: parted.
To install the parted tool:
Yum Install-y parted
Command parameters for the parted tool:
Usage: parted [OPTION] ... [DEVICE [COMMAND [PARAMETERS] ...] ...]
Apply COMMANDs with PARAMETERS to DEVICE. If no COMMAND (s) are given, run in
interactive mode.
Options:
-h, --help display this help message
-l, --list lists partition layout on all block devices
-m, --machine displays machine parseable output
-s, --script never prompt the user
-v, --version display version
-a, --align = [none | cyl | min | opt] alignment for new partitions
command:
align-check TYPE N check partition N for TYPE (min | opt)
alignment
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] print general help, or help on
COMMAND
mklabel, mktable LABEL-TYPE create a new disklabel (partition
table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on
partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [devices | free | list, all | NUMBER] display the partition table,
available devices, free space, all found partitions, or a particular
partition
quit exit program
rescue START END rescue a lost partition near START
and END
resize NUMBER START END resize partition NUMBER and its file
system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition
NUMBER
unit UNIT set the default unit to UNIT
version display the version number and
copyright information of GNU Parted
Chinese analysis:
How to use: parted [options] [device [command [options ...] ...]]
options
-h display help information
-l show partitions on all block devices
device
Which block device to operate on, or use the first block device if not specified
command [options ...]
check partition
Do a simple check on the partition
cp [source-device] source dest
Copy the source partition on the source-device device to the dest partition of the current device
mklabel label-type
Create new partition table type, label-type can be: "bsd", "dvh", "gpt", "loop", "mac", "msdos", "pc98", or "sun" msdos format, if the partition is larger than 2T, you need to choose the partition table in gpt format.
mkfs partition fs-type
Create a fs-type file system on the partition. The fs-type can be: "fat16", "fat32", "ext2", "linux-swap", "reiserfs". Note that the ext3 file system is not supported, only Partition first and then format with proprietary commands.
mkpart part-type [fs-type] start end
Create a partition of part-type type. Part-type can be: "primary", "logical", or "extended" If you specify fs-type, format the partition while creating it. start and end refer to the starting position of the partition. The default unit is M.
eg: mkpart primary 0 -1 0 indicates the beginning of the partition -1 indicates the end of the partition Means dividing the entire hard disk space as the primary partition
mkpartfs part-type fs-type start end
Create a fs-type part-type partition. It is not recommended. It is best to use mk2fs to format the partition.
name partition name
Set a name for the partition. This setting can only be used in partition tables of Mac, PC98, and GPT types. The name is enclosed in quotation marks.
select device
When there are multiple hard disks on the machine, choose which hard disk to operate
resize partition start end
Resize partition
rm partition
Delete a partition
rescue start end
Rescue a partition between stat and end
unit unit
In the previous partition, the unit of the value in the default partition is M. This parameter Kay changes the default unit, "kB", "MB", "GB", "TB"
move partition start end
Move partition
print display partition table information quit exit parted
After learning the parted knowledge, to complete our task:
1. Use the command to enter interactive mode and view the current hard disk partition information:
Parted/dev/sdep
2, delete the current partition, and see the results here (in order to write this tutorial, I have just partitioned the hard drive and deleted the ^~^!! )
RM 1p
3. Format the hard disk as GPT
Mklabel GPT
4. Partition the disk and divide the entire hard drive into a single area.
Mkpart Primary 0-1ignore
Parted execution Mkpart Primary is directly partitioned (and Fdisk needs to be saved)
5. Exit parted
Quit
6. After the partition is finished, the partition work is started:
Mkfs.ext4/dev/sde1
7. Mount the hard drive
Mount/dev/sde1/var/xxx
It's finally done.
Scattered flowers!!!!
Welcome to scan the following QR code follow my public number: Codemanship (code)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How to mount a 4TB hard drive in CentOS 6.X