This is the old SliTaz forum - Please use the main

Swap partition. (again)
  • johnrockingjohnrocking October 2010
    I am running on a system with only 196mb ram. It runs okay but I would like to see if it would benefit from having a swap partition of say 400mb. I will pinch some of the home partition and format it as a swap. Will Slitaz just know its there or do I have to tell it somehow. I don't mind doing a clean install if necessary with the swap partition in place. Will it just know its there and use it or again does it need some prompting. Does it matter where on the disc the swap is located. (between 1st and home ?) I am sure you have realised but I am very new to Linux so please keep any answers really simple.
  • seawolfseawolf October 2010
    Hi --

    I'm pretty sure when you use GParted or suchlike to create a partition, you can specify it's type. GParted provides an interface where you can click-and-drag partitions around, it's intuative but can obviously be dangerous. You'll need to use it when the partitions are not mounted, so a Live CD is best.

    With Swap, you can just add it in to /etc/fstab (as root, natch) and it'll know about it when you boot up next time. You can also use it immediately with 'swapon -a'. The line you should add into fstab should be like:
    /dev/hda4	swap	swap	defaults	0 0

    This file details all the partitions you have available, so you can specify which bits are where. For example, mine is:
    proc            /proc		proc    defaults          0       0
    sysfs /sys sysfs defaults 0 0
    devpts /dev/pts devpts defaults 0 0
    tmpfs /dev/shm tmpfs defaults 0 0

    /dev/sda7 /home ext3 defaults 0 2
    /dev/sda6 /mnt/fedora ext3 user,defaults,users,noauto 0 2

  • johnrockingjohnrocking October 2010
    I am afraid you have lost me with these instructions. I am fairly confident I can create a swap the partition but the 'adding it to the etc/fstab' means nothing to me. I am really new to linux, reading and experimenting. Can you be more specific as to what I need to do please. Imagine I am really dumb and I may just understand. Thanks
  • erniaernia October 2010
    you have a file in /etc folder which is named fstab, so /etc/fstab
    directory structure id different than in windows:
  • seawolfseawolf October 2010
    Yes, as ernia said, fstab is a file located in the etc directory. If you run a live CD session to modify your partition layout, be sure to pick the one on the hard disk and not the live CD session! To add the line into fstab, the easiest will be:

    0: mount the installed partition; usually this can be done just by clicking it in the left pane of the file manager.

    1a: Choose the Run command from the SliTaz menu and use the command:
    subox leafpad /media/disk/etc/fstab
    replacing disk with the correct path as shown in the file manager.

    1b: If you are using your locally-installed SliTaz, use:
    subox leafpad /etc/fstab

    2: Enter root's password - the SliTaz default is root - if there isn't anything in the box shown.

    3: Add that line shown above.

    4: Save and exit.
  • GokhlayehGokhlayeh October 2010
    Doesn't SliTaz mount swap partition automatically?
  • mojomojo October 2010
    I use
    to indicate if swap is activated.
    Look at /etc/init.d/ for swap detection/activation.
    I have found that automatic detection/activation of swap works when booting an untouched slitaz iso. A frugal or full install detects swap according to boot log but does not write fstab entry and activate on my computers.
  • seawolfseawolf October 2010
    The start-up scripts to contain 'swapon -a' which mounts all swap partitions, but I'm unsrue whether they have to be in /etc/fstab like with 'mount -a'.
  • ChristopheChristophe October 2010
    you can create a swap space as an ordinary file within your / partition, if it is large enough as explained here

    I did not read the article in detail but you certainly need to have root privileges to issue the commands, I did not test these but believe they should work for creating (and activating) a 400 MB swap file.

    dd if=/dev/zero of=/extra-swap bs=1024k count=400
    mkswap /extra-swap
    swapon /extra-swap

    I believe it is a fair statement to say that your system is likely to benefit from having a swapspace if you have only 196 MB of ram.
    These being said, a system should not swap if you can avoid it ;), since the performance hit is big -- but you are likely to notice that the swap hit is not as bad under linux as under windows....

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

SliTaz Social