Partition table suggested for installing three GNU/Linux systems

18 respostas [Última entrada]
alejandro_blue
Desconectado
Joined: 11/07/2013

Greetings to all fo you, I hope you are very well.

A week ago I got my new used laptop (!) and I am enjoying it to the fullest. Already tried it with Trisquel 7 and it works very well.

Now I'm thinking of installing on it the three operating systems, all of them GNU/Linux, but should I come to you because what I have read about partitioning has left me a little confused.

About five years ago I read some documents about the right way to make a partition table. If I recall well, some of those documents said that the most left is a partition in the GParted, the closer it is to the center of the hard disk, and therefore the fastest revolve.

According to this, it said that the ideal thing was to leave the partition for the root of the installed system in the left, then the home partition, and finally at the rigth, the swap. And I did so for a long time. When installing more than one GNU/Linux system, I left the most used more to the left.

But today I found several pages where it says exactly the opposite, as these two:

http://www.ubuntufacil.com/2014/05/ubuntu-particionamiento-recomendado/

http://www.control-escape.com/linux/lx-partition.html

I was wrong all these years? Does anyone among you might suggest a partitioning scheme for the installation of three GNU/Linux systems together?

Many thanks in advance... and sorry for the language mistakes.

Free hugs

lembas
Desconectado
Joined: 05/13/2010

All this is relevant for old fashioned spinning disks, modern solid state drives should have uniform performance.

This should prove useful http://gparted.org/why-partition.php#improve-performance

I.e. the speed is fastest at the edge.

illustration© Cdang, CC by-sa 3.0

You can test the performance of your disk withsudo hdparm -t /dev/sda(replace sda if needed) This is the peak performance. Then to find out the worst performance usesudo hdparm -t --offset 123 /dev/sdawhere 123 is almost the max capacity (in GB) of your device. As hdparm manual page says, the difference should be about 2x.

alejandro_blue
Desconectado
Joined: 11/07/2013

Thanks a lot Lembas, that explanation was very graphical... hahahaha.

Taking in account your experience, what partition table scheme would be better for install three GNU/Linux systems in a spinning disk? What for a solid sate?

Do you think it's necessary make a partition for the /boot?

See you then

lembas
Desconectado
Joined: 05/13/2010

:)

For solid state it should not matter. On the spinning disk I guess it depends on your usage pattern. Do you share partitions? Is the data of the most frequently used distro more important than the root of the least used distro? Do you hibernate?

/boot is kinda tricky, if you hibernate often, you might not need a separate /boot on the faster part of the disk. And then it might make sense to put swap before your data. On the other hand if you don't hibernate a separate /boot might be a good idea and the otherwise rarely used swap probably could be at the end.

Also if you wish to go partition crazy you could have a lot of partitions with different cluster size, file systems and file system mount options. And then it needs to be taken to account that many read/write operations are not sequential but random. (And beyond partitioning, there is RAID... )

Basically what you've been doing sounds good, root before data. If you really care, then you need to start measuring performance. It's an interesting subject and I'll be glad to learn more about it.

alejandro_blue
Desconectado
Joined: 11/07/2013

Thanks again. I did the tests you suggested me on your first post. Mine is spinning disc.

>> It's an interesting subject and I'll be glad to learn more about it.

Yes, it is.

>>Do you share partitions? Yes

>>Is the data of the most frequently used distro more important than the root of the least used distro? No

>> Do you hibernate? No

I'm only a normal user who want do the things in a reasonably way, following some basic technical criteria :D

a_slacker_here
Desconectado
Joined: 06/30/2013

I suggest you use gpt partition table instead of MBR or msdos. Lembas shared with you useful information.

Geshmy
Desconectado
Joined: 04/23/2015

I've been thinking about this too. I had Centos and Fedora installed and had given them the lion share of a 1 TB hd. Then I found Trisquel and gave it the rest (about 130 GB). Now I'm thinking to start over.
I like Trisquel 7 very much and would use it by default most of the time. I might do Fedora 22 and get the latest kernel. I was thinking about preparing/reserving a portion of the hd to build a kernel on my own and see how far I can get building everything from source. I could leave a portion for a fourth option (maybe freebsd or openbsd).

I was thinking I would have a large /home partition and back it up on to an external hd. I've never used back up software but I would like to create something more permanent and secure than I usually do and locate all the data that I want to keep from all the computers I have scattered around the house and have it in one place backed up to the ext hd.

Question 1
Is this still relevant:
https://www.debian.org/doc/manuals/securing-debian-howto/ch3.en.html#s3.2

Since I installed trisquel I have mostly installed the major apps that I wanted and been tweaking so by now it appears that I have used up a quarter of my 20 GB / directory and maybe less than 1 GB of my 108 GB /home partition. I have 4 GB swap for 8 GB Ram and I have yet to see a swap file be used (I think ever on any machine.) The stuff I do is not that intensive but I would like to start gaming a little,

So if I reformat and reinstall maybe
Trisquel

10 GB / ........LVM
10 GB /usr .....xfs, ext3, ext4?
10 GB /var .....................""
2 GB /tmp ......................""
5 GB /opt ......................""
8 GB swap ...........swap
----------
45 GB total

OS 2 (same pattern)

10 GB /
10 GB /usr
10 GB /var
2 GB /tmp
5 GB /opt
8 GB swap (if it will let me, Grub in Centos or Fedora found the swap from the other an insisted on using that on the second install)
-----------
45 GB total

500 GB /home mounted in both OSes - to be backed up to the external hd

This way I am using less that 50 GB for each OS and can play with around 400 GB left over.

If the debian doc isn't relevant then KISS maybe rules and just go 35 GB / and 8 GB swap.

Other Questions:
Does gaming create need for a bigger swap?
Anything else I should know or consider?

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

Does gaming create need for a bigger swap?

The swap is an extension of the RAM onto the disk, whose throughput is something like 100 times smaller. When the RAM is full and the system swaps, it is unbearably slow. As a consequence, the size of the swap for gaming is irrelevant because you will not play on a system that swaps. You need enough RAM for the game.

Since you are talking about desktop usages and since you never hibernate, the swap needs not be large (1 or 2 GB maybe) because a desktop system that is swapping is a pain to use.

You had better have a swap though. In this way, once the main memory is full, the system swaps, you feel it, and you can close some applications/tabs. Without a swap, the kernel would kill some process to free some space. That is why the swap is essential on servers.

Anything else I should know or consider?

Having many partitions has a significant drawback: any of those partitions can be full if it turns out to be under-dimensioned. For instance 2 GB for /tmp would prevent you from using Popcorn Time. On the contrary, over-dimensioned partitions are a waste of space. For instance 10 GB for /var looks huge (I currently have 1.1 GB of files in /var).

If you use LVM, you can quite easily (after learning how to use LVM...) resize your partitions. Without LVM, it is a pain to resize the partitions without losing their files. Notice that some filesystems (I am looking at you XFS) cannot be shrunk.

SuperTramp83

I am a translator!

Desconectado
Joined: 10/31/2014

It wouldn't **prevent** you from using popcorntime. Unless maybe you stream a 1080p movie that is 4 hours long..

But yeah - better make it 3 gb or 4 gb. That way you can stream 2 fullhd movies without having to close and reopen popcorntime in between

Geshmy
Desconectado
Joined: 04/23/2015

Thanks M B and ST83 for lending your experience!

Thanks to alejandro_blue for opening the post. I read it posted in usarios 'tambien' where the KISS advice suggested in your second link was also given.

Based on multiple councils, I think I will go with something like this (with what I have now, I do not notice much of a performance hit depending on where on the drive an OS is)

8 GB / ........LVM
5 GB /usr .....LVM
5 GB /var .....LVM
5 GB /tmp .....Ext2
5 GB /opt .....Ext3
4 GB swap .....swap

re /tmp and Ext2 - From the Debian Manual
"Notice, however, that there are some partitions that might not benefit from using a journaling file system. For example, if you are using a separate partition for /tmp/ you might be better off using a standard ext2 file system as it will be cleaned up when the system boots." That sounds like good advice.

/opt and ext3
I have nothing in /opt now but I from the manual that that's a good place for user compiled programs. I wouldn't expect to outgrow 5 GB and it will be journaled.

Over all, I have 20 GB / LVM partition (currently 25% full after 2 weeks of use) + 4 GB swap now with only a separate /home directory so this scheme would be the equivalent to a generous 28 GB / + 4 GB swap with capacity to grow if ever needed and a large /home directory to be used by more than 1 system and hopefully for many years.

Yeah, think I'm gonna do it, rip what I have apart and start all over again. (although no rush, must plan other aspects still) My joke with my son about 6 weeks ago before I found Trisquel was 'I'm going to do the install to end all installs.' So now I'm going to do the mother of all installs to end all installs! ...v.1

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

8 GB / ........LVM
5 GB /usr .....LVM
5 GB /var .....LVM
5 GB /tmp .....Ext2
5 GB /opt .....Ext3
4 GB swap .....swap

You know that LVM is not a type of filesystem, right?

If you actually plan to use the same type of filesystem for /, /usr and /var, then why putting /usr and /var on separate partitions? I can only see drawbacks. Those I mentioned earlier.

And, currently the partition for / is huge (given that its largest subdirectories are in separate partitions), the one for /usr is tiny (most of the application files are in /usr) and /opt probably is too large (in Trisquel, /opt is used to put application you install by hand; otherwise it remains empty).

Is there any advantage in using ext3 instead of ext4? If you cannot answer this question, you should choose ext4.

Geshmy
Desconectado
Joined: 04/23/2015

Thanks for the input Magic Banana, hope I do not exasperate!
My Trisquel Desktop seems to be pretty close to hosed right now so I'm back in Centos7. Looks like I'll be reinstalling sooner than I wanted.

> You know that LVM is not a type of filesystem, right?
Well, uh no. Sorry to be a dunce. Looking in disks right now I see partitions 'x#GB ext4' or 'x#GB LVM2 PV,' they are on the same level. I believe a logical volume manager can grab non contiguous space on the hard drive and maintain indexing in such a way as to create virtual contiguity.

> Is there any advantage in using ext3 instead of ext4? If you cannot answer this question, you should choose ext4
I was looking for answers elsewhere and I mentioned this earlier:
"Is this still relevant:
https://www.debian.org/doc/manuals/securing-debian-howto/ch3.en.html#s3.2"
'Starts with "Choose an intelligent partition scheme" ... maybe easier said than done, or maybe that doc is older than the hills in computer years and no one has gotten around to updating it in which case I'll probably withdraw the question.

There it says
"it is usually better to use the ext3 file system. The reason for this is that it is backwards compatible with ext2."
I gather backwards compatibility with ext 2 no longer important so I'll go with ext4.

The whole idea of having separate partitions was based on reading that document. "Any directory tree which a user has write permissions to, such as e.g. /home, /tmp and /var/tmp/, should be on a separate partition. This reduces the risk of a user DoS by filling up your "/" mount point and rendering the system unusable (Note: this is not strictly true, since there is always some space reserved for root which a normal user cannot fill), and it also prevents hardlink attacks." That's what I have been basing my thinking on.

So you say / is huge and /usr tiny so I will adjust.

So, hopefully narrowing down to something 'intelligent' like this:
3 GB / ........LVM...........LVM in case I run out of room and need to expand.
8 GB /usr .....ext4..........Probably pretty generous
4 GB /var .....ext4..........Probably pretty generous
3 GB /tmp .....Ext2..........it will be cleaned up when the system boots.
3 GB /opt .....Ext4..........Probably pretty generous
2 GB swap....................25% of RAM
500 GB /home...ext4 or LVM

Well, think I'm going to try it, since my desktop is hosed anyway. Let you know how I end up.

lembas
Desconectado
Joined: 05/13/2010

I think the /usr could be still a bit larger. I take it you don't plan to hibernate? Will this be a single user desktop or something else?

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

Indeed: 8 GB is rather small. Although it would still be OK for my main (desktop) system:
$ du -hs /usr/
7,0G /usr/

@Geshmy: read again the end of https://trisquel.info/forum/partition-table-suggested-installing-three-gnulinux-systems#comment-69650 and understand that you would probably end up in such problems because you do not seem to have have much of an idea of how much space you need for /opt, /usr, /var, etc. And I still do not understand the point of having /opt, /usr and /var in ext4 filesystems mounted on top of another ext4 filesystem (/). The argument you read about /home, /tmp and /var/tmp makes sense (I never had such a problem though). In the end, you could choose a simpler partitioning schema such as this one:

  • 18 GB ext4 filesystem for / (I summed the sizes you provided for /, /opt, /usr and /var);
  • 6 GB ext2 filesystem for /tmp (I am here considering uses such as mine: ViewTube to watch online videos, Popocorn Time for 1080p movies, etc.);
  • 1 GB ext2 filesystem for /var/tmp (my system actually does seem to ever use /var/tmp);
  • The rest of the disk in an ext4 filesystem for /home.

The order of the partitions matters in case you want to resize them. For instance, with the above partitioning schema, I would choose /tmp, /var/tmp, / and /home or the reverse order (see earlier discussions on performances) because:

  • if /var/tmp really happen to be never used, you could just shrink/remove it and extend either /tmp or / (according to your needs);
  • if /home is full, / probably is where to find the most free space;

You could use an XFS filesystem for /home. It is said to be be faster for large files such as user files. However it cannot be shrunk. With the partitioning schema I proposed, that means a full / partition will have to gain space on /var/tmp (first) and /tmp (if the space gained on /var/tmp is not enough). However 18 GB for / is quite a lot and you would probably not end up filling it all.

Geshmy
Desconectado
Joined: 04/23/2015

I didn't see your input MB and Lembas
My Trisquel was dieing. First time it hung instead of shutting down, then would only boot 3.13 kernel which messes with my resolution. Then wouldn't boot at all at least in part because certain file systems (/tmp and /var/log) were mounting read only. Probably something I did, really don't know. So, to make a long story short, I used a live slax distro and fdisked it all away, Centos, Fedora and Trisquel.

>If you use LVM, you can quite easily (after learning how to use LVM...) resize your partitions. Without LVM, it is a pain to resize the partitions without losing their files. Notice that some filesystems (I am looking at you XFS) cannot be shrunk.

Is that the part? I have either just let the install handle whatever it wants to do with LVM or I have done what was more familiar for me so I haven't learned how to make LVM work for me. I will make it a project to do so.

I did this:

Partition 1 - 23 Gb Extended
-sda9 / - 3.2 Gb ext4
-sda6 /user - 8.6 Gb ext4
-sda7 /var - 4.3 Gb ext4
-sda5 /tmp - 3.2 Gb ext2

Partition 2
-sda2 swap 2.2 Gb

Partition 3
-sda 3 /home 537 Gb Ext4

Partition 4 439 Gb unused

Lembas said > I think the /usr could be still a bit larger. (yes, just a single user Desktop, with a web server and possibly other services accessible on tiny LAN - I don't try to hibernate - does it affect /usr or /tmp?)

Your concerns over size of /usr certainly seem valid, after a fresh install Disks tells me it's already 37.6 % full. /var is at 23 % and / is at 13 %.

Also, MB's 6+ GB /tmp surprised me. I was thinking 3 was stretching it. I might want to watch movies too.

My original install everything was just in a 20 Gb /. I tried to see how much was in /usr /var etc but this way it is real easy to see just how each directory is getting used. I see

$ du -hs /usr/
7,0G /usr/
would have worked then.

> 1 GB ext2 filesystem for /var/tmp

That's one thing I didn't get,
You have 18 GB ext4 for / (including I gather /var) and a separate 1 GB for /var/tmp.
The Debian doc hinted at that kind of thing too but I've never seen how that works so I stayed away from it. Is /var/tmp in /var replaced by a symlink or something?

While I was reading helpful resources I saw a guy's post re installing 100 plus OSes on two hard drives in one computer. I won't need that but it would be good to have that kind of flexibilty.

Thanks for your knowledgeable help and support, this community is one of the strongest aspects of Trisquel. It's great.

lembas
Desconectado
Joined: 05/13/2010

> I don't try to hibernate - does it affect /usr or /tmp?

I don't think it affects /usr but I guess /tmp might come to play. Swap is required for hibernation, you need as much as you have ram. (In practice somewhat less, maybe 80%, because of compression.)

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

Then wouldn't boot at all at least in part because certain file systems (/tmp and /var/log) were mounting read only.

The mount options (such as "ro") are in the fourth column of /etc/fstab (documentation about them in 'man mount').

Notice that having a separate /usr (I still do not get your need for that though) that is not pre-mounted in the initramfs (Trisquel must default to pre-mounting it though) raises unsolvable problems: https://wiki.freedesktop.org/www/Software/systemd/separate-usr-is-broken/

I haven't learned how to make LVM work for me.

Me neither. I would start do it to not add more complexity to your install.

-sda9 / - 3.2 Gb ext4
-sda6 /user - 8.6 Gb ext4
-sda7 /var - 4.3 Gb ext4

Again: why do you separate /usr and /var from / if they all have the same type of filesystem. I only see the obvious drawback of under/over-dimensioning.

just a single user Desktop, with a web server and possibly other services accessible on tiny LAN

The number of users does not directly affect the dimensioning of the system partitions. The number of applications does and these applications mainly have files in /usr. That includes the graphics/sounds for video games and these data are heavy.

I guess (I have no experience with servers) that "a web server and possibly other services" write logs to /var/log, what must make /var contains more data than on a real desktop system.

Your concerns over size of /usr certainly seem valid, after a fresh install Disks tells me it's already 37.6 % full. /var is at 23 % and / is at 13 %.

Once all applications were installed, /usr does not grow. /var grows but can be emptied because it contains caches (such as APT's), logs (such as that of your Web server I guess), etc.

MB's 6+ GB /tmp surprised me. I was thinking 3 was stretching it. I might want to watch movies too.

When you get a movie with ViewTube, it is downloaded to /tmp (and only is removed when you reboot). Same thing for the movies you play with Popcorn Time (but closing Popcorn Time erases those files). And movies are heavy...

You see: the more you partition your disk the more you need to know your needs. Otherwise you end up with full partitions and/or a waste of space.

You have 18 GB ext4 for / (including I gather /var) and a separate 1 GB for /var/tmp.
The Debian doc hinted at that kind of thing too but I've never seen how that works so I stayed away from it. Is /var/tmp in /var replaced by a symlink or something?

It is exactly like your other partitions: the content of the separate filesystem would be mounted at init (a line in /etc/fstab) onto the root filesystem at /var/tmp (that is what would be written in the second column of /etc/fstab).

That said, I do not have a separate /var/tmp and, on my system, this directory only seems to be used when Audacity is running (and it actually fills quite some space if I am editing a large audio file). However, I understand the concern of a misbehaving application that would fill /var/tmp, i.e., / if /var/tmp is on the root partition. But, you see, that is one more partition whose use is to be estimated to avoid under/over-dimensioning (do you use Audacity?).

Geshmy
Desconectado
Joined: 04/23/2015

Thanks! Lembas and Magic Banana,

I was reviewing the Debian doc and saw a big error in my thinking, I thought it had suggested /usr be on a separate partition but it never does.

> ...one more partition whose use is to be estimated to avoid under/over-dimensioning
but
"Any directory tree which a user has write permissions to, such as e.g. /home, /tmp and /var/tmp/, should be on a separate partition. This reduces the risk of a user DoS..."

It seems from the Audicity information that a /var/tmp partition required to address the DOS and Symlink concerns would need to be generous. Yes, I might like to make music someday. I suppose a 3d modeling program like Povray might be similar. I imagine they have some information indicating how big a /var/tmp partition would have to be.

I think I am arriving at some clarity, here's the new scheme but wll add maybe a 3 GB /var/tmp (also ext2)

|.................*.***extended partition***.*......................|..swap partition.|../home partition..|

../@16 GB../tmp@6 GB../var/log@1 GB../opt@3.2 GB |..swap@8 GB.....|../home @532 GB....|

..*ext4*...../...*ext2*...../....*ext4*........../.....*ext4*......|........ swap .........|......ext4.........|

I can hibernate if I want too, cause I just might want to if I can and also won't have to worry if I have room for movies.

This scheme would satisfy this - "Any directory tree which a user has write permissions to, such as e.g. /home, /tmp and /var/tmp/, should be on a separate partition. This reduces the risk of a user DoS..."
and, if I understand, address Magic Banana's main point as well, if more room is needed in /usr, it's already there as long as / (/bin, /boot, /etc, /dev, /lib, lib64, /media, /mnt, /proc /run, sbin, /srv, /sys, /usr, /var - /var/log) doesn't exceed 16 GB there's room. And it seems like 16 GB should last quite a while. I only wonder if I were to install games in /opt if 3.2 GB would get strained.

There might be a performance hit if a partition is bigger than it needs to be but this scheme over all isn't very far over what I have now and I like it's performance fine. I think Centos and Fedora may have each had 40 GB / and they were fine also.

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

And it seems like 16 GB should last quite a while. I only wonder if I were to install games in /opt if 3.2 GB would get strained.

Just do not separate /opt from / (that you can enlarge if you wish) and you will get flexibility! You already plan to use the same type of filesystem.

There might be a performance hit if a partition is bigger than it needs

Not that I am aware of.