網頁

顯示具有 技術---Hyper-V 標籤的文章。 顯示所有文章
顯示具有 技術---Hyper-V 標籤的文章。 顯示所有文章

2013年6月22日 星期六

CentOS 6.3 --- Add GNOME Desktop Environment into CentOS Minimal installation

If execute graphical tool on a minimal installation of CentOS 6.3, it will cause the failure that this tool cannot be initialized.
ScreenHunter_01This is why I want to add a GUI to CentOS at the moment.

For installing Gnome Desktop, we can execute the yum command as yum groupinstall basic-desktop desktop-platform x11 fonts to download & install the related packages from Internet.
ScreenHunter_21ScreenHunter_22To start X Windows by typing startx command
ScreenHunter_01The X Windows will show up
ScreenHunter_04and we can initialize the Logical Volume Management now.
If we hope that it started on boot, please remember to change the run level from 3 to 5 in /etc/inittab file.
ScreenHunter_02

2013年6月14日 星期五

MySQL --- How to know the location of the default or custom database

If we are system manager and have to install MySQL on CentOS, we always know the default data directory location will depend on the installed method. For example,
      If install MySQL from a source distribution(*.tar.gz), its default data location is “/usr/local/mysql/var”.
      If install MySQL from a binary distribution, its default data location is “/usr/local/mysql/data”.
      If install MySQL from a RPM file(*.rpm), its default data location is “/var/lib/mysql”.

But if we take over MySQL management after the system and database is installed by someone, how to know the location of default or custom database?

In system console, log on SQL console and type sql command as show databases; to show which databases need to be realized.
ScreenHunter_03According to database path rule, by default all database files are located under the default location as /var/lib/mysql/"db_name", we can use find / –name “db_name” –print command to find out the special database path.
ScreenHunter_06
To do the find command again but change search path from / to found path as /var/lib/mysql/emdp, we can realize whether the file type belong to MySQL data format(*.frm).ScreenHunter_01Finally, if we want to know the default data directory on MySQL now,we can use sql command as SHOW VARIABLES LIKE ‘datadir’;ScreenHunter_04or mysqladmin command as mysqladmin –u root –p variables | grep datadir
ScreenHunter_05

2013年5月24日 星期五

CentOS 6.3 --- Maybe need to configure network setting after creating the differencing disk or clone OS

In virtualization environment as Hyper-V or VMware, if we create a VM disk and its type has a parent-child relationship with another disk, maybe we will find out the original network card will disappear after boot VM next to use /sbin/ifconfig command.ScreenHunter_41
When this scenario happens, we have to realize whether the first or others Ethernet network interface card or NIC exist in the system so that use ls /etc/sysconfig/network-scripts command. (#1)
If it exists           we will go to the next steps to confirm something.ScreenHunter_42If it non-exists   we have to create network interface.ScreenHunter_31                           To create a file by using vi /etc/sysconfig/network-scripts/ifcfg-eth0 command and add some word as follows:ScreenHunter_32                            for getting dynamic IPScreenHunter_33                            for setting static IP (# 1)ScreenHunter_03End if
Of course, we also have to confirm whether the duplicated content in the /etc/udev/rules.d/70-persistent-net.rules file exist the wrong network card mapping to MAC.ScreenHunter_43In general, we just need to delete the first row and change NAME’s value from eth1 to eth0 at the second rowScreenHunter_44The final result is as follows:ScreenHunter_45

By add or modify the content in the /etc/sysconfig/network file, we can specify the network configuration as Networking should be configured, hostname set FQDN, set the network gateway and so on.ScreenHunter_40ScreenHunter_42
By using chkconfig  network on command, we will configure the system to automatically start the network function when the system startup.ScreenHunter_49
Finally, please reboot itScreenHunter_47After log on the system, the network function will be normal now.
ScreenHunter_48
Reference :
(# 1)
 In installing Linux Integration Services on Hyper-V 3.0, we can realize whether the network module is loaded successfully by using lsmod | grep vsc command.
(# 2) About name server setting in CentOS 6.3, we don’t need to add or modify the content in /etc/resolv.conf file because it need to set in the /etc/sysconfig/network-scripts/ifcfg-eth0 file.
         If we still do it in /etc/resolv.conf file, the name server setting will disappear after reboot the system.
         As to PEERDNS=no or PEERDNS=yes in the /etc/sysconfig/network-scripts/ifcfg-eth0 file, it don’t influence anything in my testing lab.

2013年5月18日 星期六

CentOS 6.3 --- Replace bad or old disk by LVM Command Line Interface

When the system is online for a long time, maybe one day it will suffer some problem as some disks crash or phase out so that need to replace the old disk with the new one. If the replaced disk is configured by LVM and exists a lot of data, how to do it?

If there is no enough free physical extents (PV) in the volume group, we have to add a new disk (as /dev/sdd) and its size need to be large than the replaced disk. In the moment, we also need to know which disk (as /dev/sdb1) need to be replaced or view /var/log/messages to find out the bad disk.
ScreenHunter_04
After done it, we have to make this new disk to be available with LVM by using pvcreate /dev/sdd commandScreenHunter_05To verify the status of the new physical volume by using pvdisplay /dev/sdd commandScreenHunter_06To realize which volume group the bad or old disk ( /dev/sdb1) belongs to by using pvdisplay /dev/sdb1 commandScreenHunter_07To add the new disk ( /dev/sdd) to the volume group drbdVG00 by using vgextend drbdVG00 /dev/sdd command
ScreenHunter_08To realize which logical volume the volume group drbdVG00 belong to by using lvdisplay commandScreenHunter_09ScreenHunter_10To move physical extents in active volume group drbdVG00 from /dev/sdb1 to /dev/sdd by using pvmove –n drbdVG00 /dev/sdb1 /dev/sdd commandScreenHunter_11To remove bad or old disk from the volume group by using vgreduce drbdVG00 /dev/sdb1 commandScreenHunter_12Finally, please shutdown the system next to remove the bad or old disk (# 1) and boot it. The data still exist in LVM disk as before.ScreenHunter_04
Reference :
(# 1)  When remove the bad or old SCSI disk but never change disk order (that the new disk ID also is the same as before)ScreenHunter_01ScreenHunter_02          all disk order will be changed but LVM function is normal.ScreenHunter_03
          When remove the bad or old SCSI disk and change disk order (that new disk ID is the same as the old one)ScreenHunter_05        the bad or old disk just is replaced with the new disk and LVM function is normal as well.
ScreenHunter_06

2013年5月11日 星期六

CentOS 6.3 --- Add a New Disk into the existing Volume Group by LVM Command Line Interface

For increasing (or reducing) the size of the file system, we can use its flexible advantage to mange disk resource if the system deploys LVM.
At first, we have to realize whether can use all available space on the Logical Volume.
               If have, we can directly grow the file system from the free space of Volume Group.
               If no, we have to expand the Volume Group by adding the additional disk.

In the following lab, it will show you how to grow file system after add new disk because its operation also includes directly expand the space on LV.

Prerequisite
To check the size of the file system to realize whether the space then needs to be extend by using df –h commandScreenHunter_02                  In the moment, the available space is 41MB and all space use 96% on the filesystem /dev/mapper/drbdVG00-drbdLV0

By using lvdisplay /dev/mapper/drbdVG00-drbdLV0 command, we can find out which Volume Group Name drbdVG00 contain this Logical Volume.ScreenHunter_03
By using vgdisplay drbdVG00 command, we can find out whether the volume group drbdVG00 has available free space to allocate to the logical volume.ScreenHunter_04           In the moment, there is no free physical extents so that need to add new disk as adding physical volume to this volume group.

After add new disk online (# 1), we need to confirm whether the system can probe this new disk by using ls /dev/sd* commandScreenHunter_10or realize what is the status of the partition of the disk by using df –h commandScreenHunter_11ScreenHunter_12
Create Physical Volume

Due to the new disk never is partitioned, we will create the whole disk as a physical volume so that will convert this disk into a physical volume by using pvcreate /dev/sdc command.ScreenHunter_13By using pvscan or pvscan –n command, we can know whether the physical volume is created successfully and are sure this new physical volume never belongs to any volume group now.ScreenHunter_14
Add Physical Volume into the existing Volume GroupAfter the physical volume is created, we need to add it to the existing volume group by using vgextend drbdVG00 /dev/sdc command.ScreenHunter_15In volume group, there is free physical content that is ready to be allocated to logical volume now by using vgdisplay drbdVG00 command.ScreenHunter_16Extend Logical Volume SizeBy using lvextend –L +1020M /dev/drbdVG00/drbdLV0 command, we will extend the size of Logical Volume about 1020 MB.ScreenHunter_17             The “AS-IS” of using lvextend commandScreenHunter_18             The “TO-BE” of using lvextend commandScreenHunter_19
Resize Filesystem
By using resize2fs /dev/drbdVG00/drbdLV0 command, we can resize filesystem so that logical volume will have additional space to be used now.ScreenHunter_20Until now, we can use the additional space that provided by the new disk if the above process completes successfully.

Reference :
(# 1)
In Hyper-V 3.0 manager, we can add the SCSI virtual disk onlineScreenHunter_07
       and choose a location value to avoid the conflict with the existing disk.ScreenHunter_08
Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.