刚开始使用fdisk 进行添加磁盘,添加了半天都加不上去,后来发现fdisk只能处理2T以下的磁盘,大于2T以上的磁盘需要使用parted进行分区。 There are two common problems when creating partitions in Linux on big storage arrays. The first is easy,and the warning message from fdisk is a bit of a giveaway:
WARNING: The size of this disk is 8.0 TB (7970004230144 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
The answer: use parted. Don’t have it? Install it!The second problem is this warning from parted:
(parted) mklabel gpt
(parted) mkpart primary 0 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?
… and no matter what combination of numbers you use,the message just keeps coming back. It’s tempting to ignore it,but don’t. There are a few posts on the subject,but this one from HP really gets to the guts of the problem. Here’s a quick step-by-step guide to aligning partitions properly. It’s just an abstraction of the HP post,but hopefully easier to follow. This will work for most arrays (in fact it works for all the arrays that I’ve seen); there are more options in HP’s post,but I’ve included the most common configuration here. 1.Get the alignment parameters for your array (remember to replace sdb with the name of your device as seen by the kernel).
# cat /sys/block/sdb/queue/optimal_io_size
1048576
# cat /sys/block/sdb/queue/minimum_io_size
262144
# cat /sys/block/sdb/alignment_offset
0
# cat /sys/block/sdb/queue/physical_block_size
512
2.Add optimal_io_size to alignment_offset and divide the result by physical_block_size. In my case this was (1048576 + 0) / 512 = 2048. 3.This number is the sector at which the partition should start. Your new parted command should look like
mkpart primary 2048s 100%
The trailing ‘s’ is important: it tells parted that you’re talking about sectors,not bytes or megabytes. 4.If all went well,the partition will have been created with no warnings. You can check the alignment thusly (replacing ‘1’ with the partition number if necessary):
(parted) align-check optimal 1
1 aligned
As I alluded to before,there are cases where this won’t work: if optimal_io_size is zero,for example,there are other rules to follow. Of course it would be nice if parted could do this—the values are all available as ioctls。 Apparently,using % causes parted to automatically align the sectors for best performance:
(parted) mkpart primary ext4 0% 100%
Also: Red Hat Enterprise Linux 6 - Creating a 7TB Partition Using parted Always Shows "The resulting partition is not properly aligned for best performance" Issue Trying to create a 7TB partition using parted,but parted always complains as follows: "The resulting partition is not properly aligned for best performance" Tried "parted -a optimal",but the result is same.
(parted) mkpart primary 0 7000G
Aviso: The resulting partition is not properly aligned for best performance. Descartar/Ignore/Cancelar/Cancel?
Solution Parted uses the following algorithm to determine optimal alignment for newly created partition. If none of the following conditions,2a,2b,or 2c are satisfied,then the warning message "The resulting partition is not properly aligned for best performance" would be displayed by parted utility. Always use the reported alignment offset as offset. If optimal io size is present in the topology info,use that as grain. If optimal io size is not present in topology info and alignment offset is 0 and minimum io size is a power of 2,use the default optimal alignment (grain 1MiB). If not 2a and 2b,use the minimum io size,or if that is not defined the physical sector size as grain (iow the minimum alignment). In this case,the corresponding sysfs values are:
# cat /sys/block/sdb/queue/optimal_io_size
1835008
# cat /sys/block/sdb/queue/minimum_io_size
262144
# cat /sys/block/sdb/alignment_offset
0
# cat /sys/block/sdb/queue/physical_block_size
512
With a sector count of 13674214832 for the disk,13674214831 should be used as the end sector for using parted on this disk. With the optimal_io_size value 1835008 exceeding 1MiB,parted wants to align to the optimal_io_size. 1835008 / 512 = 3584 sectors for the optimal size in sectors. The start of a partition should be a multiple of 3584 sectors for optimal performance. To make a single partition for this disk with this alignment,the parted command: mkpart p ext2 3584s 13674214831s This should generate a partition with the optimal alignment and should avoid the warning too.
(parted) mkpart p ext2 3584s 13674214831s
Warning: You requested a partition from 1835kB to 7001GB
The closest location we can manage is 1835kB to 7001GB
Is this still acceptable to you? Yes/No? Yes
(parted) unit s p
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdb: 13674214832s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size Filesystem Name Flags 1 3584s 13674214798s 13674211215s p
参考:http://rainbow.chard.org/2013/01/30/how-to-align-partitions-for-best-performance-using-parted/
http://h20564.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-c03479326&DocLang=en&docLocale=en_US&jumpid=reg_r11944_uken_c-001_title_r0001