Linux shell----服务器硬盘扩容

公司弄了台DELL刀片服务器,硬盘只有1T,需要扩展空间。一直不懂怎样配置RAID,所以抽空写此篇幅记录下在Linux下配置磁盘阵列RAID的过程。

确认服务器类型

 DELL刀片服务器的硬盘托架有几种不同的型号,需要确认服务器类型才能买对硬盘托架。

确认配置RAID类型

 根据硬盘资源的数量确认需要设置的RAID类型,因为我们只有4块1.2T的硬盘,考虑性能及数据的安全性,此次配置我选择的是RAID5。

配置RAID

 RAID配置可以通过bios去配置,也可以通过MegaCli64命令来配置,我选择后者。

硬盘格式化分区

 因为通过RAID5配置后的硬盘空间有3.5T,我希望配置成一个盘3.5T,但fdisk命令只支持最大2T,parted命令可以支持大于2T,所以最终我确认用parted命令来实现硬盘分支。

[root@Demo ~]# parted /dev/sdb 

GNU Parted 2.1

Using /dev/sdb

Welcome to GNU Parted! Type 'help' to view a list of commands. //提示help会列举命令

(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 //将MBR磁盘格式化为GPT

(parted) mkpart /dev/sdb1 //分区1

File system type? [ext2]? ext4 //文件系统类型

Start? 0 //柱头开始

End? 10GB //分区结束位置

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

Ignore/Cancel? Ignore

(parted) print //打印分区

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 21.5GB

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

Partition Table: gpt

Number Start End Size File system Name Flags

1     17.4kB  10.0GB  10000MB               /dev/sdb1

设置开机自挂载

 硬盘格式化后,需要开机自动挂载,配置方式如下:

挂载

[root@Demo ~]# mount /dev/sdb1 /home/data

开机自挂载

vim /ets/fstab

添加

/dev/sdb1 /home/data ext4 defaults 0 0

猜你喜欢

转载自blog.csdn.net/subkiller/article/details/85528655