Moving a file system to a new Volume group
(VG) when loglv does not exist.
Note: I wants to move u01Nlv logical volume from one volume group (oravg) to
another (datavg) as shown below:
#lsvg -l oravg
oravg:
LV NAME TYPE LPs
PPs PVs LV STATE
MOUNT POINT
u01Nlv jfs2 240
240 1 open/syncd
/u01
loglv02 jfs2log 1
1 1 open/syncd N/A
#
#lsvg -l datavg
datavg:
LV NAME TYPE LPs
PPs PVs LV STATE
MOUNT POINT
#
Step
1 Close the source LV
#
umount /u01
Step 2 Copy the source logical volume (LV) to the desired volume group (VG).
Syntax:
cplv -v VolumeGroup
-y NewLogicalVolume SourceLogicalVolume
# cplv -v datavg -y u01lv u01Nlv
cplv: Logical volume dominolv successfully
copied to u01lv.
#
Step 3 JFS and JFS2 file systems require a log device.
Verify that JFS or JFS2 log exist, if JFS or JFS2 log does not exist you have to create it. To make a new JFS2 log, enter
# lsvg -l datavg
datavg:
LV NAME TYPE LPs
PPs PVs LV STATE
MOUNT POINT
u01lv jfs2 120
120 1 closed/syncd N/A
#
# mklv -t jfs2log datavg 1
loglv01
#
# lsvg -l datavg
datavg:
LV NAME TYPE LPs
PPs PVs LV STATE
MOUNT POINT
u01lv jfs2 120
120 1 closed/syncd N/A
loglv01 jfs2log 1
1 1
closed/syncd N/A
#
Format the loglv01 logical volume
once it has been create.
#
logform /dev/loglv01
logform:
destroy /dev/rloglv01 (y)?y
#
Step
4 change file system's lv and log
device
# chfs -a dev=/dev/u01lv -a
log=/dev/loglv01 /u01
Step 5 run fsck to ensure file system integrity & Mount the filesytem
#fsck -p /dev/u01lv
The current volume is:
/dev/u01lv
Primary superblock is valid.
J2_LOGREDO:log redo processing
for /dev/u01lv
Primary superblock is valid.
*** Phase 1 - Initial inode scan
*** Phase 2 - Process remaining
directories
*** Phase 3 - Process remaining
files
*** Phase 4 - Check and repair
inode allocation map
*** Phase 5 - Check and repair
block allocation map
File system is clean.
#
# mount /u01
Step
6 rmove the source logical volume
#
rmlv u01Nlv
Moving a filesystem between volume groups
(VG) – When loglv already exist.
Note:
Moving a u01lv from datavg to Backupvg
# lsvg
-l datavg
datavg:
LV
NAME TYPE LPs
PPs PVs LV STATE
MOUNT POINT
loglv01 jfs2log 1
1 1 open/syncd N/A
u01lv jfs2 200
200 1 open/syncd /u01
#
# lsvg
-l Backupvg
testvg:
LV NAME TYPE LPs
PPs PVs LV STATE
MOUNT POINT
loglv03 jfs2log 1
1 1 open/syncd N/A
mybackuplv jfs2 80
80 1 open/syncd /mybackup
#
Step
1- Close the source LV (umount
filesystem)
#
umount /u01
Step
2- Copy the
source LV to another VG
# cplv
-v testvg -y u01lvnew u01lv
cplv:
Logical volume u01lv successfully copied to u01lvnew .
#
Verify
# lsvg
-l testvg
testvg:
LV
NAME TYPE LPs
PPs PVs LV STATE
MOUNT POINT
loglv03 jfs2log 1
1 1 open/syncd N/A
mybackuplv jfs2 80
80 1 open/syncd /mybackup
u01lvnew jfs2 400
400 1 closed/syncd N/A
#
Step 3- Change filesystem's lv and log device on new vg.
Note: Loglv
(loglv03) already exist on the destination VG (Backupvg).
# chfs
-a dev=/dev/u01lvnew -a log=/dev/loglv03 /u01
**** Step
4 and 5 are Optional *******
Step 4- Remove old (source) LV.
# rmlv
-f u01lv
Step 5- Change the LV name: newname_lv to oldname_lv
# chlv
-n u01lv ulv01new
Step 6- Mount the filesystem
#
mount /u01
Verify
# df
-g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 1.75 1.43
19% 4180 2% /
/dev/hd2 3.12 1.12
65% 38689 13% /usr
/dev/hd9var 0.50 0.08
84% 2956 14% /var
/dev/hd3 4.00 3.98
1% 234 1% /tmp
/dev/hd1 3.12 2.36
25% 953 1% /home
/proc - -
- - -
/proc
/dev/hd10opt 0.12
0.08 33% 997
5% /opt
/dev/mro_lv 4.00 3.98
1% 4 1% /mro
/dev/rootlv 7.00 4.63
34% 284 1% /root
/dev/backuplv 40.00
36.63 9% 7
1% /backup
/dev/u01lvnew 50.00
46.82 7% 1172
1% /u01
#