|
XEN 支持很多客户机系统,包括Windows, Linux, Solaris,以及各种版本的 BSD 操作系统.
SolusVM目前只支持Linux Xen 客户机(CentOS, Fedora, Debian, Ubuntu, Gentoo, Slackware).
***************系统要求***************
Operating System .............: CentOS 5 (32 or 64 bit)
Processor.....................: Dual Core or higher
Memory .......................: 4GB or higher
Hard Disk ....................: 100GB or higher
***************推荐分区实例: ***************
/ 80GB + (注意,Xen HVM的ISP文件不存储在这里)
SWAP (4GB max)
LVM 其他的空间 (必须是'EMPTY' logical volume group (VG))
***************SolusVM 安装***************
登陆SSH运行如下命令
- wget http://soluslabs.com/installers/solusvm/install
- chmod 755 install
- ./install
复制代码
选择2,在选择2开始安装支持XEN的 SolusVM slave。
安装结束后,按照说明启动到新的Xen核心,然后安装SolusVM核心连接和ramdisk。
登陆 SolusVM master 选择 "Nodes" 然后点击 "Add Node".
向导将会引导你添加一个SolusVM管理面板的节点。
在阅读向导之前,你需要作为slave安装SolusVM ,搜集安装过程中的信息。如果还没有完成这个,请按照下面的说明来操作!
滑过 "Nodes" 点击 "Add Node".
Node Name
节点名称,你可以随便起名字,只要使用的时候能记住他,比如Node1 或者Server1 等等。
IP Address
这里需要你输入你刚刚建立的slave server的Ip地址
Hostname
这里,给slave server输入一个Hostname(主机名)
SSH Port
这里输入SSH端口
ID Key
这里驶入识别Key
ID Password
输入ID的密码
Country
输入国家
City
城市
LV Group (Xen and KVM ONLY) 参最后的说明:如何创建LVg
这里输入卷标名,你可以通过在SSH输入命令vgdisplay来找到这个。
Add Node
添加节点
这样就完毕了,你可以试着连接你的slave服务器,来确认数据,例如OpenVZ安装和正确的SolusVM安装类别。
表格的最后,你需要确认LVM分区的名称,比如/dev/vps,可以输入vps,不需要指定完整的路径。
一旦你提交了服务器的详细信息到SolusVM,他会检查连接,如果LVM存在,他会确认所有信息正确。
SolusVM在随后的操作中,将支持多个LVM分区
SolusVM Xen Templates (SolusVM Xen 模板)
SolusVM要求模板以特定的格式构成,这个格式必须严格遵守!
模板格式:
distro-version-arch-anything.tar.gz (系统类型-版本-位数-其他.tar.gz)
例如: centos-5.3-x86-base.tar.gz
目前支持的Linux发行版本包括:CentOS, Fedora, Debian, Ubuntu, Gentoo, Slackware
只有XEN HVM支持 Windows
如果XEN HVM不支持Windows, 那你需要确认你是否已经安装了虚拟化技术支持,同时并开启他它(在BIOS里查看)。
The slave installation will install a standard CentOS 5 template on the slave but not on the master. You can download this template from here: http://files.soluslabs.com/solusvm/install/centos-5.3-x86.tar.gz and save it to the master template store: /home/solusvm/xen/template.
********************Linux AS4系统下LVM的使用详细解析********************
查看:
物理卷:(PV)
# pvscan
# pvdisplay
卷组:(VG)
# vgs
# vgdisplay
逻辑卷
# lvs
# lvdisplay
1:创建PV(物理分区)
假设我的磁盘有一部分没有划分的分区:
fdisk /dev/sda
查看现在的分区
Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 143 1044225 82 Linux swap
/dev/sda3 144 2055 15358140 83 Linux
创建一个新分区:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e(选择创建扩展分区)
Selected partition 4
First cylinder (2056-2610, default 2056):
Using default value 2056
Last cylinder or +size or +sizeM or +sizeK (2056-2610, default 2610):
Using default value 2610
前面的分区还没有用完磁盘,继续创建另一个分区:
Command (m for help): n
First cylinder (2056-2610, default 2056):
Using default value 2056
Last cylinder or +size or +sizeM or +sizeK (2056-2610, default 2610): 2300
Command (m for help): n
First cylinder (2301-2610, default 2301):
Using default value 2301
Last cylinder or +size or +sizeM or +sizeK (2301-2610, default 2610):
Using default value 2610
查看已经划分好的分区:
Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 143 1044225 82 Linux swap
/dev/sda3 144 2055 15358140 83 Linux
/dev/sda4 2056 2610 4458037+ 5 Extended
/dev/sda5 2056 2300 1967931 83 Linux
/dev/sda6 2301 2610 2490043+ 83 Linux
w(存盘,退出)
从上面看,sda5和sda6是新创建的分区,ID号为8e(也就是 linux LVM)
现在将新创建的分区修改他们的系统ID
[root@oracle ~]# fdisk /dev/sda
Command (m for help): t
Partition number (1-6): 5
Hex code (type L to list codes): L
Hex code (type L to list codes): 8e
Changed system type of partition 5 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-6): 6
Hex code (type L to list codes): 8e
Changed system type of partition 6 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
使分区信息生效:
[root@oracle ~]# partprobe
[root@oracle ~]# reboot
创建PV(物理卷)
[root@oracle ~]# pvcreate /dev/sda5 /dev/sda6
Physical volume "/dev/sda5" successfully created
Physical volume "/dev/sda6" successfully created
创建物理卷组rootvg,
并把/dev/sda5 /dev/sda6加入其中:
[root@oracle ~]# vgcreate rootvg /dev/sda5 /dev/sda6
Volume group "rootvg" successfully created
在物理卷组上创建一个100MB的逻辑卷lv1:
[root@oracle ~]# lvcreate -L 100M -n lv1 rootvg
Logical volume "lv1" created
格式化分区:
[root@oracle ~]# mkfs.ext3 /dev/rootvg/lv1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
25688 inodes, 102400 blocks
5120 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
1976 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
将lv1挂载到/mnt/lvm下
[root@oracle ~]# mkdir /mnt/lvm
[root@oracle ~]# mount /dev/rootvg/lv1 /mnt/lvm/
[root@oracle ~]#
[root@oracle lvm]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 15G 2.4G 12G 18% /
/dev/sda1 99M 8.6M 86M 10% /boot
none 125M 0 125M 0% /dev/shm
/dev/mapper/VolGroup00-LogVol02
9.1G 53M 8.6G 1% /home
/dev/mapper/VolGroup00-LogVol00
9.7G 55M 9.1G 1% /opt
/dev/mapper/VolGroup00-LogVol01
1008M 34M 924M 4% /tmp
/dev/mapper/rootvg-lv1
97M 5.6M 87M 7% /mnt/lvm
动态加大VG:
这里我们新增一个PV并加入VG
1 fdisk增加一个(0x)8e标志的分区/dev/hda7
2 vgextend rootvg /dev/hda7
好了,vg增大了
缩小逻辑卷组VG:
1 搬移PV中的资料(只限于同一VG中)
#pvmove [-n ] []
如
#pvmove /dev/hda5 /dev/hda6
将VG中pv hda5的内容搬移到hda6中
pvmove /dev/hda5(也可以这样,lvm决定hda2的内容被复制到哪里)
2 vgreduce rootvg /dev/hda5
把vg hda5移除
5) 如何删除逻辑卷/逻辑卷组
删除VG流程:
1 umount /挂接点
2 lvremove /dev/rootvg/lv1
移除逻辑卷,这里是lv1
3 vgchange -a n rootvg(关闭rootvg)
4 vgremove rootvg
移除rootvg
删除分区:
fdis /dev/sda
Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 143 1044225 82 Linux swap
/dev/sda3 144 2055 15358140 83 Linux
/dev/sda4 2056 2610 4458037+ 5 Extended
/dev/sda5 2056 2300 1967931 8e Linux LVM
/dev/sda6 2301 2610 2490043+ 8e Linux LVM
Command (m for help): d
Partition number (1-6): 4
Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 143 1044225 82 Linux swap
/dev/sda3 144 2055 15358140 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@oracle lvm]# partprobe
[root@oracle lvm]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 15G 2.4G 12G 18% /
/dev/sda1 99M 8.6M 86M 10% /boot
none 125M 0 125M 0% /dev/shm
/dev/mapper/VolGroup00-LogVol02
9.1G 53M 8.6G 1% /home
/dev/mapper/VolGroup00-LogVol00
9.7G 55M 9.1G 1% /opt
/dev/mapper/VolGroup00-LogVol01
1008M 34M 924M 4% /tmp
6) lvm相关命令
这个表格,你可以在RHCE_Study_Guide.pdf上找到
Physical Volume Volume Group Logical Volume
-------------------------------------------------------------------------
scan pvscan vgscan lvscan
create pvcreate vgcreate lvcreate
display pvdispaly vgdisplay lvdisplay
remove pvremove vgremove lvremove
减少逻辑卷的大小:
[root@oracle lvm]# umount /mnt/lvm/
[root@oracle /]# umount /mnt/lvm/
[root@oracle /]# cd /mnt/lvm/
[root@oracle lvm]# ls
[root@oracle lvm]# mke2fs -n /dev/rootvg/lv1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
76912 inodes, 307200 blocks
15360 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
38 block groups
8192 blocks per group, 8192 fragments per group
2024 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Block size=1024(bytes)
307200 blocks
lv1分区大小=1024×307200/1024/1024=300(MB)
307200个blocks组成了300M,如果我们要减小50M,应该减少多少blocks?
307200 x
------ =-----
300 50
x=307200X50/300=51200
[root@oracle lvm]# mke2fs -f /dev/rootvg/lv1
mke2fs: bad fragment size - /dev/rootvg/lv1
[root@oracle lvm]# resize2fs -f /dev/rootvg/lv1
resize2fs 1.35 (28-Feb-2004)
The filesystem is already 307200 blocks long. Nothing to do!
调整lv分区大小,减小50M
[root@oracle lvm]# lvreduce -L-50M /dev/rootvg/lv1
Rounding up size to full physical extent 48.00 MB
WARNING: Reducing active logical volume to 252.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv1? [y/n]: y
Reducing logical volume lv1 to 252.00 MB
Logical volume lv1 successfully resized
重新挂载:
[root@oracle lvm]# mount /dev/rootvg/lv1 /mnt/lvm/
删除
[root@oracle lvm]# umount /mnt/lvm/
aa lost+found/
|
|