规划
/dev/sda 安装Linux操作系统,CentOS-6.6
/dev/sdb Mysql数据文件和二进制文件单独放在一块硬盘,磁盘做成LVM逻辑卷方便以后扩充
?
+--------------------------------------------------------------------------+
| ? 1、查看磁盘 |
+--------------------------------------------------------------------------+
?
root@nginx1 ~ > fdisk -l /dev/sdb ? 数据盘,大小为300G
?
Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe562e562
?
? ?Device Boot ?Start End ?Blocks ? Id ?System
root@nginx1 ~ >?
?
+--------------------------------------------------------------------------+
|2、进行分区,并配置LVM|
+----------------------------------------------------------- ---------------+
1) 进行分区
root@nginx1 ~ > fdisk /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): p
?
Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe562e562
?
? ?Device Boot ?Start End ?Blocks ? Id ?System
?
Command (m for help): n
Command action
? ?e ? extended
? ?p ? primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-36472, default 1):?
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-36472, default 36472):?
Using default value 36472
Command (m for help): t
Selected partition 1
?
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
?
Command (m for help): p ?
?
Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe562e562
?
? ?Device Boot ?Start End ?Blocks ? Id ?System
/dev/sdb1 ? 1 ? 36472 ? 292961308+ ?8e ?Linux LVM
?
Command (m for help):?
Command (m for help): w
The partition table has been altered!
?
Calling ioctl() to re-read partition table.
Syncing disks.
root@nginx1 ~ > partprobe /dev/sdb
?
root@nginx1 ~ > cat /proc/partitions?
major minor ?#blocks ?name
?
? ?80 ?143374740 sda
? ?81 204800 sda1
? ?828388608 sda2
? ?83 ?107315200 sda3
? ?84 ?1 sda4
? ?85 ? 20971520 sda5
? ?8 ? 16 ?292968750 sdb
? ?8 ? 17 ?292961308 sdb1
root@nginx1 ~ >?
?
2) 配置LVM
root@nginx1 ~ > pvcreate /dev/sdb1
? Physical volume "/dev/sdb1" successfully created
root@nginx1 ~ > vgcreate mysql-vg /dev/sdb1
? Volume group "mysql-vg" successfully created
root@nginx1 ~ > lvcreate -L 250G -n mysql-lv mysql-vg
? Logical volume "mysql-lv" created
root@nginx1 ~ > lvs
? LV ? VG ? Attr ? LSize ? Pool Origin Data% ?Meta% ?Move Log Cpy%Sync Convert
? mysql-lv mysql-vg -wi-a----- 250.00g
root@nginx1 ~ >?
?
?
+--------------------------------------------------------------------------+
|3、进行格式化===> 格式化为xfs 文件系统|
+----