Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cplv - (again) 1

Status
Not open for further replies.

ogniemi

Technical User
Nov 7, 2003
1,041
PL
Hello,
The "cplv" manual says:

"To copy the contents of logical volume lv02 to a smaller, existing logical volume, lvtest, without requiring user confirmation, type:
cplv -e lvtest -f lv02
"

So, for test I performed the following steps:

# lspv
hdisk0 002226912c981ff6 rootvg
hdisk1 002226918798d854 rootvg
hdisk2 00222691e476ec7b None
hdisk3 00222691e4856e64 None
# mkvg -s 32 -y test1 hdisk2
test1
# mkvg -s 32 -y test2 hdisk3
test2
# mklv -y big_lv test1 5
big_lv
# mklv -y small_lv test2 3
small_lv
# crfs -v jfs -d big_lv -m /bigfs
Based on the parameters chosen, the new /bigfs JFS file system
is limited to a maximum size of 134217728 (512 byte blocks)

New File System size is 327680

# mount /bigfs
# dd if=/dev/zero of=/bigfs/50Mb.file count=50000 bs=1k
50000+0 records in
50000+0 records out

# ls -la
total 100024
drwxr-sr-x 3 sys sys 512 Nov 14 08:51 .
drwxr-xr-x 44 root system 1536 Nov 14 08:48 ..
-rw-r--r-- 1 root sys 51200000 Nov 14 08:51 50Mb.file
drwxrwx--- 2 root system 512 Nov 14 08:48 lost+found

# df /bigfs
Filesystem 512-blocks Free %Used Iused %Iused Mounted on
/dev/big_lv 327680 217208 34% 18 1% /bigfs

# umount /bigfs
# cplv -e small_lv -f big_lv
0516-746 cplv: Destination logical volume must have
type set to copy.
cplv: Use chlv command with -t flag to change the type to copy.

# chlv -t copy small_lv
# cplv -e small_lv -f big_lv
0516-748 cplv: Warning, copying to a smaller logical volume --
may lose data. Also, could corrupt any existing filesystem.
cplv: Logical volume big_lv successfully copied to small_lv .

# lslv -l big_lv
big_lv:/bigfs
PV COPIES IN BAND DISTRIBUTION
hdisk2 005:000:000 100% 000:005:000:000:000

# lslv -l small_lv
small_lv:N/A
PV COPIES IN BAND DISTRIBUTION
hdisk3 003:000:000 100% 000:003:000:000:000

# lsvg -l test2
test2:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
small_lv jfs 3 3 1 closed/syncd N/A

# mklv -t jfslog -y jfslog2_lv test2 1
jfslog2_lv

# logform /dev/jfslog2_lv
logform: destroy /dev/jfslog2_lv (y)?y
# chfs -a dev=/dev/small_lv -a log=/dev/jfslog2_lv /bigfs

# lsvg -l test1
test1:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
big_lv jfs 5 5 1 closed/syncd N/A
loglv01 jfslog 1 1 1 closed/syncd N/A

# lsvg -l test2
test2:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
small_lv jfs 3 3 1 closed/syncd /bigfs
jfslog2_lv jfslog 1 1 1 closed/syncd N/A
# mount /bigfs

# df /bigfs
Filesystem 512-blocks Free %Used Iused %Iused Mounted on
/dev/small_lv 327680 217208 34% 18 1% /bigfs


Please let me know why the "small_lv" which sill have 3PPs (8MB PP size) on "df" output is shown 327680 512-blocks (the same as for big_lv which has 5PPs each 8MB)?


best regards,
M.

 
When you did the cplv, you have copied the lvcb - which contains the number of lp - so it is why you have a warning in the cplv

just do a getlvcb -At small_lv and compare it to the big one. You will have 5 lp instead of 3.
 
So, what for is there in manual the example I mentioned above?
Is then "cplv" not recommended in case of need to decrease the LV by copying big LV with cplv to smaller LV (of course space used in fs created on big LV is lower then small LV can get)?

regards,M.
 
in cplv's man page :

...
Attention: Do not copy from a larger logical volume containing data to a
smaller one. Doing so results in a corrupted file system because some data
(including the superblock) is not copied.

...

i guess you have your answer no ?

just do the getlvcb, to verify if lvcb is correct or no
 
it looks there are still 3 - not 5PPs in small_lv


root@fragdn05 /dev/pts/5 /
# getlvcb -At small_lv
m 1 m 00211691f45bf666.1 small_lv /bigfs 116919100 3 y y 0 0 jfs 32 log=/dev/jfslog2_lv:account=false Wed Nov 19 14:20:15 2003
Wed Nov 19 14:27:40 2003


# getlvcb -At big_lv
m 1 m 00211691f45c6338.1 big_lv /bigfs 116919100 5 y y 0 0 jfs 32 log=/dev/loglv01:account=false Wed Nov 19 14:20:49 2003
Wed Nov 19 14:22:25 2003

 
it looks there are still 3 - not 5PPs in small_lv



# getlvcb -At small_lv
m 1 m 00211691f45bf666.1 small_lv /bigfs 116919100 3 y y 0 0 jfs 32 log=/dev/jfslog2_lv:account=false Wed Nov 19 14:20:15 2003
Wed Nov 19 14:27:40 2003


# getlvcb -At big_lv
m 1 m 00211691f45c6338.1 big_lv /bigfs 116919100 5 y y 0 0 jfs 32 log=/dev/loglv01:account=false Wed Nov 19 14:20:49 2003
Wed Nov 19 14:22:25 2003

 
an the other infos:

# lslv small_lv
LOGICAL VOLUME: small_lv VOLUME GROUP: test2
LV IDENTIFIER: 00211691f45bf666.1 PERMISSION: read/write
VG STATE: active/complete LV STATE: opened/syncd
TYPE: jfs WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 32 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 3 PPs: 3
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 32
MOUNT POINT: /bigfs LABEL: /bigfs
MIRROR WRITE CONSISTENCY: on
EACH LP COPY ON A SEPARATE PV ?: yes

# lslv big_lv
LOGICAL VOLUME: big_lv VOLUME GROUP: test1
LV IDENTIFIER: 00211691f45c6338.1 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/syncd
TYPE: jfs WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 32 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 5 PPs: 5
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 32
MOUNT POINT: N/A LABEL: /bigfs
MIRROR WRITE CONSISTENCY: on
EACH LP COPY ON A SEPARATE PV ?: yes

# lslv -l small_lv
small_lv:/bigfs
PV COPIES IN BAND DISTRIBUTION
hdisk3 003:000:000 100% 000:003:000:000:000

# lslv -l big_lv
big_lv:N/A
PV COPIES IN BAND DISTRIBUTION
hdisk2 005:000:000 100% 000:005:000:000:000


# df -k /dev/small_lv /dev/big_lv
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/small_lv 163840 108604 34% 18 1% /bigfs
/dev/big_lv 163840 108604 34% 18 1% /bigfs_orginal
 
one thing more:

# lsvg -l test1
test1:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
big_lv jfs 5 5 1 open/syncd /bigfs_orginal
loglv01 jfslog 1 1 1 open/syncd N/A

# lsvg -l test2
test2:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
small_lv jfs 3 3 1 open/syncd /bigfs
jfslog2_lv jfslog 1 1 1 open/syncd N/A

# lsvg test1
VOLUME GROUP: test1 VG IDENTIFIER: 00211691f45c6338
VG STATE: active PP SIZE: 32 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 67 (2144 megabytes)
MAX LVs: 256 FREE PPs: 61 (1952 megabytes)
LVs: 2 USED PPs: 6 (192 megabytes)
OPEN LVs: 2 QUORUM: 2
TOTAL PVs: 1 VG DESCRIPTORS: 2
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 1 AUTO ON: yes
MAX PPs per PV: 1016 MAX PVs: 32

# lsvg test2
VOLUME GROUP: test2 VG IDENTIFIER: 00211691f45bf666
VG STATE: active PP SIZE: 32 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 31 (992 megabytes)
MAX LVs: 256 FREE PPs: 27 (864 megabytes)
LVs: 2 USED PPs: 4 (128 megabytes)
OPEN LVs: 2 QUORUM: 2
TOTAL PVs: 1 VG DESCRIPTORS: 2
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 1 AUTO ON: yes
MAX PPs per PV: 1016 MAX PVs: 32




So I don't know why the df -k shows the same size when it number of 32MB PPs is different for both LSs.
 
the file I created for test is the same in foth FS so cplv copied properly the data.

# ls -la
total 100024
drwxr-sr-x 3 sys sys 512 Nov 19 14:23 .
drwxr-xr-x 45 root system 1536 Nov 19 14:37 ..
-rw-r--r-- 1 root sys 51200000 Nov 19 14:23 50Mb.file
drwxrwx--- 2 root system 512 Nov 19 14:22 lost+found

# ls -la /bigfs
total 100024
drwxr-sr-x 3 sys sys 512 Nov 19 14:23 .
drwxr-xr-x 45 root system 1536 Nov 19 14:37 ..
-rw-r--r-- 1 root sys 51200000 Nov 19 14:23 50Mb.file
drwxrwx--- 2 root system 512 Nov 19 14:22 lost+found

# ls -la /bigfs_orginal
total 100024
drwxr-sr-x 3 sys sys 512 Nov 19 14:23 .
drwxr-xr-x 45 root system 1536 Nov 19 14:37 ..
-rw-r--r-- 1 root sys 51200000 Nov 19 14:23 50Mb.file
drwxrwx--- 2 root system 512 Nov 19 14:22 lost+found

# ls -li /bigfs_orginal
total 100008
17 -rw-r--r-- 1 root sys 51200000 Nov 19 14:23 50Mb.file
16 drwxrwx--- 2 root system 512 Nov 19 14:22 lost+found

# ls -li /bigfs
total 100008
17 -rw-r--r-- 1 root sys 51200000 Nov 19 14:23 50Mb.file
16 drwxrwx--- 2 root system 512 Nov 19 14:22 lost+found

# istat /bigfs_orginal/50Mb.file
Inode 17 on device 66/1 File
Protection: rw-r--r--
Owner: 0(root) Group: 3(sys)
Link count: 1 Length 51200000 bytes

Last updated: Wed Nov 19 14:23:28 2003
Last modified: Wed Nov 19 14:23:28 2003
Last accessed: Wed Nov 19 14:23:01 2003


# istat /bigfs/50Mb.file
Inode 17 on device 48/1 File
Protection: rw-r--r--
Owner: 0(root) Group: 3(sys)
Link count: 1 Length 51200000 bytes

Last updated: Wed Nov 19 14:23:28 2003
Last modified: Wed Nov 19 14:23:28 2003
Last accessed: Wed Nov 19 14:23:01 2003


# cksum /bigfs_orginal/50Mb.file
2581748673 51200000 /bigfs_orginal/50Mb.file

# cksum /bigfs/50Mb.file
2581748673 51200000 /bigfs/50Mb.file


 
OK, the "problem" solved after run fsck /bigfs (build on small_lv). the fsck was running about 15minutes and after completed I have now 5PPs in LV - so somehow it increased or repaired small_lv.

best regards,m
 
hmmm you are lucky there... i tryed to reproduce your problem and i cannot mount anymore the fs after the fsck => cannot write block xxxx while fsck'ing....
Don't try to call support after that ;-)
 
of course the fsck was run after I had unmounted /bigfs

as I told it completed after ca. 15 minutes after a lot of operations listed on screen, but after it completed I can mount /bigfs and access the data/file in without any problems/warnings.


regards,m.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top