linux格式化大于2TB的磁盘

 

常用的fdisk命令只可以格式化小于2TB的磁盘,大于2TB的磁盘需要使用parted进行磁盘分区,磁盘为GPT格式。使用fidks –l 报如下警告

[root@jkkdbserver u01]# fdisk -l

 

Disk /dev/cciss/c0d0: 56.9 GB, 56907448320 bytes

255 heads, 63 sectors/track, 6918 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

           Device Boot      Start         End      Blocks   Id  System

/dev/cciss/c0d0p1   *           1          28      224878+  83  Linux

/dev/cciss/c0d0p2              29        2740    21784140   83  Linux

/dev/cciss/c0d0p3            2741        6917    33551752+  82  Linux swap / Solaris

 

WARNING: The size of this disk is 5.3 TB (5344003645440 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID

partition table format (GPT).

 

 

Disk /dev/cciss/c0d1: 5344.0 GB, 5344003645440 bytes

255 heads, 32 sectors/track, 1279106 cylinders

Units = cylinders of 8160 * 512 = 4177920 bytes

 

           Device Boot      Start         End      Blocks   Id  System

 

 

 

操作过程如下:

[root@jkkdbserver u01]# parted /dev/cciss/c0d1

GNU Parted 1.8.1

使用 /dev/cciss/c0d1

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

(parted) help

  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]                           prints 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 partititon 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 [free|NUMBER|all]                  display the partition table, a partition, or all devices

  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                                  displays the current version of GNU Parted and copyright information

(parted) mkpart

错误: msdos labels do not support devices that have more than 4294967295 sectors.

(parted) mklabel

新的磁盘标签类型?  [msdos]? gpt

(parted) p

 

Model: Compaq 智能阵列 (cpqarray)

Disk /dev/cciss/c0d1: 5344GB

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

Partition Table: gpt

 

Number  Start  End  Size  File system  Name  标志

 

(parted) mkpart

分区名称?  []?

文件系统类型?  [ext2]? ext3

起始点?

起始点? 0

结束点? 500G

(parted) p

 

Model: Compaq 智能阵列 (cpqarray)

Disk /dev/cciss/c0d1: 5344GB

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

Partition Table: gpt

 

Number  Start   End    Size   File system  Name  标志

 1      17.4kB  500GB  500GB

 

(parted) mkpart

分区名称?  []?

文件系统类型?  [ext2]? ext3

起始点? 500G

结束点? 2500G

(parted) p

 

Model: Compaq 智能阵列 (cpqarray)

Disk /dev/cciss/c0d1: 5344GB

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

Partition Table: gpt

 

Number  Start   End     Size    File system  Name  标志

 1      17.4kB  500GB   500GB

 2      500GB   2500GB  2000GB

 

(parted) mkpart

分区名称?  []? /dev/cciss/c0d1

文件系统类型?  [ext2]? ext3

起始点?

起始点? 2000G

结束点? 5000G

警告: You requested a partition from 2000GB to 5000GB.

The closest location we can manage is 2500GB to 5000GB.  Is this still acceptable to you?

/Yes//No? n

(parted) p

 

Model: Compaq 智能阵列 (cpqarray)

Disk /dev/cciss/c0d1: 5344GB

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

Partition Table: gpt

 

Number  Start   End     Size    File system  Name  标志

 1      17.4kB  500GB   500GB

 2      500GB   2500GB  2000GB

 

(parted) mkpart

分区名称?  []?

文件系统类型?  [ext2]? ext3

起始点? 2500GB

结束点?

结束点? 6000G

错误: The location 6000G is outside of the device /dev/cciss/c0d1.

(parted) mkpart

分区名称?  []? /dev/cciss/c0d1

文件系统类型?  [ext2]? ext3

起始点? 2500GB

结束点? 5344GB

(parted) p

 

Model: Compaq 智能阵列 (cpqarray)

Disk /dev/cciss/c0d1: 5344GB

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

Partition Table: gpt

 

Number  Start   End     Size    File system  Name             标志

 1      17.4kB  500GB   500GB

 2      500GB   2500GB  2000GB

 3      2500GB  5344GB  2844GB              

 

(parted) q

信息: 如果必要,不要忘记更新 /etc/fstab

 

[root@jkkdbserver u01]# fdisk -l

 

Disk /dev/cciss/c0d0: 56.9 GB, 56907448320 bytes

255 heads, 63 sectors/track, 6918 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

           Device Boot      Start         End      Blocks   Id  System

/dev/cciss/c0d0p1   *           1          28      224878+  83  Linux

/dev/cciss/c0d0p2              29        2740    21784140   83  Linux

/dev/cciss/c0d0p3            2741        6917    33551752+  82  Linux swap / Solaris

 

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

 

 

WARNING: The size of this disk is 5.3 TB (5344003645440 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID

partition table format (GPT).

 

 

Disk /dev/cciss/c0d1: 5344.0 GB, 5344003645440 bytes

255 heads, 63 sectors/track, 649704 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

           Device Boot      Start         End      Blocks   Id  System

/dev/cciss/c0d1p1               1      267350  2147483647+  ee  EFI GPT

[root@jkkdbserver u01]#

 

[root@bogon ~]# ls -l /dev/cciss

总计 0

brw-r----- 1 root disk 104,  0 08-29 16:37 c0d0

brw-r----- 1 root disk 104,  1 08-29 16:37 c0d0p1

brw-r----- 1 root disk 104,  2 08-29 16:37 c0d0p2

brw-r----- 1 root disk 104,  3 08-29 16:37 c0d0p3

brw-r----- 1 root disk 104, 16 10-11 17:15 c0d1

brw-r----- 1 root disk 104, 17 10-11 17:15 c0d1p1

brw-r----- 1 root disk 104, 18 10-11 17:15 c0d1p2

brw-r----- 1 root disk 104, 19 10-11 17:15 c0d1p3

 

 

 

[root@ jkkdbserver ~]# mkfs -t ext3 /dev/cciss/c0d1p1

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

61046784 inodes, 122070308 blocks

6103515 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

3726 block groups

32768 blocks per group, 32768 fragments per group

16384 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

 

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 39 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

 

 

 

MBRGPT区别。

MBRMBR分区表(即主引导记录)大家都很熟悉,是过去我们使用windows时常用的。

               所支持的最大卷:2T,而且对分区有限制:最多4个主分区或3个主分区加一个扩展分区

    GPT GPT(即GUID分区表)。是源自EFI标准的一种较新的磁盘分区表结构的标准,是未来磁盘分区的主要形式。与MBR分区方式相比,具有如下优点。

             突破MBR 4个主分区限制,每个磁盘最多支持128个分区。支持大于2T的分区,最大卷可达18EB

 

parted命令常用选项。

当在命令行输入parted后,进入parted命令的交互模式。输入help会显示帮助信息。下面就简单介绍一下常用的功能

1Check    简单检查文件系统。建议用其他命令检查文件系统,比如fsck

2Help      显示帮助信息

3mklabel  创建分区表, 即是使用msdosMBR)还是使用gpt,或者是其他方式分区表

4 mkfs    创建文件系统。该命令不支持ext3 格式,因此建议不使用,最好是用parted分好区,然后退出parted交互模式,用其他命令进行分区,比如:mkfs.ext3

5mkpart  创建新分区。

       格式:mkpart PART-TYPE  [FS-TYPE]  START  END

                PART-TYPE类型主要有primary(主分区), extended(扩展分区), logical(逻辑区). 扩展分区和逻辑分区只对msdos

                fs-type  文件系统类型,主要有fs32NTFSext2ext3

                start end 分区的起始和结束位置。

     6mkpartfs建立分区及其文件系统。目前还不支持ext3文件系统,因此不建议使用该功能。最后是分好区后,退出parted,然后用其他命令建立文件系统。

    7print   输出分区信息。该功能有3个选项,

free 显示该盘的所有信息,并显示磁盘剩余空间

number 显示指定的分区的信息

all 显示所有磁盘信息

    8resize  调整指定的分区的大小。目前对ext3格式支持不是很好,所以不建议使用该功能。

9rescue  恢复不小心删除的分区。如果不小心用partedrm命令删除了一个分区,那么可以通过rescue功能进行恢复。恢复时需要给出分区的起始和结束的位置。然后parted就会在给定的范围内去寻找,并提示恢复分区。

   10rm   删除分区。命令格式 rm  number 。如:rm 3 就是将编号为3的分区删除

   11select 选择设备。当输入parted命令后直接回车进入交互模式是,如果有多块硬盘,需要用select 选择要操作的硬盘。如:select /dev/sdb

   12set    设置标记。更改指定分区编号的标志。标志通常有如下几种:boot  hidden   raid   lvm 等。

               boot为引导分区,hidden 为隐藏分区,raid raidlvm 为逻辑分区。

              如:set 3  boot  on  设置分区号3 为启动分区

 

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

转载于:http://blog.itpub.net/15747463/viewspace-774241/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值