AMD APP SDK Runtime安装失败解决办法

看到出了新的催化剂驱动就忍不住想更新下,结果其它组件都安装成功,就是AMD APP SDK Runtime报安装失败。百度了下没有找到正确的解决,猜想应该是以前安装的版本冲突。遂想到解决办法。首先安装微软的卸载工具windows installer clean up.运行后找到以前安装的amd app sdk runtime,点remove。再重新安装就ok了。
Read more...

在 Windows 上重置过期的 vCenter Single Sign On 管理员密码

 

默认 Single Sign On 密码策略指定密码一年后过期。密码即将过期时,vSphere Web Client 不会发出警告。如果因 Single Sign On 系统的管理员密码过期而无法登录到 vSphere Web Client,拥有 Single Sign On 管理员特权的用户必须对其进行重置。

vCenter Single Sign On 管理员用户的密码已过期,管理员无法登录到 vSphere Web Client 更改密码。


在 vSphere Web Client 中更改密码。


a

以拥有 Single Sign On 管理员特权的用户身份登录到 vSphere Web Client

b

导航到统管理 > 访问 > SSO 用户和组,然后单击用户选项卡。

c

右键单击用户,然后选择编辑用户

d

输入新密码并予以确认。

e

单击确定


在命令行更改密码。


a

打开终端窗口,然后导航到 C:\Program Files\VMware\Infrastructure\SSOServer\ssolscli

b

运行下列命令。

ssopass username

c

输入用户的当前密码,即使该密码已过期。

d

输入新密码,然后再次输入进行确认。

此时将重置管理员密码,用户可使用新凭据登录到 vSphere Web Client

 

Read more...

在VMWare中增加Linux文件系统空间

 

有时候会遇到这样的情况:刚开始给VMWare分配了一个虚拟硬盘,安装Linux后,随着工作中使用得越来越多,虚拟硬盘容量逐渐变得不够用,需要扩充空间。下面说明如何在VMWare中增加Linux的文件系统空间。

我的VMWare中安装的是Fedora 9,不过其它Linux应该大同小异。

首先在VMWare中调整虚拟硬盘的大小(在“Virtual Machine Settings”的Hardware选项卡里选择“Hard Disk(SCSI)”,在右侧的Utilities里选择Expand进行扩展),也可以直接Add一块新的虚拟硬盘。

启动Linux,键入df -h查看磁盘信息:

[plain] view plaincopy
  1. [root@localhost ~]# df -h  
  2. Filesystem            Size  Used Avail Use% Mounted on  
  3. /dev/mapper/VolGroup00-LogVol00  
  4.                        29G   26G  2.3G  92% /  
  5. /dev/sda1             190M   13M  168M   7% /boot  
  6. tmpfs                 506M   48K  506M   1% /dev/shm  
  7. gvfs-fuse-daemon       29G   26G  2.3G  92% /root/.gvfs  

可以看到新增加的硬盘容量并没有体现在Linux中。使用fdisk -l查看分区表信息。我的信息是:

[plain] view plaincopy
  1. [root@localhost ~]# fdisk -l  
  2.   
  3. Disk /dev/sda: 42.9 GB, 42949672960 bytes  
  4. 255 heads, 63 sectors/track, 5221 cylinders  
  5. Units = cylinders of 16065 * 512 = 8225280 bytes  
  6. Disk identifier: 0x000f1526  
  7.   
  8.    Device Boot      Start         End      Blocks   Id  System  
  9. /dev/sda1   *           1          25      200781   83  Linux  
  10. /dev/sda2              26        3916    31254457+  8e  Linux LVM  

注意Disk /Dev/sda有40多G空间(刚刚通过VMWare扩展的),但两个Device /dev/sda1和/dev/sda2加起来只有30多G,有10G空间没有被使用。

从调整分区表入手,调整分区表用fdisk。这个过程需要人机交互,我在需要输入的地方加注释来说明

[plain] view plaincopy
  1. [root@localhost ~]# fdisk /dev/sda  
  2.   
  3. The number of cylinders for this disk is set to 5221.  
  4. There is nothing wrong with that, but this is larger than 1024,  
  5. and could in certain setups cause problems with:  
  6. 1) software that runs at boot time (e.g., old versions of LILO)  
  7. 2) booting and partitioning software from other OSs  
  8.    (e.g., DOS FDISK, OS/2 FDISK)  
  9.   
  10. Command (m for help): n       //选择n表示新建分区  
  11. Command action  
  12.    e   extended  
  13.    p   primary partition (1-4)  
  14. e                             //选择e表示建立扩展分区  
  15. Partition number (1-4): 3     //选择3是因为1和2都被占了(/dev/dsa1和/dev/dsa2)  
  16. First cylinder (3917-5221, default 3917):                               //此分区起始柱面,直接按回车,使用默认值  
  17. Using default value 3917  
  18. Last cylinder or +size or +sizeM or +sizeK (3917-5221, default 5221):   //此分区大小,直接按回车,使用默认值(表明包含所有剩余空间)  
  19. Using default value 5221  
  20.   
  21. Command (m for help): n       //在扩展分区基础上新建逻辑分区  
  22. Command action  
  23.    l   logical (5 or over)  
  24.    p   primary partition (1-4)  
  25. l                             //选择l表示新建逻辑分区  
  26. First cylinder (3917-5221, default 3917):                               //直接按回车  
  27. Using default value 3917  
  28. Last cylinder or +size or +sizeM or +sizeK (3917-5221, default 5221):   //直接按回车  
  29. Using default value 5221  
  30.   
  31. Command (m for help): p       //选择p查看新的分区表,发现已经新建成功  
  32.   
  33. Disk /dev/sda: 42.9 GB, 42949672960 bytes  
  34. 255 heads, 63 sectors/track, 5221 cylinders  
  35. Units = cylinders of 16065 * 512 = 8225280 bytes  
  36. Disk identifier: 0x000f1526  
  37.   
  38.    Device Boot      Start         End      Blocks   Id  System  
  39. /dev/sda1   *           1          25      200781   83  Linux  
  40. /dev/sda2              26        3916    31254457+  8e  Linux LVM  
  41. /dev/sda3            3917        5221    10482412+   5  Extended  
  42. /dev/sda5            3917        5221    10482381   83  Linux  
  43.   
  44. Command (m for help): w       //选择w保存  
  45. The partition table has been altered!  
  46.   
  47. Calling ioctl() to re-read partition table.  
  48.   
  49. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.  
  50. The kernel still uses the old table.  
  51. The new table will be used at the next reboot.  
  52. Syncing disks.  

可以看到新增了/dev/sda3扩展分区和/dev/sda5逻辑分区。如果是新增了一块硬盘,也可以直接新建一个主分区,步骤更简单些。

键入partprobe命令,这个命令用于在硬盘分区发生改变时,更新Linux内核中读取的硬盘分区表数据。

[plain] view plaincopy
  1. [root@localhost ~]# partprobe  

我们使用ext3格式化/dev/sda5这个新的分区

[plain] view plaincopy
  1. [root@localhost ~]# mkfs -t ext3 /dev/sda5  
  2. mke2fs 1.40.8 (13-Mar-2008)  
  3. Warning: 256-byte inodes not usable on older systems  
  4. Filesystem label=  
  5. OS type: Linux  
  6. Block size=4096 (log=2)  
  7. Fragment size=4096 (log=2)  
  8. 655360 inodes, 2620595 blocks  
  9. 131029 blocks (5.00%) reserved for the super user  
  10. First data block=0  
  11. Maximum filesystem blocks=2684354560  
  12. 80 block groups  
  13. 32768 blocks per group, 32768 fragments per group  
  14. 8192 inodes per group  
  15. Superblock backups stored on blocks:   
  16.     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632  
  17.   
  18. Writing inode tables: done                              
  19. Creating journal (32768 blocks): done  
  20. Writing superblocks and filesystem accounting information: done  
  21.   
  22. This filesystem will be automatically checked every 32 mounts or  
  23. 180 days, whichever comes first.  Use tune2fs -c or -i to override.  

格式化完毕后,要将新的分区加入到LVM(Logical Volume Manager)以便以后管理。
我们先用pvdisplay命令查看LVM的物理卷信息

[plain] view plaincopy
  1. [root@localhost ~]# pvdisplay  
  2.   --- Physical volume ---  
  3.   PV Name               /dev/sda2  
  4.   VG Name               VolGroup00  
  5.   PV Size               29.81 GB / not usable 25.93 MB  
  6.   Allocatable           yes   
  7.   PE Size (KByte)       32768  
  8.   Total PE              953  
  9.   Free PE               1  
  10.   Allocated PE          952  
  11.   PV UUID               gjFDfY-J0vK-7YKm-uo32-eiQZ-YO3D-PFbp1A  

可以看到,只有/dev/sda2加入了LVM的VolGroup00卷组。

使用我们新的/dev/sda5创建LVM物理卷,命令是pvcreate

[plain] view plaincopy
  1. [root@localhost ~]# pvcreate /dev/sda5  
  2.   Physical volume "/dev/sda5" successfully created  

创建成功,再键入pvdisplay查看

[plain] view plaincopy
  1. [root@localhost ~]# pvdisplay  
  2.   --- Physical volume ---  
  3.   PV Name               /dev/sda2  
  4.   VG Name               VolGroup00  
  5.   PV Size               29.81 GB / not usable 25.93 MB  
  6.   Allocatable           yes   
  7.   PE Size (KByte)       32768  
  8.   Total PE              953  
  9.   Free PE               1  
  10.   Allocated PE          952  
  11.   PV UUID               gjFDfY-J0vK-7YKm-uo32-eiQZ-YO3D-PFbp1A  
  12.      
  13.   "/dev/sda5" is a new physical volume of "10.00 GB"  
  14.   --- NEW Physical volume ---  
  15.   PV Name               /dev/sda5  
  16.   VG Name                 
  17.   PV Size               10.00 GB  
  18.   Allocatable           NO  
  19.   PE Size (KByte)       0  
  20.   Total PE              0  
  21.   Free PE               0  
  22.   Allocated PE          0  
  23.   PV UUID               WiG7f0-jGuq-HCUR-3MCZ-d8V0-rwV9-rEF2wg  

新的物理卷已经创建,但是没有加入任何卷组。现在我们把它加入VolGroup00卷组

[plain] view plaincopy
  1. [root@localhost ~]# vgextend VolGroup00 /dev/sda5  
  2.   Volume group "VolGroup00" successfully extended  

加入成功。键入lvdisplay查看我们当前的逻辑卷信息

[plain] view plaincopy
  1. [root@localhost ~]# lvdisplay  
  2.   --- Logical volume ---  
  3.   LV Name                /dev/VolGroup00/LogVol00  
  4.   VG Name                VolGroup00  
  5.   LV UUID                nvo0P1-8kmf-f9jJ-X4ii-RHUD-VvwK-AvIm36  
  6.   LV Write Access        read/write  
  7.   LV Status              available  
  8.   # open                 1  
  9.   LV Size                29.25 GB  
  10.   Current LE             936  
  11.   Segments               1  
  12.   Allocation             inherit  
  13.   Read ahead sectors     auto  
  14.   - currently set to     256  
  15.   Block device           253:0  
  16.      
  17.   --- Logical volume ---  
  18.   LV Name                /dev/VolGroup00/LogVol01  
  19.   VG Name                VolGroup00  
  20.   LV UUID                2hi7f1-SPdo-FQdX-s4gE-Y74F-rgzQ-KAO55X  
  21.   LV Write Access        read/write  
  22.   LV Status              available  
  23.   # open                 1  
  24.   LV Size                512.00 MB  
  25.   Current LE             16  
  26.   Segments               1  
  27.   Allocation             inherit  
  28.   Read ahead sectors     auto  
  29.   - currently set to     256  
  30.   Block device           253:1  

我们要扩展的是名为/dev/VolGroup00/LogVol00的逻辑卷,使用lvextend命令

[plain] view plaincopy
  1. [root@localhost ~]# lvextend /dev/VolGroup00/LogVol00 /dev/sda5  
  2.   Extending logical volume LogVol01 to 10.47 GB  
  3.   Logical volume LogVol01 successfully resized  

扩展成功,此时再键入lvdisplay查看信息,显示如下

[plain] view plaincopy
  1. [root@localhost ~]# lvdisplay  
  2.   --- Logical volume ---  
  3.   LV Name                /dev/VolGroup00/LogVol00  
  4.   VG Name                VolGroup00  
  5.   LV UUID                nvo0P1-8kmf-f9jJ-X4ii-RHUD-VvwK-AvIm36  
  6.   LV Write Access        read/write  
  7.   LV Status              available  
  8.   # open                 1  
  9.   LV Size                39.22 GB  
  10.   Current LE             1255  
  11.   Segments               2  
  12.   Allocation             inherit  
  13.   Read ahead sectors     auto  
  14.   - currently set to     256  
  15.   Block device           253:0  
  16.      
  17.   --- Logical volume ---  
  18.   LV Name                /dev/VolGroup00/LogVol01  
  19.   VG Name                VolGroup00  
  20.   LV UUID                2hi7f1-SPdo-FQdX-s4gE-Y74F-rgzQ-KAO55X  
  21.   LV Write Access        read/write  
  22.   LV Status              available  
  23.   # open                 1  
  24.   LV Size                32.00 MB  
  25.   Current LE             1  
  26.   Segments               1  
  27.   Allocation             inherit  
  28.   Read ahead sectors     auto  
  29.   - currently set to     256  
  30.   Block device           253:1  

LogVol00扩大了10G。但此时键入df -h,会发现我们的空间还是不能用

[plain] view plaincopy
  1. [root@localhost ~]# df -h  
  2. Filesystem            Size  Used Avail Use% Mounted on  
  3. /dev/mapper/VolGroup00-LogVol00  
  4.                        29G   26G  2.3G  92% /  
  5. /dev/sda1             190M   13M  168M   7% /boot  
  6. tmpfs                 506M   48K  506M   1% /dev/shm  
  7. gvfs-fuse-daemon       29G   26G  2.3G  92% /root/.gvfs  

需要用resize2fs工具调整Linux文件系统大小。如果你的Linux内核是2.6及以上版本,可以直接调整,否则需要先umount相关的设备后进行调整。Fedora 9的内核版本是2.6.25。OK,我们直接调整df命令中列出的/dev/mapper/VolGroup00-LogVol00文件系统

[plain] view plaincopy
  1. [root@localhost ~]# resize2fs /dev/mapper/VolGroup00-LogVol00  
  2. resize2fs 1.40.8 (13-Mar-2008)  
  3. Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required  
  4. old desc_blocks = 2, new_desc_blocks = 3  
  5. Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 10280960 (4k) blocks.  
  6. The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 10280960 blocks long.  

此时再键入df -h命令查看

[plain] view plaincopy
  1. [root@localhost ~]# df -h  
  2. Filesystem            Size  Used Avail Use% Mounted on  
  3. /dev/mapper/VolGroup00-LogVol00  
  4.                        39G   26G   12G  69% /  
  5. /dev/sda1             190M   13M  168M   7% /boot  
  6. tmpfs                 506M   48K  506M   1% /dev/shm  
  7. gvfs-fuse-daemon       39G   26G   12G  69% /root/.gvfs  

至此,我们的文件系统扩充完毕。

Read more...

esxi Displaying the ARP and Neighbor Discovery cache for VMkernel network interfaces

 

To review the ARP and ND cache for the VMkernel network interfaces on an ESX or ESXi host, use the local or remote esxcli command. This command is available at the local console of the ESX/ESXi host, and usable remotely from the vSphere Command Line Interface (vCLI) or from the vSphere Management Assistant (vMA) appliance. For installation and/or usage instruction, see the relevant documentation.

  1. Open a console session to the location where the esxcli command is available.
  2. Display the list of known network neighbors in the ARP and ND cache for all VMkernel network interfaces using one of the commands:
    • On ESXi 4.1:

      esxcli [--server hostname --username root --password rootpassword] network neighbor list
       
    • On ESXi 5.0:

      esxcli [--server hostname --username root --password rootpassword] network ip neighbor list
       
    Note: If running locally on the ESX/ESXi host console, no server hostname or authentication is required for the esxclicommand.

    The output appears similar to:

    Neighbor     Mac Address       vmknic Expiry(sec)
    --------     -----------       ------ -----------
    10.5.6.7     00:50:56:9a:00:7a vmk0   1200
    10.5.6.8     00:50:56:9a:00:57 vmk0   1197
    10.5.6.9     00:50:56:9a:00:3e vmk0   277
    10.200.1.10  00:50:56:9a:01:09 vmk1   979
Read more...

ESXi S.M.A.R.T. health monitoring for hard drives

In ESXi 5.1, VMware added S.M.A.R.T. functionality to monitor hard drive health. The S.M.A.R.T. feature records various operation parameters from physical hard drives attached to a local controller. The feature is part of the firmware on the circuit board of a physical hard disk (HDD and SSD).


To read the current data from a disk:



  1. Determine the device parameter to use by running the command:

    esxcli storage core device list
     
  2. Read the data from the device:

    esxcli storage core device smart get -d device

    Where device is a value found in step 1.
     
  3. The expected output is a list with all SCSI devices seen by the ESXi host. For example:

    t10.ATA_____WDC_WD2502ABYS2D18B7A0________________________WD2DWCAT1H751520

    Note: External FC/iSCSI LUNs or virtual disks from a RAID controller might not report a S.M.A.R.T. status.

This table breaks down some example output:



Parameter Value Threshold Worst
Health Status OK N/A N/A
Media Wearout Indicator 0 0 0
Write Error Count N/A N/A N/A
Read Error Count 118 50 118
Power-on Hours 0 0 0
Power Cycle Count 100 0 100
Reallocated Sector Count 100 3 100
Raw Read Error Rate 118 50 118
Drive Temperature 27 0 34
Driver Rated Max Temperature N/A N/A N/A
Write Sectors TOT Count N/A N/A N/A
Read Sectors TOT Count N/A N/A N/A
Initial Bad Block Count N/A N/A N/A

Note: A physical hard drive can have up to 30 different attributes (the example above supports only 13). For more information, seeHow does S.M.A.R.T. function of hard disks Work?

Note: The preceding link was correct as of December 7, 2012. If you find the link is broken, provide feedback and a VMware employee will update the link.


A raw value can have two possible results:


  • A number between 0-253
  • A word (for example, N/A or OK)

Column descriptions

Note: The values returned and their meaning for each of these columns can vary by manufacturer. For more information, please consult your hardware supplier.

  • Parameter

    This is a translation from the attribute ID to human-readable text. For example:

    hex 0xE7 = decimal 231 = "Drive Temperature"

    For more information, see the Known ATA S.M.A.R.T. attributes section of the S.M.A.R.T. Wikipedia article.

    Note: The preceding link was correct as of December 7, 2012. If you find the link is broken, provide feedback and a VMware employee will update the link.
     
  • Value

    This is the raw value reported by the disk. To illustrate a simple Value using the example above, the Drive Temperature is reported as 27, which means 27 degrees Celsius.

    Value can either be a number (0-253) or a word (for example, N/A or OK).
     
  • Threshold

    The (failure) limit for the attribute.
     
  • Worst

    The highest Value ever recorded for the parameter.

smartd daemon

ESXi 5.1 also has the /sbin/smartd daemon in the DCUI installed. This tool does not have any command line switches or interaction with the console. If you run the command in the shell, a S.M.A.R.T. status is reported in the /var/log/syslog.log file.

For example:

XXXX-XX-28T10:15:12Z smartd: [warn] t10.ATA_____SanDisk_SDSSDX120GG25___________________120506403552________: below MEDIA WEAROUT threshold (0)
XXXX-XX-28T10:15:12Z smartd: [warn] t10.ATA_____SanDisk_SDSSDX120GG25___________________120506403552________: above TEMPERATURE threshold (27 > 0)
XXXX-XX-28T10:15:12Z smartd: [warn] t10.ATA_____WDC_WD2502ABYS2D18B7A0________________________WD2DWCAT1H751520: above TEMPERATURE threshold (113 > 0)


Notes:


  • You can stop the daemon by typing Ctrl+c.
  • Logged events should be viewed with caution. As can be seen in the example, all three warnings are irrelevant. The output can vary greatly between manufacturers and disk models.
Read more...

rsync客户端命令详解

 

在对rsync服务器配置结束以后,下一步就需要在客户端发出rsync命令来实现将服务器端的文件备份到客户端来。rsync是一个功能非常强大的工具,其命令也有很多功能特色选项,我们下面就对它的选项一一进行分析说明。

 

首先,rsync的命令格式可以为:

 

rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST

 

rsync [OPTION]... [USER@]HOST:SRC DEST

 

rsync [OPTION]... SRC [SRC]... DEST

 

rsync [OPTION]... [USER@]HOST::SRC [DEST]

 

rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST

 

rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]

rsync有六种不同的工作模式:

 

拷贝本地文件;当SRC和DES路径信息都不包含有单个冒号":"分隔符时就启动这种工作模式。

 

使用一个远程shell程序(如rsh、ssh)来实现将本地机器的内容拷贝到远程机器。当DST路径地址包含单个冒号":"分隔符时启动该模式。

 

使用一个远程shell程序(如rsh、ssh)来实现将远程机器的内容拷贝到本地机器。当SRC地址路径包含单个冒号":"分隔符时启动该模式。

 

从远程rsync服务器中拷贝文件到本地机。当SRC路径信息包含"::"分隔符时启动该模式。

 

从本地机器拷贝文件到远程rsync服务器中。当DST路径信息包含"::"分隔符时启动该模式。

 

列远程机的文件列表。这类似于rsync传输,不过只要在命令中省略掉本地机信息即可。

1、用法

 

在使用rsync传输文件时,需要指定一个源和一个目的,其中一个可能是远程机器的资源信息。例如:

 

rsync *.c foo:src/

 

表示将传输当前目录下所有以.c结尾的文件到机器foo的src目录下。如果任何文件已经存在于远程系统,则会调用远程更新协议来实现仅仅传输那些更新过的文件。

 

rsync -avz foo:src/bar /data/tmp

 

该命令则递归地传输机器foo上的src/bar目录下的所有内容到本地/data/tmp/bar目录中。文件以归档模式进行传输,以确保符号链结、属性、权限、属主等信息在传输中都被保存。此外,可以使用压缩技术来加快数据传输:

 

rsync -avz foo:src/bar/ /data/tmp

 

路径信息以"/"结尾时表示拷贝该目录,而不以"/"结尾表示拷贝该目录。当配合使用--delete选项时这两种情况的区别将会表现出来。

 

也可以以本地模式来使用rsync,如果SRC和DST路径中都没有任何":"符号则表示该命令运行在本地模式,等同于cp命令。

 

rsync somehost.mydomain.com::

 

这种模式则将会列出somehost.mydomain.com.可以访问的所有模块信息。

 

选项说明

 

-v, --verbose 详细模式输出

-q, --quiet 精简输出模式

-c, --checksum 打开校验开关,强制对文件传输进行校验

-a, --archive 归档模式,表示以递归方式传输文件,并保持所有文件属性,等于-rlptgoD

-r, --recursive 对子目录以递归模式处理

-R, --relative 使用相对路径信息

 

rsync foo/bar/foo.c remote:/tmp/

 

则在/tmp目录下创建foo.c文件,而如果使用-R参数:

 

rsync -R foo/bar/foo.c remote:/tmp/

 

则会创建文件/tmp/foo/bar/foo.c,也就是会保持完全路径信息。

 

-b, --backup 创建备份,也就是对于目的已经存在有同样的文件名时,将老的文件重新命名为~filename。可以使用--suffix选项来指定不同的备份文件前缀。

--backup-dir 将备份文件(如~filename)存放在在目录下。

-suffix=SUFFIX 定义备份文件前缀

-u, --update 仅仅进行更新,也就是跳过所有已经存在于DST,并且文件时间晚于要备份的文件。(不覆盖更新的文件)

-l, --links 保留软链结

-L, --copy-links 想对待常规文件一样处理软链结

--copy-unsafe-links 仅仅拷贝指向SRC路径目录树以外的链结

--safe-links 忽略指向SRC路径目录树以外的链结

-H, --hard-links 保留硬链结

-p, --perms 保持文件权限

-o, --owner 保持文件属主信息

-g, --group 保持文件属组信息

-D, --devices 保持设备文件信息

-t, --times 保持文件时间信息

-S, --sparse 对稀疏文件进行特殊处理以节省DST的空间

-n, --dry-run现实哪些文件将被传输

-W, --whole-file 拷贝文件,不进行增量检测

-x, --one-file-system 不要跨越文件系统边界

-B, --block-size=SIZE 检验算法使用的块尺寸,默认是700字节

-e, --rsh=COMMAND 指定替代rsh的shell程序

--rsync-path=PATH 指定远程服务器上的rsync命令所在路径信息

-C, --cvs-exclude 使用和CVS一样的方法自动忽略文件,用来排除那些不希望传输的文件

--existing 仅仅更新那些已经存在于DST的文件,而不备份那些新创建的文件

--delete 删除那些DST中SRC没有的文件

--delete-excluded 同样删除接收端那些被该选项指定排除的文件

--delete-after 传输结束以后再删除

--ignore-errors 及时出现IO错误也进行删除

--max-delete=NUM 最多删除NUM个文件

--partial 保留那些因故没有完全传输的文件,以是加快随后的再次传输

--force 强制删除目录,即使不为空

--numeric-ids 不将数字的用户和组ID匹配为用户名和组名

--timeout=TIME IP超时时间,单位为秒

-I, --ignore-times 不跳过那些有同样的时间和长度的文件

--size-only 当决定是否要备份文件时,仅仅察看文件大小而不考虑文件时间

--modify-window=NUM 决定文件是否时间相同时使用的时间戳窗口,默认为0

-T --temp-dir=DIR 在DIR中创建临时文件

--compare-dest=DIR 同样比较DIR中的文件来决定是否需要备份

-P 等同于 --partial

--progress 显示备份过程

-z, --compress 对备份的文件在传输时进行压缩处理

--exclude=PATTERN 指定排除不需要传输的文件模式

--include=PATTERN 指定不排除而需要传输的文件模式

--exclude-from=FILE 排除FILE中指定模式的文件

--include-from=FILE 不排除FILE指定模式匹配的文件

--version 打印版本信息

--address 绑定到特定的地址

--config=FILE 指定其他的配置文件,不使用默认的rsyncd.conf文件

--port=PORT 指定其他的rsync服务端口

--blocking-io 对远程shell使用阻塞IO

-stats 给出某些文件的传输状态

--progress 在传输时现实传输过程

--log-format=formAT 指定日志文件格式

--password-file=FILE 从FILE中得到密码

--bwlimit=KBPS 限制I/O带宽,KBytes per second

-h, --help 显示帮助信息

实例分析

这里假设有两台服务器:A和B。其中A是主web服务器,具有域名www.linuxaid.com.cn(202.99.11.120),B服务器是备份机,其域名为backup.linuxaid.com.cn(202.99.11.121)。其中A的web内容存放在以下几个地方:/www/和/home/web_user1/和/home/web_user2/。我们需要在备份机B上建立对这几个目录内容的备份。

 

服务器配置实例

 

那么在www.linuxaid.com.cn上创建rsyncd的配置文件/etc/rsyncd.conf,内容如下:

 

uid = nobody

gid = nobody

use chroot = no

max connections = 4

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsync.lock

log file = /var/log/rsyncd.log

 

[www]

path = /www/

ignore errors

read only = true

list = false

hosts allow = 202.99.11.121

hosts deny = 0.0.0.0/32

auth users = backup

secrets file = /etc/backserver.pas

 

[web_user1]

path = /home/web_user1/

ignore errors

read only = true

list = false

hosts allow = 202.99.11.121

hosts deny = 0.0.0.0/32

uid = web_user1

gid = web_user1

auth users = backup

secrets file = /etc/backserver.pas

 

[web_user2]

path = /home/web_user2/

ignore errors

read only = true

list = false

hosts allow = 202.99.11.121

hosts deny = 0.0.0.0/32

uid = web_user2

gid = web_user2

auth users = backup

secrets file = /etc/backserver.pas

 

这里定义有四个三个模块,分别对应于三个需要备份的目录树。这里只允许202.99.11.121备份本机的数据,并且需要认证。三个模块授权的备份用户都为backup,并且用户信息保存在文件/etc/backserver.pas中,其内容如下:

 

backup:bk_passwd

 

并且该文件只能是root用户可读写的,否则rsyncd启动时会出错。这些文件配置完毕以后,就需要在A服务器上启动rsyncd服务器:

 

rsync --daemon

 

客户命令示例

 

/usr/local/bin/rsync -vzrtopg --delete --exclude "logs/" --exclude "conf/ssl.*/" --progress This email address is being protected from spambots. You need JavaScript enabled to view it.::www /backup/www/ --password-file=/etc/rsync.pass

 

上面这个命令行中-vzrtopg里的v是verbose,z是压缩,r是recursive,topg都是保持文件原有属性如属主、时间的参数。--progress是指显示出详细的进度情况,--delete是指如果服务器端删除了这一文件,那么客户端也相应把文件删除,保持真正的一致。--exclude "logs/" 表示不对/www/logs目录下的文件进行备份。--exclude "conf/ssl.*/"表示不对/www/conf/ssl.*/目录下的文件进行备份。

 

This email address is being protected from spambots. You need JavaScript enabled to view it.::www 表示对该命令是对服务器202.99.11.120中的www模块进行备份,backup表示使用backup来对该模块进行备份。

 

--password-file=/etc/rsync.pass来指定密码文件,这样就可以在脚本中使用而无需交互式地输入验证密码了,这里需要注意的是这份密码文件权限属性要设得只有root可读。

 

这里将备份的内容存放在备份机的/backup/www/目录下。

 

[root@linuxaid /]# /usr/local/bin/rsync -vzrtopg --delete --exclude "logs/" --exclude "conf/ssl.*/" --progress This email address is being protected from spambots. You need JavaScript enabled to view it.::www /backup/www/ --password-file=/etc/rsync.pass

receiving file list ... done

./

1

785 (100%)

1.py

4086 (100%)

2.py

10680 (100%)

a

0 (100%)

ip

3956 (100%)

./

wrote 2900 bytes read 145499 bytes 576.34 bytes/sec

total size is 2374927 speedup is 45.34

对其它两个模块操作的命令分别为:

/usr/local/bin/rsync -vzrtopg --delete --progress This email address is being protected from spambots. You need JavaScript enabled to view it.::web_user1 /backup/web_user1/ --password-file=/etc/rsync.pass

/usr/local/bin/rsync -vzrtopg --delete --progress This email address is being protected from spambots. You need JavaScript enabled to view it.::web_user2 /backup/web_user2/ --password-file=/etc/rsync.pass

可以将客户命令通过crontab -e命令来实现自动备份,如crontab -e:

Read more...
Subscribe to this RSS feed
Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php on line 191

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34