Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to partition disks larger than 2T quickly in linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to quickly partition disks larger than 2T in linux, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

In the production environment, we will encounter disks with partitions larger than 2T (for example, adding a 10TB storage). Since the MBR partition table only supports 2T disks, the disks larger than 2T must use the GPT partition table. When we do raid, we will divide multiple VD to install the system, but the system cannot identify all the disks after installation, so we need to mount the GPT partition manually. So how to mount a disk larger than 2T in linux?

Tips:

The disk in GPT format is equivalent to the original MBR disk with 4 partition table and 16 bytes, leaving only the first 16 bytes. Similar to the extended partition, the real partition table disk does not have the limit of four primary partitions after 512 bytes.

While fdisk does not support GPT partitions, we can use parted to operate on GPT disks. Parted is very powerful, can be used either on the command line or interactive, enter parted at the prompt will enter interactive mode, if there are multiple disks, we need to run select sdX (X is the disk) to select the disk, you can also directly use parted / dev/sdX to specify the corresponding hard disk.

[root@server ~] # fdisk-l

The code is as follows:

Disk / dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/ dev/sda1 * 1 16 128488 + 83 Linux

/ dev/sda2 17 49 265072 + 82 Linux swap / Solaris

/ dev/sda3 50 2610 20571232 + 83 Linux

Disk / dev/sdb: 2190.4 GB, 2190433320960 bytes

255 heads, 63 sectors/track, 266305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk / dev/sdb doesn't contain a valid partition table

[root@server ~] # parted

GNU Parted 1.8.1

The code is as follows:

Using / dev/sda

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) select / dev/sdb / / Select disk sdb

Using / dev/sdb

(parted) mklabel gpt / / format the MBR disk as GPT

(parted) mkpart primary 0-1 / / divide the entire disk into a partition

(parted) print

Model: VMware, VMware Virtual S (scsi)

Disk / dev/sdb: 2190GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number Start End Size File system Name Flags

1 17.4kB 2190GB 2190GB primary

(parted) quit

Information: Don't forget to update / etc/fstab, if necessary.

PS: when the SCSI array is mounted in the Linux system and the partition size exceeds 2TB, the mk2fs command cannot be used for formatting. When you use the mkfs.ext3 command to format, you need to add the-T largefile parameter, otherwise the formatting process will be very slow. For adding a 10TB storage, direct formatting under linux is a very long process, 10TB, it is estimated that 30 hours less can not be completed.

[root@server] # mkfs.ext3-T largefile / dev/sdb1

Try it quickly, special step, the feeling of flying

[root@server ~] # e2label / dev/sdb1 / data1 / / A pair of / dev/sdb1 is added (modified) tagged as / data1

[root@server ~] # e2label / dev/sdb1 / / View the label of the partition

/ data1

[root@server ~] # mkdir / data1 / / create a mount point for quotas under / partition

[root@server ~] # mount / dev/sdb1 / data1 / / manually mount the partition

After the partition is completed and mounted successfully, you can see the size of the disk with df-h.

[root@server] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/sda3 20G 3.9G 15G 22% /

/ dev/sda1 122m 12m 104m 10% / boot

Tmpfs 62m 0 62m 0% / dev/shm

/ dev/sdb1 2.0T 199M 1.9T 1% / data1

Finally, you only need to add the following line to fstab to automatically mount the partition.

[root@server ~] # vi / etc/fstab

/ dev/sdb1 / data1 ext3 defaults 0 0

The above is all the contents of the article "how to quickly partition disks larger than 2T in linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report