Find the answer to your Linux question:
Results 1 to 4 of 4
I have a ~800 MB partition formatted as ext3 that I'm currently not using. I was wondering if there's any way to make that into swap space now, after installation, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377

    Can swap space be created or destroyed after installation?


    I have a ~800 MB partition formatted as ext3 that I'm currently not using. I was wondering if there's any way to make that into swap space now, after installation, or if it's something that can only be done during the installation process. I didn't create any swap space when I first installed my machine because the space was initially unformatted but I'm thinking now that it might be useful, better than having that much space go to waste. I'd also like to be able to destroy that partition and merge it back into my /home directory if needed. Is this feasible?

  2. #2
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942
    Yeah, you can use mkswap, swapon, and /etc/fstab to incorporate the partition into swap.
    Flies of a particular kind, i.e. time-flies, are fond of an arrow.

    Registered Linux User #408794

  3. #3
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    OK, after reading some man pages I tried this:

    Code:
    su
    mkswap -c /dev/hda4
    Setting up swapspace version 1, size = 1044602 kB
    no label, UUID=19ac7ff8-9357-4be6-9b38-4c9abf229892
    swapon -s /dev/hda4
    But it hasn't been recognized yet:

    Code:
    free -m
                 total       used       free     shared    buffers     cached
    Mem:          1011        451        559          0          2        170
    -/+ buffers/cache:        279        732
    Swap:            0          0          0
    However, GParted identifies the partition as linux-swap so I know it's at least allocated correctly. Do I need to reboot or something for the changes to take affect? Thanks for your help.

  4. #4
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    OK, I got it to work. In case anyone's interested, I added this line to /etc/fstab:

    Code:
    /dev/hda4	swap		swap	pri=1		0	0
    Then saved and rebooted and now:

    Code:
    ~$ free -m
                 total       used       free     shared    buffers     cached
    Mem:          1011        967         44          0         61        384
    -/+ buffers/cache:        521        489
    Swap:          996         19        976
    Thanks Javasnob, you got me going in the right direction.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •