Disks with linux greater than 2T are Shared using the GPT partition method

  • 2020-05-06 12:07:17
  • OfStack

At linux we can first convert the large capacity disk to GPT format. Since the GPT disk is equivalent to the original MBR disk with 4*16 bytes of partition table, only the first 16 bytes are left. The others are similar to extended partitions. The true partition table is after 512 bytes.

To manipulate the GPT disk partition table, we use the powerful parted command.

Example: the commonly used parted command

# parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) mklabel gpt
Format the MBR disk to GPT

(parted) mkpart primary 0 100
Divide a primary partition
with a starting position of 0 and a size of 100M
(parted) mkpart primary 100 200
Divide a primary partition
with a starting position of 100M and a size of 100M
(parted) mkpart primary 0 -1

Divide all Spaces into a partition

(parted) print

Print
for the current partition
(parted) quit

Some of the commands that might be used are

(parted) mklable msdos

If you want to do the reverse. Convert GPT disk to MBR disk

After partitioning like this,
is also formatted using mkfs.ext3
#partprobe

#mkfs.ext3 -F /dev/sdb1

We practice operation:

Take redhat 5:

parted /dev/sdb mklabel gpt Convert to GPT.
parted /dev/sdb mkpart primary 0 1000000 create a partition for 1T.
mkfs -t ext3 /dev/sdb1
mount /dev/sdb1 /mnt/b
This is the partition b that hangs a large disk under the mnt directory on the linux system.

Boot up and mount
yourself
vi /etc/fstab

/dev/sdb1 /mnt/b auto defaults 0 0

Related articles: