Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It depends on your size of the drive. If you have a big enough drive you could have different partitions /, /boot, /var, /usr and all. But it all depends on your use as well.
I have installed server without different partitions and everything on / and just boot and swap as different.
If you will be using LVM or RAID, you want to have a separate partition for /boot. If you will be installing more than one distro, you can use the same /boot partition and edit the grub.conf file to boot each distro. Being small it is easy to create a image backup copy of your boot partition.
Having the /home directory on it's own partition will make it easy to change distro's or add another distro and not have to reformat it. IMHO, for laptop installs, fewer partitions are more common than on a desktop. You are usually more limited in disk space, and having system directories on the same partition is more flexible. For example you don't have to worry as much that /usr will fill up when you install more software.
A server will be more likely to have separate partitions. Having /tmp on it's own partition allows mounting it with mount options such as noexec, nodev and nosuid. A separate /var/ partition will prevent a server from crashing because someone fills up free space with logs. An installation won't touch /usr/local. This is where programs you compile yourself are likely to go. Mounting /usr/local on it's own partition would allow you to reinstall and keep these programs, if you opt not to format the partition.
My question is, it is always better to have /boot as separate partition,
No, it is not *always* better to have /boot on a separate partition. For laptops with only a small mount of disk space I usually put everything in one partition (+ swap), it just makes things easier when you are running low on space. However, for desktops and servers (where it is easy to replace/add disks) I always break it down into separate /var, /tmp, /boot, /usr, /home.
Quote:
what are the other filesystems that need separate partition ?
None need it, except if you count virtual file systems like /dev, but the os looks after this for you: it does not use a physical partition.
There are lots of arguments for having more partitions, but I don't know if any of them apply to your situation. Do you have a specific problem you are trying to solve?
You don't even need swap, so the original question could have been answered with a single character
/
There you go. A complete answer to the question that you asked. However, the question 'what partitions is it desirable to have? is more complex and depends on the circumstances. How about telling us something about the circumstances, so we cabn have a go at answering that one too, without writing a 100 page manual.
If you want to hibernate your machine, then you need a swap partition at least the size of your RAM. So for hibernation, the recommendation I use is RAM size + 2GB.
I have 8GB of RAM, so I set up a swap partition with 10GB. I found that sometimes I'm using swap within an hour of starting up - but then, at othertimes, it might take several days.
If you are using RAID, then /boot should be on a separate partition outside of RAID. Have at least 2 RAID partitions, one of which should be swap.
Need one partition for / and different swap partition.
you don't need a swap partition, if
you have enough ram and you are not hibernating
if you use a swap file instead of a swap partition
and where do you think that embedded Linux devices put their swap partition? Deeply embedded devices don't have anywhere useful to put a swap partition, so, given that they can't have one, they don't need the swap partition.
I wouldn't recommend running without a swap partition(for any OS) some applications use swap to store memory pages (for various reasons) no matter how much RAM you have.
That's useful to know. I have some desktop systems that run without swap, apparently without problem, so (at risk of stating the obvious) it does depend on which apps are being run. Is there any pattern to the types of apps that use swap? Perhaps database systems use swap as "scratch space" ... ? All the same, it would be quicker to use memory ... ? Now I'm intrigued -- what sort of reasons might an app use swap for?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.