环境:
系统硬件:vmware vsphere (CPU:2*4核,内存2G)
系统版本:Linux centos 2.6.32-431.17.1.el6.x86_64(Centos-6.5-x86_64-minimal.iso )
需要挂载的硬盘:/dev/sdb
升级步骤:
0.系统环境
[[email protected] ~]# uname -r
2.6.32-431.17.1.el6.x86_64
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
1.查看当前挂载信息
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 14G 884M 13G 7% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/sda1 485M 54M 407M 12% /boot
2.查看硬盘信息(只看/dev/sdb 这个新加硬盘)
...略
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb819ae09
Device Boot Start End Blocks Id System
...略
3.硬盘分区及4K对齐
[[email protected] ~]# fdisk -H 224 -S 56 /dev/sdb
WARNING: DOS-compatible mode is deprecated. It‘s strongly recommended to
switch off the mode (command ‘c‘) and change display units to
sectors (command ‘u‘).
Command (m for help):
3.1 第一个区操作,按下列步骤操作
n p 1 回车 +10G 回车
3.2第一个区操作,按下列步骤操作
n p 2 回车 +5G 回车
3.1第一个区操作,按下列步骤操作
n p 3 回车 回车
3.4 保存退出
w
4.查看硬盘信息(只看/dev/sdb 这个新加硬盘)
[[email protected] ~]# fdisk -lu
...略
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
224 heads, 56 sectors/track, 5015 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb819ae09
Device Boot Start End Blocks Id System
/dev/sdb1 56 20986111 10493028 83 Linux
/dev/sdb2 20986112 31485439 5249664 83 Linux
/dev/sdb3 31485440 62908159 15711360 83 Linux
...略
每个分区的Start能被8整除,即代表此分区已经4K对齐
5.格式化,创建分区文件系统
[[email protected] ~]# mkfs.ext4 /dev/sdb1
[[email protected] ~]# mkfs.ext4 /dev/sdb2
[[email protected] ~]# mkfs.ext4 /dev/sdb3
6.挂载分区
6.1需要保存挂载的目录真实存在
[[email protected] ~]# mkdir -p /data
6.2 修改文件,以便重启也能挂载目录到分区
[[email protected] ~]# vim /etc/fstab
echo ‘/dev/sdb1 /home ext4 defaults 0 0‘
echo ‘/dev/sdb2 /data ext4 defaults 0 0‘
echo ‘/dev/sdb3 /tmp ext4 defaults 0 0‘
保存退出
6.3挂载分区
[[email protected] ~]# mount -a
7.重启系统
[[email protected] ~]# shutdown -r now
8.查看分区挂载信息
[[email protected] ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 14G 884M 13G 7% /
/dev/sda1 485M 54M 407M 12% /boot
tmpfs 939M 0 939M 0% /dev/shm
/dev/sdb1 9.9G 151M 9.3G 2% /home
/dev/sdb2 5.0G 139M 4.6G 3% /tmp
/dev/sdb3 15G 166M 14G 2% /data
9.查看分区读取速度
time dd if=/dev/zero of=/data/test.file bs=1M count=500