Operating System - HP-UX
1833864 Members
2367 Online
110063 Solutions
New Discussion

Re: problem creating new lvol

 
SOLVED
Go to solution
B.Beekmans
Advisor

problem creating new lvol

I created a new lvol to extend the swapspace.
When trying to activate it says there is already a filesystem on the lvol :

[nlxmar04:/]# lvcreate vg00
Logical volume "/dev/vg00/lvol17" has been successfully created with
character device "/dev/vg00/rlvol17".
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
[nlxmar04:/]# lvextend -l 1 /dev/vg00/lvol17
/dev/dsk/c2t0d0
Logical volume "/dev/vg00/lvol17" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
[nlxmar04:/]# lvextend -m 1 /dev/vg00/lvol17 /dev/dsk/c2t1d0
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol17" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
[nlxmar04:/]# lvextend -L 4000 /dev/vg00/lvol17 /dev/dsk/c2t0d0 /dev/dsk/c2t1d0
Logical volume "/dev/vg00/lvol17" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
[nlxmar04:/]# swapon -a
Enabling device paging on /dev/vg00/lvol17.
swapon: Device /dev/vg00/lvol17 contains a file system.
The system will page in the space after the end of the file system.
Add `end' to the options field in /etc/fstab to turn off this warning.

Can anyone tell me what happened ?
I get this on 8 different servers.
OS HP-ux 11.11
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning...
15 REPLIES 15
Ninad_1
Honored Contributor

Re: problem creating new lvol

First thing is if you are creating a lvol for swap it must be contiguous and bad block relocation whould be disabled so
lvcreate -L 4000 -n swapvol2 -C y -r n /dev/vg00
Then
lvextend -m 1 /dev/vg00/swapvol2 /dev/dsk/c2t1d0

Then add entry in /etc/fstab
/dev/vg00/swapvol2 swap swap defaults 0 0

then swapon -a

Regards,
Ninad
Torsten.
Acclaimed Contributor

Re: problem creating new lvol

a swap device has to be at least strict/contiguous policy set.

see "man lvcreate" for more information.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Rajesh SB
Esteemed Contributor

Re: problem creating new lvol

Hi Beekmans,

If you are make swap on lvol containing filesystem use option.

# swapon -fa /dev/vg00/vlol17

Cheers,
Rajesh
Rajesh SB
Esteemed Contributor

Re: problem creating new lvol

Sorry,

Use command # swapon -f

Cheers,
Rajesh
Ninad_1
Honored Contributor

Re: problem creating new lvol

Yes as correctly pointed out above the policy should be strict contiguous - [ In my previous note strict is missing so do add as below ]
lvcreate -L 4000 -n swapvol2 -s y -C y -r n /dev/vg00
and if you have PV groups then add the 2 disks in the 2 different PV groups and use
lvcreate -L 4000 -n swapvol2 -s g -C y -r n /dev/vg00

Regards,
Ninad
B.Beekmans
Advisor

Re: problem creating new lvol

Hello Ninad,
did it your way but stil get the same error :

[nlxmar04:/]# lvcreate -L 4000 -m 1 -s y -C y -r n /dev/vg00
Logical volume "/dev/vg00/lvol17" has been successfully created with
character device "/dev/vg00/rlvol17".
Logical volume "/dev/vg00/lvol17" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

added antry in fstab:
/dev/vg00/lvol17 ... swap defaults 0 0

[nlxmar04:/]# swapon -a
Enabling device paging on /dev/vg00/lvol17.
swapon: Device /dev/vg00/lvol17 contains a file system.
The system will page in the space after the end of the file system.
Add `end' to the options field in /etc/fstab to turn off this warning.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning...
B.Beekmans
Advisor

Re: problem creating new lvol

Rajesh,
with "swapon -fa " it only uses the part of the lvol that is "empty".
I tried this already on an other system:
[nlxmar03:root:/]# swapinfo -t
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4194304 1084664 3109640 26% 0 - 1 /dev/vg00/lvol2
dev 950272 3680 946592 0% 3145728 - 1 /dev/vg00/lvol17
reserve - 1690224 -1690224
memory 3131132 2648244 482888 85%
total 8275708 5426812 2848896 66% - 0 -
[nlxmar03:root:/]# lvdisplay /dev/vg00/lvol17
--- Logical volumes ---
LV Name /dev/vg00/lvol17
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 4000
Current LE 250
Allocated PE 500
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default

So that does not solve my problem
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning...
Ninad_1
Honored Contributor

Re: problem creating new lvol

Hi,

Are you sure you created the volume with the command I gave, because in the lvdisplay its showing bac block on and Allocation is not showing as contiguous.
I think the previous swapon -a command added the swap device, and not sure how it allowed to create lvol17 again if the volume was activated as swap.
I think you need to reboot the server after removing the the entry for this swap device from /etc/fstab.
Then delete the volume and create it with the command I mentioned. Check the volume if it is showing strict/contiguous allocation and bad block allocation off
Then add entry in /etc/fstab and then use swapon -a

Regards,
Ninad
B.Beekmans
Advisor

Re: problem creating new lvol

Ninad,
in my reply to Rajesh I was talking about another server, and there badblock allocation is on.
I created the lvol with the command you gave ( see reply to you )but the swapdevice is not added becuase ir says there is already a filesystem on it. I tried to force it on another ser with the same problem and than it is added , but only for a part.
Strange is after deleting the lvol and recreating it your way , it still says there is a filesystem on it.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning...
Ninad_1
Honored Contributor

Re: problem creating new lvol

Strange.
What does fstyp -v /dev/vg00/lvol17 show ?
You said you created a new lvol and did not create a filesystem using newfs - is that right ?
Then its really strange.
Try fstyp to see if really a filesystem is there.

Regards,
Ninad
B.Beekmans
Advisor

Re: problem creating new lvol

[nlxmar04:/]# fstyp -v /dev/vg00/lvol17
vxfs
version: 4
f_bsize: 8192
f_frsize: 1024
f_blocks: 1048576
f_bfree: 1047214
f_bavail: 981764
f_files: 261832
f_ffree: 261800
f_favail: 261800
f_fsid: 1073741841
f_basetype: vxfs
f_namemax: 254
f_magic: a501fcf5
f_featurebits: 0
f_flag: 0
f_fsindex: 7
f_size: 1048576


[nlxmar04:/]# lvdisplay /dev/vg00/lvol17
--- Logical volumes ---
LV Name /dev/vg00/lvol17
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 4000
Current LE 250
Allocated PE 500
Stripes 0
Stripe Size (Kbytes) 0
Bad block off
Allocation strict/contiguous
IO Timeout (Seconds) default


No I did not use newfs
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning...
Enrico P.
Honored Contributor

Re: problem creating new lvol

Hi,

check for filesystem on /dev/vg00/lvol17 with:

fstyp /dev/vg00/lvol17

also check if there is an /dev/vg00/lvol17 entry in the lvmtab file in add at the swap line.

then try with this procedure:

# lvcreate -C y -L -n lvswap2 /dev/vg00

# lvchange -r n /dev/vg00/lvswap2 (bad block off)

# lvchange -c n -M n /dev/vg00/lvswap2 (Mirror Write cache off)

# lvlnboot -d /dev/vg00/lvswap2

# vi /etc/fstab add:
/dev/vg00/lvswap2 ... swap pri=1 0 0
Ninad_1
Honored Contributor
Solution

Re: problem creating new lvol

OK.
Now try mounting the filesystem to a temporary directory - see if there are any contents you wish to have.
If yes copy the stuff somewhere else and unmount ,
If not unmount the filesystem
do a
prealloc /tmp/testfile 10000000
This will create a file with nulls of the size 10MB
The zero out the filesystem metadata from the lvol17
dd if=/tmp/testfile of=/dev/vg00/lvol17
Now try swapon -a , I think this should work

Regards,
Ninad
B.Beekmans
Advisor

Re: problem creating new lvol

Ninad,

this works.
thanks for your time investigating.

greetz,
Barry
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning...
B.Beekmans
Advisor

Re: problem creating new lvol

problem has been solved by destoying the metadata on the logical volume.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning...