on how to create a swap file in ubuntu

Swap file? What is that? Saying it with my own words, a swap space is an extension of the RAM. When the RAM’s filling up the swap space helps the system to run smoother. Windows users: ever wondered why sometimes your disk looked like going mental while nothing really was going on on your PC? Yeah? Well that was Windows swapping and of course because the swap space is on the hard disk it is not as fast as the main memory.

Anyway, there’s always been lots of talking about where the swap space performs better. As a file of fixed dimension on the same partition of the hard disk, as a separate partition dedicated to it on the same disk. Or even in a dedicated partition on a second hard disk.

As for many other problems in IT the solution is not straightforward or unique. We all use different settings in our computer and we all run different software with different hardware.

I could just copy what someone else wrote already but it would take much longer than just copy the links:

swap file FAQ from the original ubuntu documentation and how to create a file or partition  → here

what is better a swap file or a swap partition  → here

again on the fight beetwen file and partition  → here

on how to set up a wireless connection in Ubuntu Hardy

Now it’s time to get the penguin connected to Internet. Before we start I think would be useful for you to know what kind of user you are.

User A: you connect to the web with a cable, and in this case you don’t need to read this post

User B: without knowing it you are lucky enough to see your driver automatically recognized by Ubuntu. This is usually the case with Realtek and Ralink chipsets.

User C: you own a wireless adapter with a Broadcom chipset or even worst a b43xx series; that is unfortunate as this post will work for most of the wireless adapter but certainly not for the ones equipped with a Broadcom chipset. Now this is not for being mean, but when you have a Broadcom chipset you need to follow another way to make your card working. This way involve to use additional software such as b43-fwcutter, you need to spend sometime on Internet finding the solution of any other problem, and quite possibly you have to write few lines of command in your terminal windows. I had a Belkin adapter with a b43xx chipset, and after long researches, close encounters of the third kind with the command line, and perhaps for the fear of being too stupid I decided to buy another adapter all together.

User D; I like you. I do so because you are the one who’s going to keep reading this post.

So first thing to do is to find out what kind of user you are. I have never had the pleasure to be an User B, but I know that in this case the wireless utility automatically starts; all you have to do is choose your network and enter your WPA key (as you do in Windows). You should see something going on on the top right corner of your screen next to the speakers.

We then need to find out if you are a soon happy User D or a for quite a while miserable User C (look User C perhaps you won’t have any problems at all, I’m just warning you). To do this we have to run a command from the terminal window. I won’t talk at all about commands and terminal at this stage so just believe me.

Top left corner of the screen an click on

Applications – Accessories – Terminal

or alternately press

Alt+F2 and write gnome-terminal

I actually prefer the latter as it is much faster. Alt+F2 is like the Run command in Windows under the Start menu. The command will be there next time waiting just to be scrolled from the drop down menu. Just as Windows.

Now you must see a white windows with at top something like:

username@desktopname:-$

As I said this is not the time to explain the terminal window and the command, and as I said just trust me and write

lspci and then hit Enter

lspci command

lspci command

You can see in the picture a yellow box meant to highlight the part we are interested in;reading that I acknowledge the fact that my adapter is equipped with a Marvell chipset. So I am a User D, if so are you keep reading.

If you red the previous post you have downloaded already the Ndiswrapper packages. Ndiswrapper will allow you to use Windows Wireless Drivers under Linux. If you haven’t you may want to do it now:

NOTE: I ASSUME YOU USE UBUNTU HARDY WITH i386 ARCHITECTURE (32 bit processors), IF NOT CHOOSE YOUR OWN VERSION BEFORE TO DOWNLOAD THE PACKAGES link

ndiswrapper commonndiswrapper utils - ndisgtk

Install them in the same order that I listed above. To do that simply double click on the file, whatever folder you downloaded it into Ubuntu. For all them you will probably see the following message

Message

Message

Ignore it clicking close. You can update the package if needed once you established the connection. If the case Ubuntu will look after all the procedure.

Once installed all the packages, go to

System – Administrator – Windows Wireless Drivers (this voice has been added by Ndiswrapper)

Windows Wireless Drivers

Windows Wireless Drivers

Click and you’ll be asked to type the password which the same you input during the installation. Do that and this what you should see

Click Install New Driver. At this point the system is asking you to pick the file with extension .inf which held the information about your driver. This file is located in the partition where Windows in installed; this will be either in the folder

Program Files-name of the adapter folder – driver – something.inf

in my case it was in

Windows-Inf-name of the adapter folder-driver-something.inf

It depends of course on the hardware instalation. Select the file click Open and then Install in the follow screen

Install new Windows driver

Install new Windows driver

If the file is correct that is waht you should see

Correct file

Correct file

If not the screen will tell you you picked the wrong file. Click Close. At this point the little screens next to the speakers in the top right corner od the screen become two little point with something like a small comet spinning arround the points. That means Ubuntu is looking for all the networks available. In my case it found only my own network. And then the following scrren appeared immediately. In the case more than one network are found, you may need to click on the comet and choose your. In both cases the screen when you enter your WPA key appears

WEP key

WPA key

Keep the wireless security on Personal and type on Automatic. Enter the key and click Connect. Now at this point if everything is working, you should see the two points next to the speakers changing their colour from blue to green; when both are green you are connected and the points leave the space for the graph indicating the strenght of the signal

Connected

Connected

let’s do something

All right people it is time to do something. The subject of this post is probably the reason for which most people give up trying Linux even before installing it. I guess it is also the reason because most of the distro developer create Live version of them. I am talking about perhaps the deadliest operation you can perform on your PC.

The operation by the way involves changing your disk partition. Change the partition of your hard disk is not something that you do everyday. In fact it is something that you probably won’t do it at all in your life.

A partition is a space on your hard disk where you can store your data. When we buy a new PC it has only the partition C. If the hard disk is of very large size, it is common than the user create a supplementary partition normally named D. So we may store Windows and our programs in the partition C and our data only in the partition D. In this very case we want to create a new partition in order to install our Linux distro.

As I previously said installing Linux doesn’t involve getting rid of Windows. Even though it is necessary to install the Operative System (OS) in two different partition, leaving Windows on C otherwise it won’t start. After the installation any Linux distro will take care of the dual system installing a boot loader; this will allow you to decide what OS have to start.

We can’t talk about partition without involving file systems. When you format a partition whatever is the software you are using, you can choose among different type of file system. The most popular perhaps are Windows partition such as FAT, FAT32 and NTFS; For Linux we have to use the EXT2.

What you need before you start:

  • A copy of Ubuntu Linux. You can download the ISO image following this link. Once downloaded you can use any software you like to burn the image (I used CDBurnerXP, which has a straightforward option to burn ISO images)
  • If you are connected to Internet with a wireless device it is better if you download in advance the following packages as they’re not included in the distro ndiswrapper common (libraries common for all the platforms), ndiswrapper utils (package that allow you to use Windows wireless devices, make sure you choose the right platform), ndisgtk (Graphic interface option for ndiswrapper package). Note that you will need the ndiswrapper only if your card doesn’t have a native Linux driver. If your wireless card is equipped with a Broadcom chipset the procedure to get the connection working is bit more painful than other chipset. In particular you want to check this page from the ubuntu forum. (Before start the migration to Linux i used a Belkin card with Broadcom chipset but I struggle to get it up and running with Ubuntu. Eventually I opted to buy a new card, Netgear WG311 with Marvell chipset and had no moreproblems)
  • BACKUP BACKUP BACKUP BACKUP BACKUP BACKUP BACKUP BACKUP
  • If you didn’t do it yet BACKUP all your data.

First thing to do is to decide how much space you want to reserve to Linux. If you have only one hard disk and you need to run Windows too you must leave the latter in the partition C. If you have two hard disk, as I do, you can allocate one disk for each OS.

This is the screenshot of my hard drives situation before installing Linux.

My partitions before to install Linux

My partitions before to install Linux

The second hard disk has the space already formatted as NFTS, because Windows use to be allocated here. To manage your partition you can use the software EASEUS, a free partition manager. Once you created the space for Linux you don’t need to format it, everything will be done during the installation.

So you burn your image of Ubuntu, you downloaded all the ndiswrapper packages (if you wish to have a wireless connection and your device doesn’t have a native Linux driver), now you are ready.

Insert the disc with the image on your drive

  • Restart your PC and make sure that your boot sequence start from the right drive. To do so when you restart the PC you need to access to your BIOS (usually is the button F1). Depending on the version of yor BIOS you have to go to the menu Boot or Boot Option or something like this and choose the right sequence (CD/DVD drives are normally on the secondary master channel so you should read something like SMD follows by the model)
  • Save your the changes and reboot
  • The CD starts and the first thing to choose is the language. It will be English for me
  • A installation menu appears. We want to select Install Ubuntu. The kernel starts loading
  • Complete all the steps, such as geographic zone and keyboard
  • The partition (Starting up Partitioner) screnn appear. You see different option such as Guided resize (if you use one disk for Linux and Windows; if you follow this tutorial you did this already in Windows and you don’t want this). Another option is Guided for entire disk (you may use this option if you have two different drives, and you want to dedicate an entire disk to Linux. Again if you want to keep using Windows leave it in the primary master channel in the C partition). The last option, which is the one I used is Manual Configuration. Go for it.
  • It will open a windows where you can see all the drives and partition present on your PC. If you have only one disk you should see only /dev/sda followed by as many numbers as the partitions in that disk. To clarify this I’ll explain my configuration: I have the first hard disk, where Windows is installed, with one partition; then I have a second hard disk with three partitions and a third external disk again with only one partition. My screen then was one item under /dev/sda/(first disk), three items under /dev/sdb/(second disk) and one item under /dev/sdc/(external disk)
  • Check the box correspondent to the partition you want to use to install Linux and then click the button Edit Partition at the bottom of the windows.
  • Another windows will open where are listed the properties of the chosen partition or drive. You can see the size, the file system and the mount point. Select Ext2 as file system and the character / as mount point (the character / it means mount point root)
  • That’s it. The installer will notify you a message where it advices to set up a swap space. You can ignore it for the moment we will set up a swap space once the installation is completed
  • Other information will be asked such as log in name and password. Those can be whatever you like just remember that the name and password you input at this stage are automatically considered the one of the administrator user. Although you will log in using this settings, you still need to enter your password for same action where administrator privilege are needed. (Installing new software and change system settings)
  • Before the installation ends you have the option to import other OS accounts. It is up to you to include this option in the installation.
  • You are ready now. Once the installation is terminated you will be asked to remove the CD and press Enter in order to restart the system
  • The system restart and you find a windows generated by the boot loader. This windows contains all the OS and their options present in the disks. So you can see an Ubuntu Generic option (generally the first in the list) shich aloow you to start Ubuntu; other Ubuntu option that we don’t care for the mometn and also the Windows option. Remember that if your PC has a recovry routine this will be stored in a dedicated partition, usually at the very begin of the drive. This partition will also be visible in the boot loader, so check which is the right one for Windows

And this is it. If you happily installed Ubuntu you already achieve something that most people didn’t or tried and gave up. If you messed up, don’t worry I did that few times and I survived; try again you’ll be luckier. If you messed up and contemporary lost all your data…what can I say life is unfair but human beings are stupid, and you are definitely one them because you did’tn do any backup

NOTE: in this blog we will refer to the Ubuntu distro. Most of the thing we will say are applicable to all the other Debian based distro. Software (Gimp, Blender, QCAD, OpenOffice) and command line tuttorials can be followed on any machine where the softwares are installed.

before we start

Before we start with the funny bits lets cover some of the issues that most of the people face when they have to do the switch. I dealt with this issues myself before deciding to change operative system. We are going to talk about the whys, whats and hows about Linux.

Questions like Why should I use Linux or What benefits am I going to get, naturally flag up in everybody’s mind approaching the switching.

Imagine a conversation between two people, one of which is trying to convince the other to switch to Linux.

Why should I use Linux?

Consider for a moment the fact that we are not all lovers of illegal downloads, and that torrents are just small rivers. Immagine that anytime we need a software we all go to our favorite store and buy it. With Linux you won’t have this problem. Most of the softwares, also called packages, are for free. Also the most popular programs are included in the distro you install, without wasting time chasing every single application. Yes you’re not drunk or stoned, you red right I wrote free. My grandad always told me that free is dead during the war; well he is probably back and hopefully he will stay.

If you read the previous post, you will find a video about a certain Blue Screen Of Death. Linux doesn’t have such a thing.

These are only two of the main reason to start using Linux.

I actually enjoy illegal downloading. Am I going to find the same software available in Windows also in Linux?

As illegal downloader I’m sure you downloaded plenty of amazing programs. So you have Photoshop, for your image editing, Premiere if you enjoy video editing, Dreamweaver if you are planning to publish your personal website, 3D Studio for any 3D issues and Microsoft Office for letters, and other everyday tasks. The truth is if you are not a professional editor or web designer you won’t need this amazing programs. Downloading Photoshop only for regulate hue and brightness of your pictures is silly; even if you use layers and blending options you still don’t exploit the software capability. Same for all the other programs. Just to answer straight to the question I would say no, but you’ll hardly be disappointed by what you’ll find.

And?

Easy tiger, if you’d let me finish…..Every distro has installed by default a great image editor which is The Gimp. The Gimp is really powerfull infact most of the tutorials you find on Internet for Photoshop they’ll work for The Gimp too. Unfortunately The GimpIt doesn’t support CMYK but the majority of us doesn’t work in a commercial press. 3D graphic is what you are after? Check Blender and you’ll remember me. StarOffice or OpenOffice are great suite and works great for most of your office needs. On top of that they are 100% Microsoft Office compatible and the size of the files they generate is much smaller. Try to convert a word file in odt format and see. If you are an professional Microsoft Access users you might be a bit disappointed with OpenOfficeBase but come on, as we say in Italy you can’t have a the barrell full of wine and your wife drunk (whatever that’s supposed to mean).

The Gimp and OpenOffice come with the distro. Blender and other software have to be installed, but Ubuntu has the Synaptic Package Manager. This very smart piece of software allow to install, not just the software contained into the repository, but also other software from Internet. You search, select and Synaptic will download for you all the packages and it will install them for you. (In case the command line scare the hell out of you).

What about CAD?

CAD is one of the reason because I can’t get rid of Windows totally. Being myself an heavy user of AutoCAD I found few options available. Interesting is Qcad, but is only 2D. Anyway if you work professionally with CAD systems you may take into account the fact to open you wallet and pay. So you have VariCAD and in some forums I red that Bentley, the developer od Microstation, is working on a Linux version of the latter. With parametric CAD is even better; the market leader ProEngineering is already release the Linux version.

You talked about distro, what is it exactly?

I’m touched by your interest. I mentioned the free thing before. Linux’s core (also know as kernel) is freely available to anyone. This means that there are company and person that create their own version of Linux. That’s what a distro is. It is a customize version of Linux. Purposely customize whtther you are a developer of embedded systems, a network administrator or home user. Every distro has included by default all the packages upon which the distro has been developed.

But if I decided to use Linux what will be of Windows and all my files in the Windows partition?

Because Linux developer are smart and not selfish you don’t have to get rid of Windows if you decide to install Linux on your system. In order to be used Windows has to be installed on your hard drive in the C partition. Linux is not that picky. It can be run from any partition. C D E F primary, master, slave, some distro are even developed to be run from an USB pen. And if this is not enough, while Windows won’t allow you to access any other partition but FAT or NFTS, Linux is so cool that let you get in any partition. No discrimination whatsoever is in place. So if you can run Linux and open all the file recorded on the Windows partition. How cool is that?

Believe it or not the magnanimity of Linux is not finished. With an estremely clever package called winehq you can even run Windows application on your Linux distro. Just unfuc***gbelievable.

Once you install Linux if another Operative System will be found, the penguin (Linux nickname) helps you again installing a boot loader, that allow you to choose the OS that you want to launch.

A boot what?

A boot loader, but this is probably too much for you.

What a orrible end for this post. The truth is that while I was writing it I Stumble Upon a website that explain everything I said and more even better. Because I refuse to copy and paste I decided to just copy and paste the link.

I STRONGLY ADVISE YOU TO GIVE A FULL READ TO THIS PAGE. IT IS EXTREMLY INFORMATIVE AND IT WILL CLEAR ALL YOUR DOUBTS

ready to switch

I am ready. I am ready to switch to Linux.
I have been a Windows user since the release 3.1. I have to say it was cool. Windows operated on my new PC. The PC was equipped with a supersonic Intel 486 50 MHz with co-processor, 14″ monitor, 5.2 and 3.5 floppy drives, a gigantic 540 MB hard drive. I included as an expensive optional a CD drive 2X speed. All this wonderful system for a price that today would be enough to buy a flat in Blackheat.

But it was amazing. First of all graphical interface. My previous `computer` was a Commodore 64 with tapes. I received as present the game Back to the future 2 and it took almost an hour to load the game from the tape. Almost an hour and then it didn’t work: that day I started to hate video games with passion.

Anyway, the step from Commodre 64 to PC was shocking not just for the already mentioned graphical interface but also for the multitasking properties. All the rest it did not matter at the begin.

In fact it wasn’t all good, actually…. After a happy first period of usage, Windows began to get stuck an unfairly number of times and always in the most inconvenient moment, leading the user to scream, swear heavily, smash keyboards on the wall and beating up pets and/or partners.
I think we could formulate Murphy’s Law for Windows, it would be something like: «Windows will always get irreversibly stuck just few seconds before your brain could send the nervous impulse to your forefinger in order to save your 6 hours project, and that of course you are a perfect idiot and never saved».

So we had fatal errors, still screen shots, fatal errors again, memory not enough, command not found, diarrhoea, shivers and temperature. We were all affected until probably Windows Xp, which I regarded as the most stable of all the Windows.

Any alternative? Absolutely. What about a Mac. Mac sounded great back then as well. The only problem it was a bit pricey. Apple’s retailers doesn’t accept cash as form of payment but only human organs. So for the entry level system you just needed to give away one kidney and one cornea. If you did fancy the top system things started to get nasty; so on top of kidney and cornea you had to had your left hand and the promise to give away your body to science once you passed away.
Another options was a system with Unix, but besides hardly having any interesting software for the home user, the minimum requirement to do something with it was a PhD in quantum physics.

Little by little another system was making is appearance. Its name was and still is Linux. Named after its Finnish developer, is a Unix derived system and released with its source available for everyone. This soon attracted a huge community of people who knew a thing or two about coding.
Free source basically means that the source code is available for everyone to be consulted and if able to modify and mostly improve. I would dedicate a big thanks to those people.

I was a bit curious about this new system and I gave it a try. I tried few of the main “distros”, Red Hat, Suse, Knoppix, Connectiva and Mandrake (Mandrake eventually acquire Conectiva in 2005 and the distro became Mandriva). Always had lots of trouble. Not all the hardware was supported, complicated internet settings, laziness to learn, partition almost irremediably messed up, and again swearing and smashing.

But now things are changed. Most all the hardware work, internet is as easy to set as in Windows. Lots of software freely available, avoiding the waste of time in downloading cracking version of major software for Windows. Linux will be in the future.

These diaries are named after the distro that I choose which is not Diaries but Ubuntu. The contents are about what I do with it everyday, so nothing specific is covered. I’ll start from the very begin of the installation of the system to go to everyday tasks and little tutorials.

DISCLAIMER just to sound a bit more serious. If you mess up don’t blame me. If you’re not sure what you are doing: do not do it. If you smash your keyboard I won’t pay for it. If you haven’t planned the possibility of a good Backup you are strongly advised to change your mind. Spliffs are recommended to ease the initials anger and frustration.

Follow

Get every new post delivered to your Inbox.