I am using Linux Mandriva OS. During installation my friend suggested 2GB for the swap partition and the remainder as the root partition. What is the use of providing a separate space for root? Instead of providing 2GB should I go with 4GB, or more?
Like it has already been said, swap is just like a spare-wheel RAM, to which the system resorts in case of shortage of physical memory. Like an insurance, in that sense. The common advice is to make the swap partition as big as two times your RAM, but actually that is the "old way". With RAMs the size we have today, having a x2 swap would waste too much space on your hard disk with a useless partition, as you would much unlikely need that much extra memory (again, given RAMs the size we have nowadays). But the advice remains this way there's no fixed advisable size for swap, it depends on your RAM. If you want to hibernate, you surely want to make your swap size as big as your memory, allowing your system to save the whole RAM to your hard drive. That could happen also in a dedicated file in a normal partition, avoiding making a separate one just for this, the way Windows does, but is better not, like the fact it's Windows' way suggests. By separating hard drive sectors according to this much different usage you contribute to your system stability, and you have a double insurance you'll always get some RAM backup space, and not (even for how much unlikely it is) steal its space for regular usage and find yourself without it when you need it.
As for the root (/) partition, it's the one that contains everything, so of course you wanna make it a separate one (also if I don't get what you mean, separate from what? From swap?). It's like basic Windows C: partition, it's gonna contain your operative system as well as every indispensable library and default programs, and every software and game you install not specifying a different path. Also every device and partition you get running in your system refers to root, as your system is based on it. Of course, that does not mean that they get physically copied into it and you must have enough free space for them, just that directory shortcuts are created in that, like pointers, so absolute path for them start with a / too.
What many people create a separate partition for is home (/home/username) folder, in which the big part of your personal data is stored. You wanna do that also if you are gonna boot multiple systems into your computer and have files like documents, music, pictures, videos and movies, downloads and so on in common between those, in an impartial partition that does not belong to any system, but it's accessible by every one of them the same way. But again, there's another better way of doing it which I recommend, as having shared home folder between more systems can create conflict with personal settings (due to user and group ids), which are stored in hidden folders in your home for Linux systems. You can just have a separate data partition (if you have a Windows system already installed with a D: storage partition, that is) and just create symbolic links in your home with simple terminal commands, so that you have the heaviest files into a dedicated big partition shared among your systems, and you get access to them directly from your home without having them actually stored there. This way there's no conflict as you have a separated home for each system (with your user settings safe there), which contains link to all your personal files.
Making a short summary, this is the way I recommend a Linux partitioning:
Root partition: your system main one, ext4 filesystem, around 20 Gb size; Swap partition: your RAM extension, linux-swap filesystem, as big as your RAM; Data partition: if you don't already have it, a big partition containing all your documents, images, music and so on, shared among all operative systems, filesystem FAT32, as big as you can.
Hope everything is clear, ask for any doubt!
During hibernation the system saves an image of the current state to swap. This image is loaded on awakening. Swap space also acts to supplement and optimize the systems physical memory. Inactive items are moved to the swap to make space for active items.
It is commonly recommended that the swap space be about the same size as physical memory on the system. Swap space can be either a file or separate partition. Designating a partition as swap space serves to prevent fragmentation of a swap file.
A swap partition is used for the case when the system runs out of RAM, it starts moving unneeded information in RAM into this SWAP area.
If you don't have a swap area, the system will report that it ran out of memory and new processes won't be able to start.
You can use as much swap as you want, but generally, 2 GB are enough (on my 2G RAM system i never used more than few hundred MBs of swap, and most of the time less than 100 MB).
Yes, you can provide more than 2 GB space to swap.
To read more about swap space, follow: All about Linux swap space