Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
The first part of my HD is occupied by XP, the rest I plan to fill with Linux. I was wondering what is performance wise the best physical location of swap, if it matters all that much in the first place.
My Linux partitions will be something like:
/root
/tmp
/var
/swap
/home
/usr/local/games
/boot (primary partition, all the rest logical)
where root and home being the largest. I thought between the two largest partitions would be the best choice, or otherwise at the beginning.
I have 1G of RAM and twice this amount of swap seems a bit waste of space, I thought around 500MB.
What can you suggest?
The physical of swap isn't very important, as long as you set the right config options for your HDD (like DMA etc - If your distro doesn't do so out of the box, use hdparm). Is is true that the nearer to the beginning of the HDD the faster the access times, but the differences are very small, and then there's the matter of the distribution of the cylinders... don't worry. Just keep in mind that it's easier to change the size of a partition at the end of it than at the beginning, and that if you want to tweak the other partition sizes (change them in any way after your initial install or add new partitions later) it's probably a good idea to have swap before anything else so you won't have to remember its location and modify fstab accordingly.
As for swap=2xRAM, that's true for older machines with little RAM. In your case it will depend on what you are going to use your box for. A server may need more RAM/SWAP, a typical desktop will be fine with 500MB RAM
If you are creating a system for desktop use, there is little advantage in making so many partitions. Most people just need / and a seperate /home. As for swap, try to avoid making it the first partition on any hard drive. I've seen a few people who had problems booting their systems due to having swap on the first primary partition.
The first part of my hd consists of XP, of which the first partition is primary and the other partitions are logical. As you can have one extended partition, this means that my other (linux) partitions are logical, except for the last /boot partition.
The partitions /tmp and /var (trash directories) are subject to frequent change and in order to avoid defragmentation it is not unwise to have separate partitions of them. To have a separate partition of /usr (or better /opt) as well, is perhaps for a desktop pc not necessary, but programs that are regularly updated or modified I prefer to have on a separate partition as well, perhaps a little overly diligent. It may waste some harddisk space in exchange for less fragmentation. However fragmentation seems to be hardly an issue on Unixes. No one bothers, does one?
I set up my systems with three partitions: /boot, swap space, and everything else. For ordinary purposes this gives the most flexibility. (I set up big servers differently.)
I allocate swap-space that's 2.5 times the size of physical RAM.
If there is more than one fast disk-volume available, and the I/O infrastructure is such that multiple disk I/Os can be performed simultaneously (usually not the case on a garden-variety PC), then I'll divide the swap space across all of the spindles that are available.
But RAM is king. The best swap is the one you never have to do. "Chips are cheap."
Linux filesystems don't fragment very much. Search for "linux+disk+defragmentation" and "linux+fragmentation" on google and you will find lots of articles that explain the issue in detail.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.