Chinaunix首页 | 论坛 | 博客
  • 博客访问: 818006
  • 博文数量: 162
  • 博客积分: 5308
  • 博客等级: 大校
  • 技术积分: 2152
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-15 19:09
个人简介

DevOps让系统管理更轻松。

文章分类

全部博文(162)

文章存档

2014年(28)

2012年(10)

2011年(6)

2009年(60)

2008年(58)

我的朋友

分类:

2009-01-30 17:17:00

使用cfgmgr带参数不知道可不可以修改hdisk序号,暂时先不追究,今天试试使用mkdev添加虚设备到系统占用hdisk 来实施修改hdisk序号。

首先明确下hdisk号在系统中分布规律,hdisk是根据磁盘加入系统的时间,来依次分配的,如果同时加入系统,则根据hdiskscsi id序号来分配

系统环境:

F50:[/]#lsdev -C | grep scsi

iscsi0      Available               iSCSI Protocol Device

scsi0      Available 10-60         Wide SCSI I/O Controller

scsi1      Available 30-58         Wide SCSI I/O Controller

F50:[/]#lsdev -Cc disk

hdisk0 Available 10-60-00-0,0  16 Bit LVD SCSI Disk Drive

hdisk1 Available 10-60-00-1,0  16 Bit SCSI Disk Drive

hdisk2 Available 10-60-00-8,0  16 Bit SCSI Disk Drive

    F50:[/]#lspv

hdisk0          000af70dca7ae679                    vg00            active

hdisk1          000af70dca7aea4d                    vg00            active

hdisk2          000af70d4d50358c                    rootvg          active

 

其中hdisk017ghdisk1 hdisk2 9g 大小,由以上可知,hdisk2 rootvg,由于磁盘所在的scsi id的限制,导致使用cfgmgr 来修改hdisk 可能要涉及到拔插硬盘,至于带参数先cfgmgr scsi卡,好像也是根据 scsi id 顺序来配置。所以以下通过mkdev来实施。

 

具体思路是:通过镜像来实现系统在hdisk之间的移植,然后通过mkdev 做虚设备来补位填空。

 

以下是具体实施步骤:

Reduce vg00

F50:[/]#df -k

Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4            32768      3800   89%     2033    13% /

/dev/hd2          1966080     96764   96%    32357     7% /usr

/dev/hd9var         16384      7136   57%      377    10% /var

/dev/hd3            32768     12800   61%      241     3% /tmp

/dev/hd1            16384     15820    4%       21     1% /home

/proc                   -         -    -         -     -  /proc

/dev/hd10opt       114688     23160   80%     2296     9% /opt

/dev/ibmdata      9830400   8357388   15%      443     1% /data

F50:[/]#umount /data

F50:[/]#lsvg -l vg00

vg00:

LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT

ibmdata             jfs2       300   300   1    closed/syncd  /data

loglv00             jfs2log    1     1     1    closed/syncd  N/A

raw                 raw        12    12    1    closed/syncd  N/A

raw1                raw        3     3     1    closed/syncd  N/A

F50:[/]#df -k

Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4            32768      3800   89%     2033    13% /

/dev/hd2          1966080     96764   96%    32357     7% /usr

/dev/hd9var         16384      7136   57%      377    10% /var

/dev/hd3            32768     12800   61%      241     3% /tmp

/dev/hd1            16384     15820    4%       21     1% /home

/proc                   -         -    -         -     -  /proc

/dev/hd10opt       114688     23160   80%     2296     9% /opt

F50:[/]#rmlv ibmdata

Warning, all data contained on logical volume ibmdata will be destroyed.

rmlv: Do you wish to continue? y(es) n(o)? y

rmlv: Logical volume ibmdata is removed.

F50:[/]#rmlv raw

Warning, all data contained on logical volume raw will be destroyed.

rmlv: Do you wish to continue? y(es) n(o)? y

rmlv: Logical volume raw is removed.

F50:[/]#rmlv rwa  aw1

Warning, all data contained on logical volume raw1 will be destroyed.

rmlv: Do you wish to continue? y(es) n(o)? y

rmlv: Logical volume raw1 is removed.

F50:[/]#rmlv loglv00

Warning, all data contained on logical volume loglv00 will be destroyed.

rmlv: Do you wish to continue? y(es) n(o)? y

rmlv: Logical volume loglv00 is removed.

F50:[/]#reducevg vg00 hdisk0

F50:[/]#lspv

hdisk0          000af70dca7ae679                    None           

hdisk1          000af70dca7aea4d                    vg00            active

hdisk2          000af70d4d50358c                    rootvg          active

F50:[/]#reducevg vg00 hdisk1

ldeletepv: Volume Group deleted since it contains no physical volumes.

F50:[/]#lspv

hdisk0          000af70dca7ae679                    None           

hdisk1          000af70dca7aea4d                    None           

hdisk2          000af70d4d50358c                    rootvg          active

F50:[/]#extendvg rootvg hdisk1

F50:[/]#lspv

hdisk0          000af70dca7ae679                    None           

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk2          000af70d4d50358c                    rootvg          active

F50:[/]#lsdev -Cc disk

hdisk0 Available 10-60-00-0,0  16 Bit LVD SCSI Disk Drive

hdisk1 Available 10-60-00-1,0  16 Bit SCSI Disk Drive

hdisk2 Available 10-60-00-8,0  16 Bit SCSI Disk Drive

 

从系统中删除 hdisk0

F50:[/]#rmdev -dl hdisk0

hdisk0 deleted

F50:[/]#lsdev -Cc disk

hdisk1 Available 10-60-00-1,0  16 Bit SCSI Disk Drive

hdisk2 Available 10-60-00-8,0  16 Bit SCSI Disk Drive

 

将虚设备加入系统:

 

 F50:[/]#mkdev –p scis 0 –w 3,0 –c disk –s scsi –t scsd –l hdisk0 –d

hdisk0 Defined

此处使用mkdev 创建虚设备,注意scsi id 不要与真实设备的scsi id冲突

 

F50:[/]#lspv

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk2          000af70d4d50358c                    rootvg          active

F50:[/]#lsdev -Cc disk

hdisk0 Defined   10-60-00-3,0  Other SCSI Disk Drive

hdisk1 Available 10-60-00-1,0  16 Bit SCSI Disk Drive

hdisk2 Available 10-60-00-8,0  16 Bit SCSI Disk Drive

 

F50:[/]#cfgmgr

F50:[/]#lsdev -Cc disk

hdisk0 Defined   10-60-00-3,0 Other SCSI Disk Drive

hdisk1 Available 10-60-00-1,0 16 Bit SCSI Disk Drive

hdisk2 Available 10-60-00-8,0 16 Bit SCSI Disk Drive

hdisk3 Available 10-60-00-0,0 16 Bit LVD SCSI Disk Drive

 

镜像rootvg:以此将系统镜像到 hdisk1

 

F50:[/]#lspv

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk2          000af70d4d50358c                    rootvg          active

hdisk3          000af70dca7ae679                    None            

 

 

F50:[/]#chvg -Qn rootvg

F50:[/]#mirrorvg -S rootvg hdisk1 hdisk2

0516-1126 mirrorvg: rootvg successfully mirrored, user should perform

        bosboot of system to initialize boot records.  Then, user must modify

        bootlist to include:  hdisk2 hdisk1.

F50:[/]#lsvg -l rootvg

rootvg:

LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT

hd5                 boot       1     2     2    closed/syncd  N/A

hd6                 paging     32    64    2    open/syncd    N/A

hd8                 jfslog     1     2     2    open/syncd    N/A

hd4                 jfs        2     4     2    open/syncd    /

hd2                 jfs        120   240   2    open/syncd    /usr

hd9var              jfs        1     2     2    open/syncd    /var

hd3                 jfs        2     4     2    open/syncd    /tmp

hd1                 jfs        1     2     2    open/syncd    /home

hd10opt             jfs        7     14    2    open/syncd    /opt

F50:[/]# bosboot -a

 

bosboot: Boot image is 23229 512 byte blocks.

F50:[/]#bootlist -m normal hdisk1 hdisk2 cd0

F50:[/]#syncvg -v rootvg

F50:[/]#bosboot -a

 

bosboot: Boot image is 23229 512 byte blocks.

 

镜像后,将hdisk2 剔出:

F50:[/]#unmirrorvg rootvg hdisk2

0516-1246 rmlvcopy: If hd5 is the boot logical volume, please run 'chpv -c '

0516-1246 rmlvcopy: If hd5 is the boot logical volume, please run 'chpv -c '

        as root user to clear the boot record and avoid a potential boot

        off an old boot image that may reside on the disk from which this

        logical volume is moved/removed.

0516-1132 unmirrorvg: Quorum requirement turned on, reboot system for this

        to take effect for rootvg.

0516-1144 unmirrorvg: rootvg successfully unmirrored, user should perform

        bosboot of system to reinitialize boot records.  Then, user must modify

        bootlist to just include:  hdisk1.

F50:[/]#lspv

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk2          000af70d4d50358c                    rootvg          active

hdisk3          000af70dca7ae679                    None           

F50:[/]#lsvg -l rootvg

rootvg:

LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT

hd5                 boot       1     1     1    closed/syncd  N/A

hd6                 paging     32    32    1    open/syncd    N/A

hd8                 jfslog     1     1     1    open/syncd    N/A

hd4                 jfs        2     2     1    open/syncd    /

hd2                 jfs        120   120   1    open/syncd    /usr

hd9var              jfs        1     1     1    open/syncd    /var

hd3                 jfs        4     4     1    open/syncd    /tmp

hd1                 jfs        1     1     1    open/syncd    /home

hd10opt             jfs        7     7     1    open/syncd    /opt

F50:[/]#reducevg rootvg hdisk2

F50:[/]#bosboot -a

 

0301-168 bosboot: The current boot logical volume, /dev/hd5,

        does not exist on /dev/hdisk2.

F50:[/]#chpv -c hdisk2

F50:[/]#bosboot -ad /dev/hdisk1

 

bosboot: Boot image is 23229 512 byte blocks.

F50:[/]#bootlist -m norman hdisk1 cd0

F50:[/]#bootlist -m normal -o

hdisk1 blv=hd5

cd0

F50:[/]#lspv

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk2          000af70d4d50358c                    None           

hdisk3          000af70dca7ae679                    None           

F50:[/]#lsdev -c Cc disk

hdisk0 Defined   10-60-00-3,0 Other SCSI Disk Drive

hdisk1 Available 10-60-00-1,0 16 Bit SCSI Disk Drive

hdisk2 Available 10-60-00-8,0 16 Bit SCSI Disk Drive

hdisk3 Available 10-60-00-0,0 16 Bit LVD SCSI Disk Drive

 

 

删除hdisk0 并将hdisk2 更改为hdik0hdisk3改为hdisk2

F50:[/]#rmdev -a dl hdisk0

hdisk0 deleted

F50:[/]#rmdev -dl hdisk2

hdisk2 deleted

F50:[/]#lspv

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk3          000af70dca7ae679                    None           

F50:[/]#lsdev -Cc disk

hdisk1 Available 10-60-00-1,0 16 Bit SCSI Disk Drive

hdisk3 Available 10-60-00-0,0 16 Bit LVD SCSI Disk Drive

F50:[/]#cfgmgr

F50:[/]#lspv

hdisk0          000af70d4d50358c                    None           

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk3          000af70dca7ae679                    None           

F50:[/]#lsdev -Cc disk

hdisk0 Available 10-60-00-8,0 16 Bit SCSI Disk Drive

hdisk1 Available 10-60-00-1,0 16 Bit SCSI Disk Drive

hdisk3 Available 10-60-00-0,0 16 Bit LVD SCSI Disk Drive

F50:[/]#rmdev -dl hdisk3

hdisk3 deleted

F50:[/]#cfgmgr

F50:[/]#lspv

hdisk0          000af70d4d50358c                    None           

hdisk1          000af70dca7aea4d                    rootvg          active

hdisk2          000af70dca7ae679                    None           

F50:[/]#lsdev -Cc disk

hdisk0 Available 10-60-00-8,0 16 Bit SCSI Disk Drive

hdisk1 Available 10-60-00-1,0 16 Bit SCSI Disk Drive

hdisk2 Available 10-60-00-0,0 16 Bit LVD SCSI Disk Drive

 

至此,所有更改完成,如果有需要,可以通过镜像 再将系统 镜像到hdisk0上。

 

重启机器:

F50:[/]#shutdown –Fr

 

启动后: 

F50:[/]#lspv

hdisk0          000af70d4d50358c                    rootvg          active

hdisk1          000af70dca7aea4d                    None

hdisk2          000af70dca7ae679                    None

 

  其实,不用借助虚设备,直接使用mkdev 命令对实际磁盘操作,将简单许多

F50:[/]#mkdev -p scsi0 -w 1,0 -c disk -s scsi -t scsd -l hdisk2
hdisk2 Available
注意 以上没加-d 参数,设备状态将为available

阅读(1778) | 评论(0) | 转发(0) |
0

上一篇:dd命令

下一篇:减小hd6页面空间大小

给主人留下些什么吧!~~