免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1063 | 回复: 0
打印 上一主题 下一主题

Mirroring the operating system [复制链接]

论坛徽章:
2
双鱼座
日期:2014-02-23 12:10:03操作系统版块每日发帖之星
日期:2015-12-17 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-18 21:07 |只看该作者 |倒序浏览

In the steps below, I'm using Veritas volume manager (VxVM) to mirror the active root disk (c0t0d0) to a mirror (c0t1d0).
IntroductionFirst, we start with a filesystem layout that looks as follows: Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    6607349  826881 5714395    13%    /
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
/dev/dsk/c0t0d0s4    1016863    8106  947746     1%    /var
swap                 1443064       8 1443056     1%    /var/run
swap                 1443080      24 1443056     1%    /tmp
The following steps guide the reader through the process of encapsulating and mirroring the operating system using vxinstall as per Veritas' recommendations. Though easy to install and fully supported by the vendor, it is difficult to maintain. Consequently, there is some debate as to the merits of this approach,
The following alternative approaches are more difficult to install, but are easier to maintain:

  • Rather than encapsulating the boot disk, initialize it. The process was originally presented in the August 2000 Sun Blueprint article
    Toward a Reference Configuration for VxVM Managed Boot Disks
    , by Gene Trantham and John S. Howard.
  • Use Solstice DiskSuite to mirror the operating system and use VxVM for everything else (one can create a
    single-slice rootdg
    on unused slices of the root disk and its mirror).

No matter which of the three approaches is selected, the most important consideration is that the administrative staff understands how to maintain it. For the sake of consistency, all servers at a site should use the same approach to mirror the operating system. Unless the site is willing to pay for VxVM for every server, we recommend the use of Solstice DiskSuite to mirror the operating system, making use of a single-slice rootdg on those servers that also have Veritas volume manager installed.
Create two unused slices for Veritas volume manager
We're going to be mirroring from c0t0d0 to c0t1d0. When the operating system was installed, we created unassigned slices five, six, and seven of roughly 10 MB each. VxVM requires a minimum of two unused disk slices to store the Veritas private and public region on the disk. Prior to placing the operating system under the control of VxVM, we'll free up those 10MB slices so that Veritas can use the reserved space. Now we "zero out" slices five, six, and seven so that VxVM sees disk space available.
# format c0t0d0
selecting c0t0d0
[disk formatted]
...
partition> print
Current partition table (original):
Total disk cylinders available: 5266 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 - 3994        6.40GB    (3995/0/0) 13423200
  1       swap    wu    3995 - 4619        1.00GB    (625/0/0)   2100000
  2     backup    wm       0 - 5265        8.44GB    (5266/0/0) 17693760
  3 unassigned    wu       0               0         (0/0/0)           0
  4        var    wm    4620 - 5244        1.00GB    (625/0/0)   2100000
  5 unassigned    wm    5245 - 5251       11.48MB    (7/0/0)       23520
  6 unassigned    wm    5252 - 5258       11.48MB    (7/0/0)       23520
  7 unassigned    wm    5259 - 5265       11.48MB    (7/0/0)       23520
partition> 5
Part      Tag    Flag     Cylinders        Size            Blocks
  5 unassigned    wm    5245 - 5251       11.48MB    (7/0/0)       23520
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[5245]: 0
Enter partition size[23520b, 7c, 11.48mb, 0.01gb]: 0
partition> 6
Part      Tag    Flag     Cylinders        Size            Blocks
  6 unassigned    wm    5252 - 5258       11.48MB    (7/0/0)       23520
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[5252]: 0
Enter partition size[23520b, 7c, 11.48mb, 0.01gb]: 0
partition> 7
Part      Tag    Flag     Cylinders        Size            Blocks
  7 unassigned    wm    5259 - 5265       11.48MB    (7/0/0)       23520
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[5259]: 0
Enter partition size[23520b, 7c, 11.48mb, 0.01gb]: 0
partition> print
Current partition table (unnamed):
Total disk cylinders available: 5266 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 - 3994        6.40GB    (3995/0/0) 13423200
  1       swap    wu    3995 - 4619        1.00GB    (625/0/0)   2100000
  2     backup    wm       0 - 5265        8.44GB    (5266/0/0) 17693760
  3 unassigned    wu       0               0         (0/0/0)           0
  4        var    wm    4620 - 5244        1.00GB    (625/0/0)   2100000
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
partition> label
Ready to label disk, continue? y
partition> quit
At this point, slices three, five, six and seven are available, as are cylinders 5245 to 5265. We'll see what Veritas does with these once the disk c0t0d0 is encapsulated.
Installing licenses
Though one can download and install the packages for free, actually running the software requires a license key from your Veritas sales representative. Note that if Veritas detects the presence of certain Sun fibre storage arrays, including the A5x00 series, a limited license will be granted just on the basis of that hardware. Normally, however, you do require a node-locked license key from Veritas.
Starting with VxVM 3.5, the commands for installing and querying licenses have changed. Instead of the vxlicense command, there are a few new commands:

  • vxlicinst: installs a veritas license key.
  • vxlicrep: reports all veritas license keys installed on the system.
  • vxlictest: identifies whether a veritas product feature is licensed on the system.

We'll use the vxlicinst key to install the licenses required for volume manager (including raid5 functionality) and filesystem. Of course, the keys listed below are not actually valid keys:
# /opt/VRTSvlic/bin/vxlicinst
VERITAS License Manager vxlicinst utility version 3.00.007d
Copyright (C) VERITAS Software Corp 2002. All Rights reserved.
Enter your license key : 1144 3385 4498 7652 4920 229
Key successfully installed in /etc/vx/licenses/lic/11443385449876524920229.vxlic
Encapsulating the root disk
The disk c0t0d0 is at present a simple Solaris disk that is composed of up to eight disk slices. One of the most powerful features of VxVM is that it replaces the concept of disk slices with that of subdisks, plexes, and volumes. However, in order to manage the root disk, Veritas requires that the disk be "encapsulated", thus preserving the existing on-disk data. This encapsulation process is accomplished as part of the vxinstall command:
#  vxinstall
  VxVM uses license keys to control access.  If you have a SPARCstorage
  Array (SSA) controller or a Sun Enterprise Network Array (SENA) controller
  attached to your system, then VxVM will grant you a limited use license
  automatically.  The SSA and/or SENA license grants you unrestricted use
  of disks attached to an SSA or SENA controller, but disallows striping,
  RAID-5, and DMP on non-SSA and non-SENA disks.  If you are not running an
  SSA or SENA controller, then you must obtain a license key to operate.
  Licensing information:
    System host ID: 808f18b5
    Host type: SUNW,Ultra-30
    SPARCstorage Array or Sun Enterprise Network Array: No arrays found
Some licenses are already installed.  Do you wish to review them
[y,n,q,?] (default: y) n
Do you wish to enter another license key [y,n,q,?] (default: n) n
Volume Manager Installation
Menu: VolumeManager/Install
  VxVM will use the following format to name disks on the host:
        _
  In the above format,  is the logical name of the enclosure
  to which the disk belongs. VxVM assigns default enclosure names which can
  be changed according to the user requirements.
  Some examples would be:
        hitachi0_2      - second disk detected in enclosure 'hitachi0'
        enggdept_2      - second disk detected in enclosure 'enggdept'
        dgc1_1          - first disk detected in enclosure 'dgc1'
        jbod_1          - first disk detected in the jbod category
  For non-public loop disks (Ex. FC disks directly connected to the host
  or through hubs), you could choose to use the c#t#d#s# naming format.
Do you want to use enclosure based names for all disks ?
[y,n,q,?] (default: n)
-Generating list of attached disk arrays....

Volume Manager Installation
Menu: VolumeManager/Install
  The Volume Manager has detected the following categories of storage
  connected to your system:
  Enclosures:     Disk      
Hit RETURN to continue.
Volume Manager Installation
Menu: VolumeManager/Install
  You will now be asked if you wish to use Quick Installation or
  Custom Installation.  Custom Installation allows you to select how
  the Volume Manager will handle the installation of each disk
  attached to your system.
  Quick Installation examines each disk attached to your system and
  attempts to create volumes to cover all disk partitions that might
  be used for file systems or for other similar purposes.
  If you want to exclude any devices from being seen by VxVM or not
  be multipathed by vxdmp then use the Prevent multipathing/Suppress
  devices from VxVM's view option, before you choose Custom Installation
  or Quick Installation.
  If you do not wish to use some disks with the Volume Manager, or if
  you wish to reinitialize some disks, use the Custom Installation
  option Otherwise, we suggest that you use the Quick Installation
  option.
Hit RETURN to continue.
Volume Manager Installation Options
Menu: VolumeManager/Install
1      Quick Installation
2      Custom Installation
3      Prevent multipathing/Suppress devices from VxVM's view
?      Display help about menu
??     Display help about the menuing system
q      Exit from menus
Select an operation to perform: 2
Volume Manager Custom Installation
Menu: VolumeManager/Install/Custom
  The c0t0d0 disk is your Boot Disk.  You can not add it as a new
  disk.  If you encapsulate it, you will make your root file system
  and other system areas on the Boot Disk into volumes.  This is
  required if you wish to mirror your root file system or system
  swap area.
Encapsulate Boot Disk [y,n,q,?] (default: n) y
Enter disk name for  [,q,?] (default: rootdisk)
  The c0t0d0 disk has been configured for encapsulation.
Hit RETURN to continue.
Volume Manager Custom Installation
Menu: VolumeManager/Install/Custom/Disk
Disk array serial number : DISKS
Generating list of disks in disk array Disk....
-
/
  The Volume Manager has detected the following disks in enclosure Disk:
  c0t1d0
Hit RETURN to continue.
Installation options for controller Disk
Menu: VolumeManager/Install/Custom/Disk
1      Install all disks as pre-existing disks. (encapsulate)
2      Install all disks as new disks. (discards data on disks!)
3      Install one disk at a time.
4      Leave these disks alone.
?      Display help about menu
??     Display help about the menuing system
q      Exit from menus
Select an operation to perform: 3
Installation options for disk c0t1d0
Menu: VolumeManager/Install/Custom/Disk
1      Install as a pre-existing disk. (encapsulate)
2      Install as a new disk. (discards data on disk!)
3      Leave this disk alone.
?      Display help about menu
??     Display help about the menuing system
q      Exit from menus
Select an operation to perform: 2
Are you sure (destroys data on c0t1d0) [y,n,q,?] (default: n) y
Enter disk name for c0t1d0 [,q,?] (default: disk01) rootmirror
Volume Manager Custom Installation
Menu: VolumeManager/Install/Custom/Disk
  The following is a summary of your choices.
        c0t0d0                          Encapsulate
        c0t1d0                          New Disk
Is this correct [y,n,q,?] (default: y) y
  The system now must be shut down and rebooted in order to continue
the reconfiguration.
Shutdown and reboot now [y,n,q,?] (default: n) y
Shutdown started.    Wed Oct 23 10:58:40 EDT 2002
Changing to init state 6 - please wait
The system will then reboot (twice) before bringing the system back to the login prompt. Note that the output of df -k now refers to Veritas volumes instead of disk slices. Furthermore, not the output of vxprint -ht, the Veritas command that lists the structure of those volumes.
pegasus console login: root
Password:
Last login: Wed Oct 23 11:03:51 from rambler.wakefie
Oct 23 11:03:58 pegasus login: ROOT LOGIN /dev/console
Sun Microsystems Inc.   SunOS 5.8       Generic February 2000
# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/vx/dsk/rootvol  6607349 1059924 5481352    17%    /
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
/dev/vx/dsk/var      1016863  239985  715867    26%    /var
swap                 1392736      16 1392720     1%    /var/run
swap                 1392736      16 1392720     1%    /tmp
# vxprint -ht
Disk group: rootdg
DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
RV NAME         RLINK_CNT    KSTATE   STATE    PRIMARY  DATAVOLS  SRL
RL NAME         RVG          KSTATE   STATE    REM_HOST REM_DG    REM_RLNK
V  NAME         RVG          KSTATE   STATE    LENGTH   READPOL   PREFPLEX UTYPE
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE
DC NAME         PARENTVOL    LOGVOL
SP NAME         SNAPVOL      DCO
dg rootdg       default      default  0        1035385242.1025.pegasus
dm rootdisk     c0t0d0s2     sliced   3359     17693759 -
dm rootmirror   c0t1d0s2     sliced   6719     17683680 -
sd rootdiskPriv -            rootdisk 13423200 3359     PRIVATE   c0t0d0   ENA
v  rootvol      -            ENABLED  ACTIVE   13423200 ROUND     -        root
pl rootvol-01   rootvol      ENABLED  ACTIVE   13423200 CONCAT    -        RW
sd rootdisk-B0  rootvol-01   rootdisk 13423199 1        0         c0t0d0   ENA
sd rootdisk-02  rootvol-01   rootdisk 0        13423199 1         c0t0d0   ENA
v  swapvol      -            ENABLED  ACTIVE   2096640  ROUND     -        swap
pl swapvol-01   swapvol      ENABLED  ACTIVE   2096640  CONCAT    -        RW
sd rootdisk-01  swapvol-01   rootdisk 13426559 2096640  0         c0t0d0   ENA
v  var          -            ENABLED  ACTIVE   2100000  ROUND     -        fsgen
pl var-01       var          ENABLED  ACTIVE   2100000  CONCAT    -        RW
sd rootdisk-04  var-01       rootdisk 15523199 2100000  0         c0t0d0   ENA
Mirroring the operating system
Having encapsulated the root disk (rootdisk) and initialized the disk c0t1d0 as a new disk (rootmirror), we're now prepared to actually mirror the data from one to the other. Like many tasks in VxVM, there are many ways to accomplish this task, but the easiest if probably via the vxdiskadm command:
# vxdiskadm
Volume Manager Support Operations
Menu: VolumeManager/Disk
1      Add or initialize one or more disks
2      Encapsulate one or more disks
3      Remove a disk
4      Remove a disk for replacement
5      Replace a failed or removed disk
6      Mirror volumes on a disk
7      Move volumes from a disk
8      Enable access to (import) a disk group
9      Remove access to (deport) a disk group
10     Enable (online) a disk device
11     Disable (offline) a disk device
12     Mark a disk as a spare for a disk group
13     Turn off the spare flag on a disk
14     Unrelocate subdisks back to a disk
15     Exclude a disk from hot-relocation use
16     Make a disk available for hot-relocation use
17     Prevent multipathing/Suppress devices from VxVM's view
18     Allow multipathing/Unsuppress devices from VxVM's view
19     List currently suppressed/non-multipathed devices
20     Change the disk naming scheme
21     Get the newly connected/zoned disks in VxVM view
list   List disk information
?      Display help about menu
??     Display help about the menuing system
q      Exit from menus
Select an operation to perform: 6
Mirror volumes on a disk
Menu: VolumeManager/Disk/Mirror
  This operation can be used to mirror volumes on a disk.  These
  volumes can be be mirrored onto another disk or onto any
  available disk space.  Volumes will not be mirrored if they are
  already mirrored.  Also, volumes that are comprised of more than
  one subdisk will not be mirrored.
  Mirroring volumes from the boot disk will produce a disk that
  can be used as an alternate boot disk.
  At the prompt below, supply the name of the disk containing the
  volumes to be mirrored.
Enter disk name [,list,q,?] list
Disk group: rootdg
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
dm rootdisk     c0t0d0s2     sliced   3359     17693759 -
dm rootmirror   c0t1d0s2     sliced   3359     17690400 -
Enter disk name [,list,q,?] rootdisk
  You can choose to mirror volumes from disk rootdisk onto any
  available disk space, or you can choose to mirror onto a specific
  disk.  To mirror to a specific disk, select the name of that disk.
  To mirror to any available disk space, select "any".
Enter destination disk [,list,q,?] (default: any) rootmirror
  The requested operation is to mirror all volumes on disk rootdisk
  in disk group rootdg onto available disk space on disk rootmirror.
  NOTE: This operation can take a long time to complete.
Continue with operation? [y,n,q,?] (default: y)
  Mirror volume rootvol ...
  Mirror volume swapvol ...
  Mirror volume var ...
  Mirroring of disk rootdisk is complete.
Mirror volumes on another disk? [y,n,q,?] (default: n) q
Having completed the mirroring process, let's take a look at the output of vxprint -ht
# vxprint -ht
Disk group: rootdg
DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
RV NAME         RLINK_CNT    KSTATE   STATE    PRIMARY  DATAVOLS  SRL
RL NAME         RVG          KSTATE   STATE    REM_HOST REM_DG    REM_RLNK
V  NAME         RVG          KSTATE   STATE    LENGTH   READPOL   PREFPLEX UTYPE
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE
DC NAME         PARENTVOL    LOGVOL
SP NAME         SNAPVOL      DCO
dg rootdg       default      default  0        1035385242.1025.pegasus
dm rootdisk     c0t0d0s2     sliced   3359     17693759 -
dm rootmirror   c0t1d0s2     sliced   3359     17690400 -
sd rootdiskPriv -            rootdisk 13423200 3359     PRIVATE   c0t0d0   ENA
v  rootvol      -            ENABLED  ACTIVE   13423200 ROUND     -        root
pl rootvol-01   rootvol      ENABLED  ACTIVE   13423200 CONCAT    -        RW
sd rootdisk-B0  rootvol-01   rootdisk 13423199 1        0         c0t0d0   ENA
sd rootdisk-02  rootvol-01   rootdisk 0        13423199 1         c0t0d0   ENA
pl rootvol-02   rootvol      ENABLED  ACTIVE   13423200 CONCAT    -        RW
sd rootmirror-01 rootvol-02  rootmirror 0      13423200 0         c0t1d0   ENA
v  swapvol      -            ENABLED  ACTIVE   2096640  ROUND     -        swap
pl swapvol-01   swapvol      ENABLED  ACTIVE   2096640  CONCAT    -        RW
sd rootdisk-01  swapvol-01   rootdisk 13426559 2096640  0         c0t0d0   ENA
pl swapvol-02   swapvol      ENABLED  ACTIVE   2096640  CONCAT    -        RW
sd rootmirror-02 swapvol-02  rootmirror 13423200 2096640 0        c0t1d0   ENA
v  var          -            ENABLED  ACTIVE   2100000  ROUND     -        fsgen
pl var-01       var          ENABLED  ACTIVE   2100000  CONCAT    -        RW
sd rootdisk-04  var-01       rootdisk 15523199 2100000  0         c0t0d0   ENA
pl var-02       var          ENABLED  ACTIVE   2100000  CONCAT    -        RW
sd rootmirror-03 var-02      rootmirror 15519840 2100000 0        c0t1d0   ENA
Note that Veritas created two device alias referencing the boot disk and it's mirror. Based on the disk names, go to the ok prompt and confirm that the system can boot from either "vx-rootdisk" and "vx-rootmirror".


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/524/showart_87419.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP