parted 分区

       由于河南客户平台的存储有8.5T,用fdisk分区最大只能2T,所以我尝试使用parted分区。
 环境: centos 6.0
介绍2种分区表:
MBR分区表:(MBR含义:主引导记录)
所支持的最大卷:2T (1TB=1024GB)
对分区的设置:最多4个主分区或3个主分区加一个扩展分区。

GPT分区表:  (GPT含义:GUID 分区表)
支持最大卷:18EB  (1EB=1024TB)
每个磁盘最多支持128个分区

如果要大于2TB的卷或分区就必须得用GPT分区表。
linux 下fdisk 工具不支持GPT,得使用另一个GNU发布的强大分区工具parted。
 操作如下:


[root@GAPT01 ~]# parted /dev/xvdf
GNU Parted 2.1
使用 /dev/xvdf
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help        -----帮助信息                                                    
  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
(parted) mklabel gpt                                                     
警告: The existing disk label on /dev/xvdf will be destroyed and all data on this disk will be lost. Do
you want to continue?
是/Yes/否/No? yes                                                        
(parted) print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdf: 8590GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  标志

(parted) mkpart primary 0 8.6TB                                          
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? cancel
(parted) mkpart primary 0 4TB                                            
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? cancl                                           
parted: invalid token: cancl
忽略/Ignore/放弃/Cancel? cancel                                          
(parted) mkpart primary 0kb 8500GB
警告: You requested a partition from 0.00B to 8500GB.                    
The closest location we can manage is 17.4kB to 8500GB.
Is this still acceptable to you?
是/Yes/否/No? yes                                                        
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? ignore                                          
(parted) print                                                           
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdf: 8590GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     标志
 1      17.4kB  8500GB  8500GB               primary

(parted) quit                                                            
信息: You may need to update /etc/fstab.                                 

[root@GAPT01 ~]# fdisk -l

Disk /dev/xvda: 193.3 GB, 193273528320 bytes
255 heads, 63 sectors/track, 23497 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078088

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2              26       13080   104857600   83  Linux
/dev/xvda3           13080       15691    20971520   83  Linux
/dev/xvda4           15691       23498    62708736    5  Extended
/dev/xvda5           15691       17780    16777216   82  Linux swap / Solaris
/dev/xvda6           17780       23498    45929472   83  Linux

Disk /dev/xvdd: 0 MB, 370688 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

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

Disk /dev/xvde: 186.8 GB, 186831077376 bytes
255 heads, 63 sectors/track, 22714 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

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

WARNING: GPT (GUID Partition Table) detected on '/dev/xvdf'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/xvdf: 8589.9 GB, 8589934592000 bytes
255 heads, 63 sectors/track, 1044333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdf1               1      267350  2147483647+  ee  GPT
[root@GAPT01 ~]# mkfs.ext4 /dev/xvdf1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
518799360 inodes, 2075195308 blocks
103759765 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
63330 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848, 512000000, 550731776, 644972544, 1934917632

正在写入inode表: 完成                           
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@GAPT01 ~]# mount /dev/xvdf1 /oradata
[root@GAPT01 ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/xvda2             99G   18G   77G  19% /
tmpfs                  16G  344K   16G   1% /dev/shm
/dev/xvda1            194M   42M  143M  23% /boot
/dev/xvda6             44G  2.7G   39G   7% /home
/dev/xvda3             20G  833M   18G   5% /var
/dev/xvdf1            7.7T  176M  7.3T   1% /oradata

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


#
# /etc/fstab
# Created by anaconda on Mon Jul  7 10:00:17 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=e6dafb29-c18d-4f5a-b64f-2a105a6a9681 /                       ext4    defaults        1 1
UUID=376dc87c-7fb6-4c7e-88d6-edea323a480b /boot                   ext4    defaults        1 2
UUID=1c3d22e9-462f-4547-8416-eb43df7784d2 /home                   ext4    defaults        1 2
UUID=76111c63-9717-4b13-afd4-dcebe4c629ae /var                    ext4    defaults        1 2
UUID=c1c471b9-d613-4e06-a42d-83d023d1b67b swap                    swap    defaults        0 0
tmpfs        /dev/shm                tmpfs   defaults        0 0
devpts       /dev/pts                devpts  gid=5,mode=620  0 0
sysfs        /sys                    sysfs   defaults        0 0
proc         /proc                   proc    defaults        0 0
/dev/xvdf1   /oradata                ext4    defaults        0 2
~
重启自动挂载,整个分区完成。
感言: 经验在每次的尝试中积累。虽然这个命令自己以前没用过,但有了这一次的尝试,下次用起来就会得心应手。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22969361/viewspace-1221123/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22969361/viewspace-1221123/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值