今天买了一台腾讯云主机,先对比说下阿里云主机,我的系统也是centos6.5 64位 首先腾讯服务器系统磁盘竟然只给8G空间,也是醉了。而且腾讯云主机的network服务我不喜欢。不过价格对比阿里云还是便宜很多。
1;查看挂载及我的磁盘状况
[root@VM_154_77_centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 7.9G 1005M 6.5G 14% /
同时自己也买了块云磁盘
Disk /dev/vdb: 21.5 GB, 21474836480 bytes
16 heads, 56 sectors/track, 5851 cylinders
Units = cylinders of 896 * 4096 = 3670016 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
2;搭建lvm#划分2个lv 一个用来挂载到/usr/local/soft 一个挂载到/data/mysql/data
2;1创建pv vg lv
创建pv
[root@VM_154_77_centos ~]# pvcreate /dev/vdb
Physical volume "/dev/vdb" successfully created
创建vg
[root@VM_154_77_centos ~]# vgcreate xiangys /dev/vdb ##xiangys表示vg名称
Volume group "xiangys" successfully created
创建lv ##记得有2个lv哦。
[root@VM_154_77_centos ~]# lvcreate -n mylv -L 5G xiangys
Logical volume "mylv" created
##等等我这个命名好像不科学,删除掉这个lv fdisk查看磁盘信息
Disk /dev/mapper/xiangys-mylv: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 81 cylinders
Units = cylinders of 16065 * 4096 = 65802240 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
[root@VM_154_77_centos ~]# lvremove /dev/mapper/xiangys-mylv
Do you really want to remove active logical volume mylv? [y/n]: y
Logical volume "mylv" successfully removed
##好了我再命名给科学点的lv
[root@VM_154_77_centos ~]# lvcreate -n mylvsoft -L 5G xiangys
Logical volume "mylvdata" created
[root@VM_154_77_centos ~]# lvcreate -n mylvdata -L 14G xiangys
Logical volume "mylvdata" created
------------------------------------------------------------------------------------------------
两个lv都创建好了
Disk /dev/mapper/xiangys-mylvsoft: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 81 cylinders
Units = cylinders of 16065 * 4096 = 65802240 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Note: sector size is 4096 (not 512)
Disk /dev/mapper/xiangys-mylvdata: 15.0 GB, 15032385536 bytes
255 heads, 63 sectors/track, 228 cylinders
Units = cylinders of 16065 * 4096 = 65802240 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
2;2格式化磁盘分区并且创建文件系统
[root@VM_154_77_centos ~]# mkfs.ext4 /dev/mapper/xiangys-mylvsoft
[root@VM_154_77_centos ~]# mkfs.ext4 /dev/mapper/xiangys-mylvdata
2;3挂载分区
[root@VM_154_77_centos ~]# mkdir /usr/local/soft
[root@VM_154_77_centos ~]# mkdir -p /data/mysql/data
[root@VM_154_77_centos ~]# vi /etc/fstab
添加
/dev/mapper/xiangys-mylvsoft /usr/local/soft ext4 defaults 0 0
/dev/mapper/xiangys-mylvdata /data/mysql/data ext4 defaults 0 0
##备注lv刚刚查了下看不了system id 挂载的0 0 表示不检查 不好的地方如果磁盘故障了 找了个例子
如果做成 1 2 defaults表示默认读写等操作 可以做成只读 1 表示支持dump备份 2表示fsck检测 默认/检测为1
我在直接做磁盘分区的时候,发现创建的文件系统可以更改system ID lv貌似不行