Remove swap partition from any Linux and regain space

Discussion in 'Linux' started by kgorilla, Dec 9, 2008.

  1. kgorilla

    kgorilla

    Joined:
    Dec 9, 2008
    Messages:
    8
    Likes Received:
    0
    Hello,
    I have only tested this using ext2, it should work on ext3 as well.

    I recently went to UNR 1.0.1 and doubt I'll ever go back to Linpus
    Mods: see my post at http://aspireoneuser.com/forum/viewtopi ... =28&t=7930 regarding converting UNR 1.0.1 to ext2, maybe should be moved to How-Tos?

    Anyway, I haven't extensively tested this with Linpus, but you should be able to after step 1.
    Step 1.
    Code:
     sudo swapoff -a 
    TEST your system by running apps, do whatever you're worried about breaking if you remove swap!

    Step 2.
    Code:
     comment out swap line in /etc/fstab for swap, place a '#' character at the beginning of the line 
    Step 3. Boot to a live distro CD-ROM/USB stick, I used Fedora 10.

    Step 4. Remove your swap partition
    Code:
     fdisk /dev/sda 
    use 'd' for delete, select partition 2
    use 'p' to verify you only have a single Linux partition
    use 'd' to delete your single existing partition
    use 'n' to create new partition using maximum space
    use 'b' to toggle the boot flag
    use 'w' to write changes to disk
    
    Step 5. Grow your ext2 filesystem
    Code:
     resize2fs /dev/sda1 
    Done! It worked for me with Linpus. Simply commenting it out of the fstab will achieve the same, but leave 1/8 of your SSD useless.
     
    kgorilla, Dec 9, 2008
    #1
    1. Advertisements

  2. kgorilla

    lxlMurdoclxl

    Joined:
    Dec 6, 2008
    Messages:
    10
    Likes Received:
    0
    Hey,

    I have been debating on whether or not to do this, what is the benefit from getting rid of the swap partition. I though the swap partition some how made the apps run a little faster. Does it turn it into virtual memory?
    :?: :?: :?:
    Or is this just go get more SDD space back?

    Thanks
     
    lxlMurdoclxl, Dec 9, 2008
    #2
    1. Advertisements

  3. kgorilla

    kgorilla

    Joined:
    Dec 9, 2008
    Messages:
    8
    Likes Received:
    0
    Yes, the swap space can be thought of as virtual memory, problem with it on the SSD is slow. If you only have the stock 512MB of RAM, you may want to leave it alone, or decrease instead of removing altogether.
     
    kgorilla, Dec 10, 2008
    #3
  4. kgorilla

    lxlMurdoclxl

    Joined:
    Dec 6, 2008
    Messages:
    10
    Likes Received:
    0
    Thanks gorilla, thats what i needed to hear. I have not had the bravery to upgrade my 512MB to 1GB yet. I have only opened up a hand full of laptops before and dont even know if the have the tools to open something this small.

    If you wouldnt mind, i am still curious how the SDD portion can be used as virtual memory. A detailed technical explanation is not necessary, just so much that i can i understand the concept.

    Thanks,
     
    lxlMurdoclxl, Dec 11, 2008
    #4
  5. kgorilla

    Andysan

    Joined:
    Jul 9, 2008
    Messages:
    272
    Likes Received:
    0
    This ought to explain it - basically, stuff is moved out of memory and onto the backing store (in our case either the SSD or the HDD) and swapped back into RAM where necessary. Without swap, you would run out of RAM and everything would conk out.

    http://en.wikipedia.org/wiki/Virtual_memory

    You may get away with running Linpus without swap - i found that Ubuntu 8.10 was too demanding and i had to create a swap file (really easy peasy). Generally you don't want to be swapping more than you can help because the SSD is slow and has limited write cycles.
     
    Andysan, Dec 11, 2008
    #5
  6. kgorilla

    jinx022

    Joined:
    Oct 2, 2008
    Messages:
    76
    Likes Received:
    0
    Most live distributions will have a graphical disk manager like gparted which can also delete the swap partition and grow the system partition. You may also install Gparted live .iso on a thumb drive with Unetbootin. You cannot, of course, modify the mounted drives from Linpus.
     
    jinx022, Dec 13, 2008
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.