Hello, I'm in a slightly unusual situation and I'd really appreciate some advice. I installed CentOS 5.2 on a server about a month ago. Today I happened to check the 'free' command and noticed that the Swap line reads as follows: Swap: 0 0 0 I'm pretty certain that when I installed the OS and created a custom partition table, that I defined a swap partition, but there is no swap line in /etc/fstab either. However the output of 'lvm> lvdisplay' contains the following information (amongst others): --- Logical volume --- LV Name /dev/VolGroup00/swap VG Name VolGroup00 LV UUID 7uOBcj-tN16-uAbO-3nyy-3scZ-SAEA-7HKWPW LV Write Access read/write LV Status available # open 0 LV Size 1.94 GB Current LE 62 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:5 Also 'ls' confirms that logical volume exists: [root at mail ~]# ls -l /dev/VolGroup00/swap lrwxrwxrwx 1 root root 27 Sep 30 11:30 /dev/VolGroup00/swap -> /dev/mapper/VolGroup00-swap I'd like to know: 1. How can I check how this logical volume is formatted (and if it is formatted)? 2. Is it possible to use this logical volume? If I add a line to /etc/fstab, what are the chances of rendering my system unbootable? The server is in use and presently doesn't have any memory problems, and while it's not mission critical server I'd rather not mess it up with any ill-thought out tinkering. If anyone can give me some advice on this I'd be very grateful. Thanks Ian Masters
Ian Masters wrote:> Hello, > > I'm in a slightly unusual situation and I'd really appreciate some advice. > > I installed CentOS 5.2 on a server about a month ago. > > Today I happened to check the 'free' command and noticed that the Swap > line reads as follows: > > Swap: 0 0 0 > > I'm pretty certain that when I installed the OS and created a custom > partition table, that I defined a swap partition, but there is no swap > line in > /etc/fstab either. > > However the output of 'lvm> lvdisplay' contains the following information > (amongst others): > > --- Logical volume --- > LV Name /dev/VolGroup00/swapIf that volume is not in use by anything else you should be perfectly able to do: mkswap /dev/VolGroup00/swap swapon /dev/VolGroup00/swap then add something like this to fstab: /dev/VolGroup00 swap swap defaults 0 0 nate
Nate Thanks very much for the reply.> If that volume is not in use by anything else you should > be perfectly able to do: > > mkswap /dev/VolGroup00/swap > swapon /dev/VolGroup00/swap > > then add something like this to fstab: > /dev/VolGroup00 swap swap defaults 0 0Well it doesn't show up when I do 'df': [root at mail ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 4.8G 446M 4.1G 10% / /dev/mapper/VolGroup00-LogVol02 1.9G 316M 1.5G 18% /var /dev/mapper/VolGroup00-LogVol03 9.5G 2.3G 6.7G 26% /usr /dev/sda1 99M 32M 63M 34% /boot tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/mapper/VolGroup00-LogVol04 9.9G 172M 9.2G 2% /home /dev/mapper/VolGroup00-LogVol05 1.9G 35M 1.8G 2% /tmp Also, as I said /dev/VolGroup00/swap is not listed in /etc/fstab, but it is listed in /dev/mapper/. Is that good enough confirmation that it is not in use? I'm very curious how I managed to get into this situation, using the GUI install method. Any ideas on that? I'd prefer not to be in this situation again. Thanks Ian Masters
Date: Tue, 28 Oct 2008 08:29:43 -0700 From: Scott Silva <ssilva at sgvwater.com> Wrote:> Even though the recommended swap is 2 times system memory, I have > never made a swap partition over 2 GB. Maybe I am also flirting > with disaster, but haven't been bit yet in years.I believe that the current recommendation is 2 x physical memory up to 2 GB and then 1 x physical memory thereafter. See: http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Deployment_Guide/s1-swap-what-is.html " Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB. So, if: M = Amount of RAM in GB, and S = Amount of swap in GB, then If M < 2 S = M *2 Else S = M + 2 Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time. For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM). " Regards, -- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB at Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3