Xen 结合 solusvm

XEN supports a wide range of guest operating systems including Windows?, Linux?, Solaris?, and various versions of the BSD operating systems.

SolusVM currently only supports Linux Xen guest (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
Example Partition Layout .....:
/ 80GB + (NOTE: XEN HVM iso's will be stored here)
LVM rest of drive (this must be an '''EMPTY''' logical volume group (VG))
SWAP (4GB max)


SolusVM Installation

In SSH as root do the following:

wget http://soluslabs.com/installers/solusvm/install
chmod 755 install
./install

Select option 2 then option 2, this will now install a SolusVM slave with Xen support. 
 

 
 
 
 

Once the installer has completed, follow the instructions given, to boot into the new Xen kernel and setup the SolusVM kernel links and ramdisk.

Login to your SolusVM master and select  "Nodes" and click "Add Node".

 

This guide will help you to add a node to your SolusVM management panel.

Before reading this guide, you will need to have installed SolusVM as a slave and collected the relevant information during the installation. If you haven't done so already, follow my guide here on how to do so: Coming Shortly!

Hover over "Nodes" and click "Add Node".

Node Name

Here you can enter a name for your node so that you can recognise it easily. Some use "Node1" or some use "Server 1", however, you can use whatever you please

IP Address

Here, you need to enter the IP address of the slave server you just made.

Hostname

Here, you need to enter the Hostname of the slave server you just made.

SSH Port

Here, you need to enter the SSH port of the slave server you just made.

ID Key

Here, you need the enter the identification key that the SolusVM slave installer gave you.

ID Password

Here, you need to enter the identification password the SolusVM installer gave you.

Country

Here, you can enter the country where the server is located.

City

Here, you can enter the City where the server is located.

LV Group (Xen and KVM ONLY)  参最后的说明:如何创建LVg

Here, you will need to enter the name of your Volume Group, you can find this by running "vgdisplay" in SSH on the Slave without the quotes.

Add Node

That's it! Done. The management server will now attempt to connect to the slave and verify any needed data such as OpenVZ installation and the correct variables for the SolusVM slave installation.

At the bottom of the form you will need to specify the LVM partition name i.e: /dev/vps can be entered as vps, you don't need to specify the full path.
 

Once you submit the server details to SolusVM, it will check connections and if the LVM exists so make sure you have all the details correct.

SolusVM will support multiple LVM partitions over the coming months.

SolusVM Xen Templates

SolusVM requires templates to be formated in a certain way. This formatting is essential and must be followed!

Template format:

distro-version-arch-anything.tar.gz
i.e: centos-5.3-x86-base.tar.gz

Currently supported linux distributions are : CentOS, Fedora, Debian, Ubuntu, Gentoo, Slackware Only XEN HVM does support Windows, if XEN HVM doesn't works make sure that you've got a virtualization technique and this is enabled (look into the 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

-------------------------------------------------------------------------

(T002)


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 

 

 

减少逻辑卷的大小:

[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/

你可能感兴趣的:(职场,xen,休闲,solusvm)