Redhat下挂载大小超过2T存储的方法

附件大文件等应用需要直接部署到存储上,安装linux时建议把所有包全勾选上,如果采用默认安装,不同厂家的存储驱动将会很难装上,提示系统少包,甚至少什么包都不太清楚。当把存储分配给你的HBA光纤卡后,在服务器上装好HBA卡驱动并重启系统,就可以用 fdisk -l 命令查看存储信息了。

 

在使用存储之前需要对存储进行分区操作,在RHEL5.4上用fdisk命令分区最大磁盘分区只能在2T以下,故以下采用parted对存储进行分区: 

 

(红色部分代表需要输入的命令)

 

[root@oa-1 ~]# fdisk -l           //查看磁盘信息 

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

 

WARNING: The size of this disk is 3.2 TB (3221225472000 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/sda: 3221.2 GB, 3221225472000 bytes 

255 heads, 63 sectors/track, 391625 cylinders 

Units = cylinders of 16065 * 512 = 8225280 bytes  

         Device Boot  Start  End  Blocks  Id  System 

Disk /dev/cciss/c0d0: 293.5 GB, 293563949056 bytes 

255 heads, 63 sectors/track, 35690 cylinders 

Units = cylinders of 16065 * 512 = 8225280 bytes

         Device     Boot  Start  End   Blocks  Id  System 

/dev/cciss/c0d0p1  *     1   13    104391  83  Linux 

/dev/cciss/c0d0p2      14  35690  286575502+  8e  Linux LVM 

 

[root@oa-1 ~]# parted /dev/sda    //parted命令分区

 GNU Parted 1.8.1 

使用/dev/sda 

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

(parted)  mklabel GPT  // 建立磁盘label

警告: The existing disk label on /dev/sda will be destroyed and all data on  this disk will be lost. Do you want to continue? 

parted: invalid token: GPT 

/Yes//No? 

新的磁盘标签类型?[gpt]?  直接回车

(parted)  mkpart              //创建分区

 分区名称? []?  sda1 

文件系统类型?[ext2]?          直接回车

起始点? 0  

结束点? 3200000    //根据分配给你的存储大小设置(这里大概为2.8T

 (parted)  p                //查看刚创建的分区是否已经成功

Model: HP HSV450 (scsi) 

Disk /dev/sda: 3221GB 

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

Partition Table: gpt

 Number  Start  End    Size    File system  Name  标志 

1    17.4kB  3200GB  3200GB  ext3   sda1   

(parted)  quit

信息如果必要,不要忘记更新 /etc/fstab    //系统显示内容

 

[root@oa-1 ~]# mkfs.ext3 /dev/sda1      //创建文件系统

 mke2fs 1.39 (29-May-2006) 

Filesystem label= 

OS type: Linux 

Block size=4096 (log=2) 

Fragment size=4096 (log=2) 

390627328 inodes, 781249995 blocks 

39062499 blocks (5.00%) reserved for the super user 

First data block=0 

Maximum filesystem blocks=4294967296 

23842 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, 214990848, 512000000, 550731776, 644972544

 

Writing inode tables: done 

Creating journal (32768 blocks): done 

Writing superblocks and filesystem accounting information: done 

This filesystem will be automatically checked every 20 mounts or 180 days, whichever comes first.Use tune2fs -c or -i to override. 

[root@oa-1 ~]# mkdir /storage       //创建挂载点 

[root@oa-1 ~]# mount /dev/sda1 /storage    //挂载存储磁盘

 [root@oa-1 ~]# 

 

为了在每次系统启动时自动挂载新分区,需要修改 /etc/fstab 文件来进行自动挂载。在文件的末位加入如下一行:

/dev/sda1 /storage ext3 defaults 1 2 

这样服务器每次启动都会自动挂载此分区

 

请使用浏览器的分享功能分享到微信等