1820027 Members
3282 Online
109608 Solutions
New Discussion юеВ

Re: SWAP on LVM disk.

 
SOLVED
Go to solution
Ronald Cogen
Frequent Advisor

SWAP on LVM disk.

My first Linux installation with SuSE Enterpr. 8 poses certain problems for me. Problem: I have 2 disks 1) SCSI HDD for the system. 2) SCSI hot swap disk array HP 642 Raid 5 for data and applications.
On the system disk I created a partion with a swap file (2 x mem)
On the Raid 5 disk array I set up LVM and created a volume as a secondary swap, the same size as on the system disk. AS I recall from HP-UX one can create a file or a device swap as needed. Have I done something incorrect by creating a secondary swap on an LVM volume?
I've been down so long it looks like up to me
7 REPLIES 7
Mark Grant
Honored Contributor
Solution

Re: SWAP on LVM disk.

Absolutely no problem at all. The only thing is, you need to make sure your logical volume is contiguous. THat is, when you do the "lvcreate", you need to include the "-C" argument
Never preceed any demonstration with anything more predictive than "watch this"
Steven E. Protter
Exalted Contributor

Re: SWAP on LVM disk.

If it works right no.

You can do all of your disk management except mirroring with the Linux LVM port.

You can do mirroring on LVM logical volumes with the standard Linux mirror software.

I think you may have created too much swap.

Your original swap was twice memory which is as high as one should go. I accidently made a box with swap 4x memory and it runs like a dog. Now I have to buy it a RAM chip.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ronald Cogen
Frequent Advisor

Re: SWAP on LVM disk.

Mark: I set it up with YAST. But, is there really an lvcreate? Thanks for the quick reply.

Steven: Thanks for the tip. I think the person on-site wants to upgrade the memory, but maybe the additional swap should wait until that happens.
I've been down so long it looks like up to me
Mark Grant
Honored Contributor

Re: SWAP on LVM disk.

If you set swap up using LVM with Yast, then I imagine it is already contiguous. You can check though.

If your logical volume for swap is called /dev/vg01/lvol1 then "lvdisplay /dev/vg01/lvol1" should show something like "contiguous" against the "Allocation" field.

But, in answer to your question, yes ther eis a command called "lvcreate". You can try "man lvcreate" if you don't believe me :)
Never preceed any demonstration with anything more predictive than "watch this"
Stuart Browne
Honored Contributor

Re: SWAP on LVM disk.

lvcreate is the hand-way of creating them :P The Fedora core box I use now was created in that manner (*whee!* Not easy :P).

Now, as for the adding more swap thing. Do you really need it? Look at the values in /proc/meminfo (in particular SwapFree). If that is low, then yes, you need both more memory, and more swap.

If that's still a reasonable value, then I'd assume you wouldn't need more.

If the value of 'Swap Used' is high, you probably need more memory.

That gets convoluted however due to the way buffers and IO caching is handled in Linux..

Example for ya, from my little Fedora box..

It started life with 128MB of ram, the Swap used was constantly 40-60MB. Ok, needs more memory.

Threw in a few 256M sticks, now has a total of 512MB. After a few weeks of running, it's back to using about 30-40MB of swap. However, the Cache and Buffers values are now around 140+MB a piece. The performance of the box is many times what it was.

Linux swaps out things which don't get used often. As the machine only gets 200-300 mail messages a day, it's pretty idle, so things like spamasssassin, sshd, squid, httpd etc. get swapped out as they aren't getting used..

The memory management isn't as cut/clear as it is in some of the modern Unixen (HPUX/SCO/etc.), but once you get comfortable with it, it's fun..

.. hrm, I've probably just gone and confused ya :P Anyway, Check how much swap is getting used before doing too much. It may be unnecessary to increase it if it's already double-physical-ram..
One long-haired git at your service...
Ronald Cogen
Frequent Advisor

Re: SWAP on LVM disk.

Mark: Thanks. That's great about lvcrete, etc. I'll be curious to see if the module functions like its counterpart on HP-UX. I becoming constantly surprised to see how 'Unix' 'Linux' actually is. Well, of course, that's a dumb remark, but so what ...I appreciate your quick and helpful replies. It motivates me to ask more 'dumb' questions, until I get the hang of it all.

Stuart: No, you didn't confuse me at all. It's always good to receive additional useful information. I'll keep some of your hints in mind. The only reason I gave 4x mem was because mem will be upgraded shortly.
I've been down so long it looks like up to me
Mark Grant
Honored Contributor

Re: SWAP on LVM disk.

Ronald, you will find that linux LVM is based on HP-UX LVM and all the commands are the same pretty much.
Never preceed any demonstration with anything more predictive than "watch this"