Laptops Under 200

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 1 May 2011

How To Create a Virtual Swap Partition in Ubuntu (or GNU/Linux in General)

Posted on 22:49 by Unknown
Swap partition in GNU/Linux serves the same purpose as the "page file" (that's what Microsoft call it) in Microsoft Windows, and unless you have 2.5-3GB or more RAM, you should have a Swap partition in GNU/Linux.

If you already have created a separate swap partition then you don't need to read this. But remember by having a virtual partition that can be used as a swap file do have its advantageous.

For instance, let's say that you upgraded from 512MB to 1GB of your RAM recently. If you have a swap partition (real one) then you have to delete it or "resize" it which is not that easy sometimes (especially if you have a less user-freindly GNU/Linux distro).

But when you have a "virtual" partition or a swap file, then all you gotta do is open your Terminal and resize it which can be done in seconds!. Although some say by having a separate real partition for your Swap space enhances the security (I really don't know if it's true or not) + speed up the PC in general which in my experience is simply not true. Maybe it does but I certainly didn't "detect" it, anyway.

So if you're like me, still want a virtual swap partition in Ubuntu 11.04 or in any other Linux distribution, then let's do it!. I assume that you don't have a swap partition already (which should be true if you received a warning while installing Ubuntu saying that you "couldn't detect a swap partition" but you ignore creating one and headed for installation).

If you already have a real swap partition then make sure to properly unmount it before proceeding.

How much Swap space do I need?

If you have "B" amount of RAM then you need at least 2B of swap space. So that's two times the amount of your RAM (if you have 512MB of RAM then you need  1GB of swap space).

But....

If you have a mammoth of 3GB or more of RAM in your PC, then most probably you don't need a swap. But if it's a server or any other heavy duty PC... then having a swap wouldn't hurt (not sure if I'm totally correct about that one).

You need swap if you do a lot of video editing, use Firefox or other major web browsers, LibreOffice, etc... because these apps are known for their RAM "eating" features.


Enough talking... let's do it!

1. Open your Terminal and enter the below command to create you Swap file which is about 512MB (megabytes) in this example.
sudo dd if=/dev/zero of=/mnt/512Mb.swap bs=1M count=512

Now depending on your RAM size, calculate the swap file size you need according to the above paragraph (2times the RAM size) and replace the value in: "count=512". Do not change anything other than the value 512.

You can also change the "512Mb" (shown in Red above) part to your desired name... if you do so you'll have to change all the below commands to suit that name ... so it's better you don't change anything other than the actual size.

Since "512Mb" is just a name it has nothing to do with your real value that you replace the "512" as mentioned above. So just, please leave it alone.

2. Let's format the swap file using the below command.
sudo mkswap /mnt/512Mb.swap
3. Now we can add the swap to the operating system by using the below command. 
sudo swapon /mnt/512Mb.swap
4. But if we stop from here, the swap will be used by OS until we do a reboot. This is added temporarily, if we want to mount this every time the OS boots (which we should), then again use the below command in your Terminal.
sudo gedit /etc/fstab 
This should bring a graphical text editor as shown below (the codes in the opened text might be slightly different depending on your PC configuration). Just copy and paste the below code and add it inside of the text, find a blank space.

Update: If you had created a swap partition before, then make sure to remove its entry before pasting the below one.


/mnt/512Mb.swap  none  swap  sw  0 0
Now simply save the file and do a reboot. Now we've successfully created a virtual swap file in Ubuntu 11.04 (in this example) or these command should work in other GNU/Linux distributions as well.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in linux, tips, ubuntu | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • How to Install "The Board" in Ubuntu? (GTK+ written dedicated Digital Diary)
    If you frequently use your computer for hours and hours daily... then even after installing cool theme and other stuff to make the desktop l...
  • traGtor - ffmpeg Encoder GUI for GNU/Linux (one of the best!)
    I maybe wrong on this one but I think the origin of the Qt written KDE desktop actually comes from the German programmers. But the point is ...
  • Install GPRename in Ubuntu - Renaming Multiple Files/Folders Made Ease!
    If you have a large number of files or folders to be renamed, then doing them all by hand is a daunting task. That's where the batch/mas...
  • Install Gdiskdump in Ubuntu 11.04 - An Easy To Use Disk Cloning Tool for GNU/Linux!
    Although for Microsoft Windows there are several excellent commercial and free applications available yet with GNU/Linux when it comes to di...
  • Wipe - Secure File Delete Application for GNU/Linux
    Not just in GNU/Linux but in any operating system, just because you deleted the files from the hard disk drive doesn't mean that they...
  • How to Access Few "Advanced Preferences" Settings in Nautilus File Manager?
    Nautilus is the default file management utility in Gnome desktop environment (which is also shared by the Ubuntu Unity as well). Although ...
  • Install Agave in Ubuntu - Excellent Color Palettes Creator for GNU/Linux!
    I think anyone would agree on the fact that both colors and our emotions (buggers... control our lives one way or the other :P) are bound to...
  • MediaInfo - An Advanced Audio/Video Tag "Reader" for GNU/Linux and MS Windows
    If you have installed the proper codecs in MS Windows and GNU/Linux, the operating system can read Tag information which holds information s...
  • Have You Watched the "Free Software Song"?
    I saw this song (in video) for the first time few years ago while watching the Revolution OS, a movie which basically exposes the birth of G...
  • GDM Tweaker - A Tool For Changing GDM Background/Theme Easily
    Although Ubuntu decided to drop GDM from the future releases still with Ubuntu, setting up your GDM screen is almost impossible (you know c...

Categories

  • 11.04 natty narwhal
  • 11.10
  • 3d rendering
  • addons
  • address books
  • adobe
  • adobe flash
  • adobe flash player
  • amarok
  • amarok for windows
  • andorid
  • android
  • android applications
  • android apps
  • android phones
  • android tablets
  • app launchers
  • apple
  • applets
  • application indicator
  • applications
  • applications for windows
  • archive managers
  • arios
  • art
  • arts
  • asus
  • asus eee pc
  • ati
  • ati catalyst
  • audio
  • audio converts
  • audio editors
  • audio encoders
  • audio players
  • audio tag editing
  • audio utilities
  • ayatana scrollbars
  • backup
  • backup tools
  • banners
  • batter saver
  • battery calibration
  • benchmark testing
  • bittorrent
  • bittorrent clients
  • blogger
  • blogger news
  • blogger platform
  • blogging
  • blogging tips
  • blogging utilities
  • blu-ray
  • boot loaders
  • BSOD
  • business card creator
  • Canonical
  • cd/dvd burners
  • chat clients
  • checksum checker
  • chrome
  • chrome addons
  • chrome os
  • chromium
  • clamav
  • cloud computing
  • cloud comupting
  • cloud storage
  • clutter
  • collaborative editor
  • command line
  • commands
  • community
  • compiz
  • computer repair
  • computers
  • cross-platform
  • data backup
  • data encrption
  • desklets
  • desktop environments
  • digital audio workstation
  • disk cloning
  • disk drive erasers
  • disk image burning
  • disk images
  • disk partition editors
  • display managers
  • distributions
  • docks
  • download managers
  • drawing tools
  • drivers
  • driving lessons
  • dropbox
  • dvd authoring
  • dvd backup
  • dvd creator
  • e-book managers
  • e-mail
  • e-mail clients
  • e-mails
  • eee pc
  • elementary os
  • email clients
  • emails
  • encoding
  • encorders
  • experiences
  • facebook
  • fedora
  • fedora core
  • fedora core 15
  • fedora core learn
  • feed readers
  • file management tools
  • file managers
  • file manegers
  • file recovering
  • file splitters
  • file systems
  • filesystems
  • finance
  • firefox
  • firefox 5
  • firefox 6
  • firefox addons
  • firefox5
  • firmware utilities
  • flash videos
  • flickr
  • fonts
  • frustrations
  • fun
  • gadgets
  • GDM
  • gentoo
  • gimp
  • gmail
  • Gnome
  • gnome 3 shell theme
  • gnome 3.2
  • gnome applications
  • gnome desktop
  • gnome shell
  • gnome3
  • gnu
  • gnu emacs
  • gnu-linux
  • gnu-linux distributions
  • goober
  • google
  • google chrome
  • google chrome extensions
  • google maps
  • GPU
  • graphic design
  • graphic utilities
  • grey screen of death
  • grub editors
  • gtk
  • gtk applications
  • gtk themes
  • gtk3
  • gtk3 themes
  • hardware monitors
  • hdd clone tools
  • hdd tools
  • health
  • hobbies
  • html5
  • icons
  • ideas
  • im clients
  • iMac computer repair
  • iMac error
  • image editiors
  • image organizers
  • image resizers
  • image utilities
  • image viewers
  • iphone
  • itunes
  • java
  • journal applications
  • kde
  • kde 4.6
  • kde applications
  • kde-qt
  • kernel
  • kubuntu
  • kubuntu 11.04
  • laptops
  • learn
  • learn linux
  • legal
  • libre office
  • life
  • lightdm
  • linux
  • Linux distributions
  • linux keyboards
  • linux mint
  • linux multimedia players
  • linux music players
  • loco teams
  • logmein
  • lubuntu
  • lxde vs xfce
  • mac osx
  • mandriva
  • media players
  • metacity
  • microsoft windows
  • mounting
  • mplayer
  • ms windows
  • multi-touch gestures
  • multimedia
  • multimedia codecs
  • multimedia converters
  • multimedia players
  • multimedia utilities
  • music players
  • mypaint
  • natty narwhal
  • nautilus
  • nautilus scripts
  • nautilus tips
  • netbooks
  • netbooks under 200-250
  • network monitoring
  • networking
  • news
  • nokia phone suite
  • note taking
  • ntfs
  • nvidia
  • office productivity suits
  • office suits
  • oneiric ocelot 11.10
  • online radio
  • online storage
  • open source
  • open-source
  • opensource
  • opensuse
  • operating systems
  • optical disk burners
  • optical disks
  • optimizations
  • package managers
  • painting tools
  • parent control
  • password generators
  • password managers
  • pdf editors
  • pdf readers
  • pdf tools
  • pim software
  • pinguy os
  • plasma
  • plugins
  • portable
  • portable applications
  • portable laptops
  • privacy
  • professional video editors
  • programming tools
  • project management software
  • proprietary drivers
  • python applications
  • qt
  • qt applications
  • qt4
  • registry cleaner
  • remote access
  • remote desktop access
  • reviews
  • roboform
  • rom flashing
  • rss readers
  • satellite trackers
  • scanning tools
  • screen recorders
  • screenshot taker
  • scripts
  • search engines
  • security
  • shell extensions
  • shell themes
  • skype
  • smart phones
  • software
  • software emulators
  • sound servers
  • source code editor
  • stack exchange
  • startup managers
  • stock market
  • swimming
  • system cleaner
  • system information
  • system monitors
  • tablet pcs
  • tablets
  • task killers
  • tech help
  • tech news
  • tech tips
  • technology
  • terminal emulators
  • text editors
  • text translators
  • themes
  • thunar
  • thunderbir
  • thunderbird5
  • tips
  • transformation packs
  • tutorials
  • tweaks
  • twitter
  • ubunt
  • ubuntu
  • ubuntu 11.10
  • ubuntu 11.10 alpha 3
  • ubuntu derivatives
  • ubuntu derrivatives
  • ubuntu minimal install
  • ubuntu netbooks
  • ubuntu news
  • ubuntu one
  • ubuntu tablet
  • ultrabooks
  • unity 2d
  • unity desktop
  • unity desktop apps
  • usb
  • utilities
  • vector graphics
  • video editors
  • video utilities
  • videos
  • virtualbox
  • virtualization
  • virus scanners
  • vlc
  • voip
  • wallpaper contest
  • wallpapers
  • weather apps
  • web browser addons
  • web browsers
  • webcam
  • weight loss
  • weird
  • widgets
  • window managers
  • windows
  • wine
  • xml editors
  • xubuntu
  • youtube

Blog Archive

  • ►  2012 (7)
    • ►  August (2)
    • ►  June (1)
    • ►  May (3)
    • ►  January (1)
  • ▼  2011 (515)
    • ►  December (3)
    • ►  November (1)
    • ►  October (16)
    • ►  September (57)
    • ►  August (59)
    • ►  July (81)
    • ►  June (112)
    • ▼  May (149)
      • How To Install emesene 2.11.5 in Ubuntu 11.04 Natt...
      • Chinese Prisoners Who Make £470-570 A Day Online, ...
      • Install Mailnag in Fedora Core 15 - An Email Notif...
      • Asus EeePC X101 Netbook , Powered by the "MeeGo" L...
      • Ubuntu Tablet ,The TENQ P07
      • Transformer TF101 - Asus Eee Pad That Runs Android...
      • Linux Kernel 3.0 RC1 is Officially Released!
      • easyLife - Installing Proprietary Software in Fedo...
      • How To Install Gwibber in Ubuntu 11.04 Natty Narwhal?
      • How To Extract ".deb" Packages in Fedora Core?
      • Foxit Reader 5 Is Released - GNU/Linux is Now Offi...
      • How To Install Rhythmbox in Ubuntu 11.04 Natty Nar...
      • gekosMac (GTK Theme) - Make Ubuntu 11.04 Natty Nar...
      • MediaInfo - An Advanced Audio/Video Tag "Reader" f...
      • How To Install Thunar File Manager In Ubuntu?
      • Install gxmms2 in Ubuntu 11.04 Natty Narwhal - A G...
      • They Weren't Kidding... Gnome OS is Underway!
      • How to Install Decibel Audio Player in Ubuntu?
      • How To Setup K-Lite Media Player to Automatically ...
      • Wanna Know How To Create an Off-line Multimedia Co...
      • Install Sunflower in Ubuntu 11.04 Natty Narwhal (S...
      • Ambiance Evolution - Another "Customized" GTK2 The...
      • Miro 4 Is Released, How To Install it in Ubuntu 11...
      • Does Skype Keep Aborting After Logging in (Under G...
      • How To Install Music On Console (MOC) Player in Ub...
      • LCDs and DC Jacks, Two Lucrative Laptop Repairs
      • ScribeFire - A Blogging "Client" Addon for Your We...
      • Install Agave in Ubuntu - Excellent Color Palettes...
      • How to Install Gnome Music Player Client (GTK2+ wr...
      • How To add Minimize/Maximize/Restore Buttons in Gn...
      • Anti Mosquito - An App to Keep Mosquitoes Away fro...
      • How To Install Listen Music Player in Ubuntu (11.0...
      • Meet the Redesigned, Awesome Phonon (Multimedia Fr...
      • Key Status Monitor (Key-Mon) - On Screen Keyboard ...
      • UMPlayer 0.9.5 is Released (Qt written, Media Play...
      • Ubuntu Ambiance Gnome Shell (GTK3) theme
      • Install Super Boot Manager In Ubuntu (11.04/10.10)...
      • Fedora Core 15 Is Officially Released!
      • Format Factory - An Excellent Multimedia Converter...
      • Oxymentary - KDE Oxygen Icon Theme for Gnome (GTK+...
      • Install Turpial 1.5.0 in Ubuntu (Twitter Desktop "...
      • Install Touchpad Indicator in Ubuntu - More Contro...
      • How to Install Muon Package Manager 1.2 (Beta) in ...
      • Steadyflow 0.1.7 is Released - How To Install it i...
      • How To Install Firefox5 in Ubuntu 11.04 Natty Narw...
      • Evolution 3 Arrives for Gnome Shell Desktop Users!
      • Introducing Split-lossless Script (Nautilus) - "Ex...
      • How To Install Gnome Media Player in Ubuntu 11.04 ...
      • How To Install Transmission Bittorrent Client in U...
      • Meet BeatBox! - Another Cool Music Player from the...
      • Install GoldenDict in Ubuntu - An Excellent Offlin...
      • Install GPRename in Ubuntu - Renaming Multiple Fil...
      • Wanna Install the "Old" Netbook Launcher in Ubuntu...
      • Gmail Introduces AIM Chat, (No AOL Log-in Necessary!)
      • The Unarchiver for GNU/Linux - Finally, "Something...
      • Install The JStock, Stock Market "Tracker" in Ubun...
      • How To Install Qt Written Unity 2D Desktop in Ubun...
      • Confity - Another Simple Utility to Customize Few ...
      • Deviantart Stash Plugins 1.0 for Gimp and Inkscape...
      • GDM Tweaker - A Tool For Changing GDM Background/T...
      • How To Install Rosegarden in Ubuntu
      • EveInstaller - Installing Most Popular Application...
      • YeoWorks Ubuntu Solutions - A Cool Utility To Help...
      • Set the Throttle to Light Speed with a 1000 Core P...
      • Google Has Officially Released the Android 3.1!
      • Have You Tried The Rightmark CPU Clock Utility?
      • What Is the Lowest (best) Possible Bitrate for a S...
      • SRWare Iron - Chromium Based Web Browser Which "Re...
      • GUnity: An Interesting Power-tool to Customize Ubu...
      • Install the Excellent "Psensor" (Hardware Monitori...
      • Install pyBrowser in Ubuntu 11.04 Natty Narwhal
      • DeaDBeeF - A Simple Music Player for GNU/Linux (Es...
      • Virtualbox 4.0.8 is Released!, How To Install it i...
      • Ubuntu Developer Summit (UDS), Few Official Videos...
      • Gpick - An Easy to Use Color Picker for Gnome Desk...
      • Install the Evolution Indicator in Ubuntu 11.04 Na...
      • Wanna Add A Fedora Core 15 Countdown Banner to You...
      • GNU SIP Witch 1.0 Is Out!
      • Have You Watched the "Free Software Song"?
      • Translate-Me: A Simple Text Translator for Ubuntu ...
      • "A New Start", Another Awesome GTK+ Theme for Your...
      • Calibre For GNU/Linux, Managing E-Books Made Easy!
      • Install Uget Download Manager in Ubuntu 11.04 Natt...
      • No More GDM in Ubuntu, Meet the new Log-in Manager...
      • The Perfect "Con", That Which Really Drifts Me Tow...
      • What Happened To Blogger?
      • What Is Battery Calibration and When Should You Do...
      • Is this What Canonical/Mark Wants Us to "Choose"?
      • Videoporama - A Fully Featured Video/Image Slide S...
      • Banshee 2.0.1 is Released - How To Install it in U...
      • My Weather Indicator - Easily Access Live Weather ...
      • Plasma Active : The Emerging "Software Contender" ...
      • Introducing "Muon" - The All New Software Manager ...
      • cGmail - Another Gmail Checker Front-end for Your ...
      • Udev-notify: A UserFriendly USB Device Detect Noti...
      • Linux Mint 11 Release Candidate (RC version) is out!
      • Bangarang 2.0, Features Rich Excellent Multimedia ...
      • From Now on: lubuntu Linux is An Official Derivati...
      • Ktorrent 4.1.1 Is Released!, How To Install it on ...
      • "Duplicati": Excellent Backup Utility for GNU/Lin...
    • ►  April (33)
    • ►  March (4)
  • ►  2008 (2)
    • ►  March (1)
    • ►  January (1)
Powered by Blogger.

About Me

Unknown
View my complete profile