Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1068293
  • 博文数量: 83
  • 博客积分: 159
  • 博客等级: 上尉
  • 技术积分: 2221
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-15 17:08
个人简介

……致我那曾经苦逼的岁月……

文章分类
文章存档

2018年(1)

2017年(7)

2016年(13)

2014年(1)

2013年(12)

2012年(27)

2011年(22)

分类: LINUX

2012-07-05 15:43:44

环境及需求描述:公司准备上云存储,数据节点准备采用2T一块的硬盘,所以需要在DELL2950服务器安装操作系统(红帽4.8),硬盘四块2T的。准备做RAID5。可用磁盘容量为6T。
上午查询资料后因为操作系统版本比较低,ext3最大的分区支持2T,所以不能按照平常的方式安装。这里提供一个步骤做参考。
1、将四块硬盘插好,开机启动。
2、进入RAID模式,选中四块硬盘做RAID5,这里步骤不详述,不会的朋友请电话咨询DELL,记得把RAID大小设置2T以下,我这里设置了500G的容量,供操作系统使用。剩余的空间准备另划为一个分区存放数据块文件。不然会出现可以安装,但是安装后reboot系统起不来。
3、像正常一样安装操作系统。(我这里分区主要是/boot、\,swap、3个分区占用500G空间)
4、重启再次进入RAID模式,将6T减去500G的容量再划分为一个RAID,当然这里我把所有的剩余容量都选上了,还是那句话不会的咨询DELL。
5、这时候启动后我们fdisk -l会看到如下界面,将近有5.3T容量未使用。
[root@hadoop2 ~]# fdisk -l
Disk /dev/sda: 536.8 GB, 536868814848 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       64225   515782890   83  Linux
/dev/sda3           64226       65269     8385930   82  Linux swap
Disk /dev/sdb: 5462.6 GB, 5462663626752 bytes
255 heads, 63 sectors/track, 664131 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
在linux下大磁盘的分区不能再采用fdisk了,MBR分区表只支持2T磁盘,所以大于2T的磁盘必须使用GPT分区表。下面说明下具体的步骤:
6、执行parted命令
[root@hadoop2 opt]# parted
GNU Parted 1.6.19
Copyright (C) 1998 - 2004 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.
Using /dev/sda
(parted) select /dev/sdb
Using /dev/sdb
(parted) mklabel gpt   将MBR磁盘格式化为GPT
然后我们可以输入p查看一下当前有没有分区
(parted) p                                                               
Disk geometry for /dev/sdb: 0.000-5209602.000 megabytes
Disk label type: gpt
Minor    Start       End     Filesystem  Name                  Flags
(parted) mkpart primary 0 5209600     分一个5.3T的主分区,这里默认是M为单位结尾
然后我们再查看一下分区情况:
(parted) p                                                               
Disk geometry for /dev/sdb: 0.000-5209602.000 megabytes
Disk label type: gpt
Minor    Start       End     Filesystem  Name                  Flags
1          0.017 5209600.000  ext3   
如果分区不对可以执行rm 1删除,再进行创建!1就是Minor对应的号码!
最后我们退出
(parted) quit                                                            
Information: Don't forget to update /etc/fstab, if necessary.   退出时会提示你修改fstab文件
7、分区完成了,然后我们要格式化文件系统了,需要一段时间哈!
[root@hadoop2 opt]# mkfs.ext3 /dev/sdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
666828800 inodes, 1333657595 blocks
23733206 blocks (1.78%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
40700 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 (8192 blocks): done
Writing superblocks and filesystem accounting information:   出现这一步直接回车就行
done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
8、fdisk -l查看分区情况
[root@hadoop2 opt]# fdisk -l
Disk /dev/sda: 536.8 GB, 536868814848 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       64225   515782890   83  Linux
/dev/sda3           64226       65269     8385930   82  Linux swap
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 5462.6 GB, 5462663626752 bytes
255 heads, 63 sectors/track, 664131 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      267350  2147483647+  ee  EFI GPT
9、挂载文件系统
[root@hadoop2 opt]# mount -t ext3 /dev/sdb1 /data/      data目录是新建的
10、df查看容量和挂载情况
[root@hadoop2 opt]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda2     ext3    485G  7.6G  453G   2% /
/dev/sda1     ext3     99M   14M   81M  15% /boot
none         tmpfs    2.0G     0  2.0G   0% /dev/shm
/dev/sdb1     ext3    4.9T   93M  4.9T   1% /data
11、实现开机自动挂载,在/etc/fstab文件增加如下一行:
/dev/sdb1               /data                   ext3    defaults        0 0
这样基本就完成了分区支持2T以上的文件系统了。



 
 
 
阅读(3008) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~