SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Before installing Slackware 12.1 I've created three different partitions as follows:
Swap: Logical -> 6Gb (I have 4Gb RAM installed).
/: Primary -> 20Gb
/home:Primary -> 40Gb
There are also two win partitions (primary NTFS and logical FAT32)
If I run cfdisk, I can see what follows:
Name Flags Part Type FS Type [Label] Size (MB)
------------------------------------------------------------------------------
sda1 Boot Primary NTFS [^G] 64428.62
sda5 Logical W95 FAT32 21476.21
sda6 Logical Linux swap 5996.23
sda3 Primary Linux ext3 20003.89
sda4 Primary Linux ext3 48134.34
Everything works fine. Dual boot (win/slackware). Slackware works OK. But if I type free -m at command prompt I get:
And where it says Swap, it also says: total 0 (zero) used (0) and free (0). That makes me think that swaps doesn't exist for my Slackware system. Is this true?
Maybe I forgot to mount it while installing or I don't know.
If this were the case, can I tell Slacware now to use that "unused" 6Gb Swap partition?
It looks like your swap is not being used. Since /dev/sda6 is your swap partition, to activate the swap partition, run as root:
Code:
mkswap /dev/sda6
swapon /dev/sda6
Make sure the swap partition is listed in your /etc/fstab also. 6GB is way too much for a swap partition. With 4GB RAM you will probably never use the swap anyway.
Are you planning on using hibernation? If not then you really probably won't need hardly any (if any) swap ever. 500MB swap is more than enough swap for my computer with about 1.3GB RAM. I hardly ever use swap at all (pretty much only when using virtual machines), and when I have it has never exceeded 16MB.
If you have plenty of hdd space I wouldn't sweat the large swap size. You might need it if you decide to use hibernation anyways.
You should have this line in your /etc/fstab file:
Code:
/dev/sda6 swap swap defaults 0 0
Add that line if it doesn't already exist and reboot. If it still doesn't work, try the `mkswap /dev/sda6` line and then reboot again. If that still doesn't work, you can add it manually without rebooting (`swapon /dev/sda6`), but it won't survive a reboot.
The amount of swap you should use depends on who you talk to. A general consensus seems to be double your physical RAM, but never more than 2 GB. If you have less than 1 GB of physical RAM, your swap should be double your RAM. Otherwise, no more than 2 GB. This is a fairly good rule -- if you use hibernate, your system may use a fair amount of RAM, and therefore a large amount of data will have to be written to the swap. However, this will almost never be more than 2 GB (probably not more than 1 GB) unless you're trying to hibernate while running supercomputer tasks (). Reinstalling from scratch is a lot of work, so unless you think you'll be tight on space it's not necessary -- but you can if you want. You could also try shrinking the swap and subsequently enlarging another partition (using gParted, for example), but this is mildly risky, and I'm not entirely sure if you can resize swap (you probably can, but I'm definitely not positive).
I'm not entirely sure if you can resize swap (you probably can, but I'm definitely not positive).
Resizing swap is easy. Delete the partition and make a new swap of the size you want. It's not like you have to save anything in it (unless you are in a hibernated state).
gparted live cd does work well for resizing partitions should it ever be necessary. I generally prefer to keep my swap on a primary partition.
With swapon you can activate swap partition without rebooting.
Are 6Gb too much? Well, I read a lot of opinions about this and there are as many postures as people are. I think you are right. Well, as an example, I was using Slackware until today without a swap partition and nothing happened.
How did I determined 6Gb as my swap partition? I took it from somewhere that said: Up to 2Gb, double the size for your swap. More than 2Gb RAM, same amount for swap + 2. So, since I have 4Gb RAM, 4 + 2 = 6Gb. I wanted to make sure I wouldn't need a larger swap in the future.
Maybe, resizing the partition now is a little bit risky. If I delete swap partition and create a smaller one (1Gb) as Shadowsnipes suggested How can I add the 5Gb left to -for instance- Slackware / partition? Is that possible without losing data?
Talking about Hibernate. How do I activate that option in Slackware?
Maybe, resizing the partition now is a little bit risky. If I delete swap partition and create a smaller one (1Gb) as Shadowsnipes suggested How can I add the 5Gb left to -for instance- Slackware / partition? Is that possible without losing data?
Yes, it's possible. Of course, I would never suggest doing this without a backup (things CAN go wrong -- however, they never have for me). You should download the GParted LiveCD and burn it to a CD (or DVD). Go search for a guide on using GParted if it isn't intuitive to to. You can resize your swap partition (and since it doesn't hold any data you don't need to worry about it corrupting anything) and subsequently grow another partition (and since you're increasing, rather than decreasing the size of the partition, it shouldn't damage anything). It would be best to increase the size of the partition immediately neighbouring the swap partition -- I'm not even sure if it's possible to do otherwise, but even if it is, it is probably a bad thing to have one partition on non-consecutive blocks (in the absence of LVM, which you don't need to know anything about). If GParted doesn't let you resize the swap partition, you can just delete it and recreate a smaller one, and then grow the other partition (it accomplishes the same thing).
Quote:
Originally Posted by glore2002
Talking about Hibernate. How do I activate that option in Slackware?
The default 12.1 kernels already have the required options built in to the kernel (and so should your compiled one), so adding hibernation is as easy as adding
Code:
append="resume=/dev/sda6"
where /dev/sda6 is your swap partition to /etc/lilo.conf in your kernel stanza. My kernel stanza looks like this, for your reference:
Code:
image = /boot/vmlinuz-generic-smp-2.6.24.5-smp
initrd = /boot/initrd.gz
root = /dev/sda1
label = Generic
append="resume=/dev/sda6"
read-only # Partitions should be mounted read-only for checking
Of course, then you must run `/sbin/lilo` as root to write the changes to the MBR. To actually hibernate, you use the following command (as root):
Code:
# echo disk > /sys/power/state
That will suspend your system to disk (hibernate), assuming it can find your swap partition (it should be able to find it without trouble if it's activated). To power the system back on, turn on your PC and MAKE SURE that the proper kernel is booted at the LILO boot prompt. You may wish to add the append="resume=/dev/sda6" line as a global configuration, or into each kernel stanza, to ensure that this happens if you frequently switch kernels (I don't know why you would do that, but you never know). It should boot your system into the same state it was in previously.
If done incorrectly, and your system is started up without resuming from swap, you will likely get hard drive errors because the drives are being mounted when they weren't properly unmounted. That's a bad thing. You can usually fix it with an fsck (it's usually done automatically if errors are detected), but it's never a definite thing, so you must be careful.
If you wish to suspend to RAM or standby, you can use the following commands:
It would be best to increase the size of the partition immediately neighbouring the swap partition -- I'm not even sure if it's possible to do otherwise, but even if it is, it is probably a bad thing to have one partition on non-consecutive blocks (in the absence of LVM, which you don't need to know anything about).
You can grow any supported file system type regardless of the position. It just might take a while, however, as the data has to be physically moved. For instance, if your swap partition is your first partition, you shrink it, and then choose to grow your last partition, you will have to wait for all of the other partitions to move first. For large partitions chock full of data this can take hours.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.