Linux Parted创建分区(超过2T不能使用fdisk创建)

root@prdweb2:/root# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdb

Using /dev/sdb

(parted) p                                                                
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdb: 2199GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt


Number  Start  End  Size  File system  Name  Flags

(parted) mkpart
Partition name?  []?                                                      
File system type?  [ext2]? ext4                                           
Start? 0                                                                  
End? 1024G
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                     
(parted) mkpart                                                           
Partition name?  []?                                                      
File system type?  [ext2]? ext4                                           
Start? 1024G
End? 2199G                                                                
(parted) p                                                                
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdb: 2199GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt


Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  1024GB  1024GB
 2      1024GB  2199GB  1175GB

(parted) select /dev/sdb
Using /dev/sdb

(parted) toggle 1 lvm


pvcreate /dev/sdb1 

vgcreate vg03 /dev/sdb1

lvcreate -n /dev/vg03/lvbackup -L 1024G vg03

mkfs.ext4 /dev/vg03/lvbackup

mount -t ext4 /dev/vg03/lvbackup /backup


解决,Warning: The resulting partition is not properly aligned for best performance.

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%




你可能感兴趣的:(Linux)