Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Advise me about partitions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Ignatius881
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2011
Posts: 96
Location: Oviedo

PostPosted: Wed Apr 24, 2013 9:34 pm    Post subject: Advise me about partitions Reply with quote

Hello people.

After some time far from Gentoo world, I want to come back. I can't remember how did I find information about partitioning a hard drive, but I read that it's sometimes better to have more than four partitions (/, /boot/ swap and /home), like this:

Code:
/
/boot
/home
/var
/tmp
/usr
swap


I'm pretty sure about their size, but I'm not sure about their number. Are they too many, or am I right about this scheme? My hard drive is 320 GB and my RAM is 2 GB.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54028
Location: 56N 3W

PostPosted: Wed Apr 24, 2013 9:59 pm    Post subject: Reply with quote

Ignatius881,

Unless you have a real reason to keep /usr and /var on their own partitions, you may want to put them both onto /.

/usr needs to be mounted before udev starts and that means using an initrd to mount /usr early or delaying udev starting.
If you will use an initrd anyway, its no hardship.

Provided you have the RAM, /tmp can go in RAM as -t tmpfs, it need not be on disk. /tmp is wiped on boot, so its not used for persistant storage today.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Wed Apr 24, 2013 10:19 pm    Post subject: Reply with quote

If it hasn't been changed since the last time I installed Gentoo a year ago, the Gentoo Linux x86 Quick Install Guide specifies just the three partitions /boot, / and swap, which is fine although I prefer to have the four partitions /boot, /, swap and /home so that I can re-install if necessary without overwriting all the stuff stored in my /home directory. I normally put the partition with /home last so that I can fill up the rest of the HDD, as I use /home to store a lot of photos, videos, music files and so on which take up a lot of space.
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
LoneFox
n00b
n00b


Joined: 10 Jan 2012
Posts: 8

PostPosted: Thu Apr 25, 2013 6:17 am    Post subject: Re: Advise me about partitions Reply with quote

Ignatius881 wrote:
Hello people.

After some time far from Gentoo world, I want to come back. I can't remember how did I find information about partitioning a hard drive, but I read that it's sometimes better to have more than four partitions (/, /boot/ swap and /home), like this:

Code:
/
/boot
/home
/var
/tmp
/usr
swap


I'm pretty sure about their size, but I'm not sure about their number. Are they too many, or am I right about this scheme? My hard drive is 320 GB and my RAM is 2 GB.

This scheme is a relic of old times and does not have much connection to current reality. For example, separate /boot was a hack for some computers, where BIOS could access only part of a large disk and the bootloader and the kernel needed to be on that part. Similarly, /usr used to be separate because it was often mounted from a network drive to save disk space. This was already obsolete back in 2001 when I was a newbie. And you definitely don't need swap when you have more than 1GB of memory.

So, what is a better scheme? For example, my own computer has:
Code:
~ (lonefox@valesia): df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5       4.8G  1.4G  3.4G  30% /
/dev/sda6       4.8G  749M  4.1G  16% /home
/dev/sda1       4.8G  1.5G  3.3G  32% /mnt/extra
/dev/sda8       428G  243G  186G  57% /mnt/big

On a normal (non-SSD, non-VM-image) disk, small partitions are faster than large ones, because of shorter seeking distances. But with too many small partitions, managing them becomes a problem, and you often end up moving big files between them, which wastes a lot of time. So I put the preformance-critical parts (/ and /home) on small partitions and rest of the disk is one large storage partition. The purpose of /mnt/extra is to make it possible to do a full rebuild without nuking the existing system. sda7 is an encrypted partition that is normally not mounted (and currently not really used at all). I've been using this scheme for more than a decade, so I know it works well. Of course, it is always good to look for improvement, for example recently I got this idea to move package compilation to a separate partition, because doing it on the storage partition seems to cause noticeable fragmentation there.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Thu Apr 25, 2013 9:04 am    Post subject: Reply with quote

A separate boot partition is still useful when dual-booting on eg: laptops, which often
complain if you mess directly with the MBR. It means that you set grub up once, and
then just edit grub.conf (for Grub 1.0) when kernels and partition layouts change.
And in a Gentoo installation, they do tend to change ...

I''d go with a separate /home, as well; makes upgrading a lot easier.

Will
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Thu Apr 25, 2013 5:07 pm    Post subject: Re: Advise me about partitions Reply with quote

LoneFox wrote:
This scheme is a relic of old times and does not have much connection to current reality. For example, separate /boot was a hack for some computers, where BIOS could access only part of a large disk and the bootloader and the kernel needed to be on that part.


Don't write off a separate /boot so quickly. You may not need it, but it can still be useful in several situations:


  • When BIOS-mode booting from a disk that's over 2TiB in size, the boot loader may require the kernel to be in the first 2TiB of the disk. This is similar to the very case that you dismiss as being obsolete.
  • The boot loader must be able to read the kernel. Depending on the boot loader in use, it may not be able to read an encrypted root (/) partition, a root filesystem in an LVM or RAID setup, or a particularly exotic filesystem. In these cases, putting /boot on a separate partition is imperative. Note that although GRUB 2 can handle most of these cases, it's not the only boot loader available, and many users prefer to use something else.
  • EFI-based booting imposes its own wrinkles. One is simply that you might want to use a non-GRUB boot loader that can't read the kernel from certain partitions or filesystems (similar to the last point). In some cases, EFI boot loaders require the kernel to be on the EFI System Partition (ESP), so you must either copy the kernel to the ESP (a non-standard location and/or a nuisance to do) or you must mount the ESP at /boot.


Of course, these cases are far from universal. Many people can get along fine without a separate /boot partition. Relegating such a partition to the dustbin of history is premature, though. The desirability of a separate /boot partition has increased and decreased several times in Linux's history. Currently, it's probably near a low point, but it's on the increase again.

Quote:
And you definitely don't need swap when you have more than 1GB of memory.


This depends very much on how the system is used. I routinely use more than 1GiB of RAM -- often much more. (The system on which I'm typing currently has 3.3GiB used, according to "free".) If I had 2GiB of RAM and used as much memory as I'm using now, I'd need at least 1.3GiB of swap space, directly contradicting your claim. Of course, in such a situation I'd either take steps to use less memory or I'd increase my computer's RAM, but the point is that a simple rule such as you've laid out is inadequate.

Furthermore, swap space is required to use suspend-to-disk (aka hibernate) features, which are particularly popular on laptops. For this feature, you need at least as much swap space as you've got RAM. Again, this shows that how the computer is used affects the determination of how much swap space is required.
Back to top
View user's profile Send private message
amospalla
n00b
n00b


Joined: 08 Mar 2013
Posts: 26

PostPosted: Thu Apr 25, 2013 5:17 pm    Post subject: Reply with quote

There are lots of recommendations and points of view, I'll comment some things that are a bit particular to gentoo

/usr/portage contains the portage tree, it consists right now of >165.000 inodes, and is constantly moving. A it may use from 1 to 4 GiB (more or less), depending on how much distfiles you store on it.
/usr/src contains kernel sources. My typical kernel compile tree takes less than 1,5GiB.

/var/tmp is used for compilations, and some packages may require up to 5-6 GiB of free space IIRC (altough those monster packages usually have the option to be installed directly from binary files, and so there is no compilation needed with this route).

I personally move /usr/src and /usr/portage to /var, and symlink or mount bind them.

About the swap partition, you really want a swap volume, and having 2GiB of memory, I recommend setting a swap volume not smaller than 2GiB.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54028
Location: 56N 3W

PostPosted: Thu Apr 25, 2013 5:55 pm    Post subject: Reply with quote

LoneFox,

The more paranoid users like to mount /usr read only, most of the time, so keeping it separate helps that.
A read only root is possible too but its more involved, since you can't write /etc/mtab then.

Everyone should have a small swap. Laptop users that want to hibernate should have something like swap=RAM.

There are several swapping mechanisims open to the kernel, one is to flush buffers waiting to be written to disk, another is to free RAM holding code and data than can be reread from disk.
Lastly, dynamically allocated RAM (that has no permanent home on disk) can be written to swap.
By not having swap, you force the kernel to use the other methods to free RAM for new RAM allocations.

The case for a separate /boot has already been discussed.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
LoneFox
n00b
n00b


Joined: 10 Jan 2012
Posts: 8

PostPosted: Fri Apr 26, 2013 4:23 am    Post subject: Re: Advise me about partitions Reply with quote

The OP asked for a normal setup, so I answered what I consider to be normal. Of course there are some cases where more complexity is needed, often because you need to work around stupidity of other people. For example, on work computers all sorts of silly scenarios can happen, depending on how incompetent the necktie clowns that make the rules are.

srs5694 wrote:
When BIOS-mode booting from a disk that's over 2TiB in size, the boot loader may require the kernel to be in the first 2TiB of the disk. This is similar to the very case that you dismiss as being obsolete.

"Those who cannot remember the past are condemned to repeat it."
If you have such system, just keep the whole root partition below the limit. In theory this applied to the old limits as well, but those computers typically also had some Microsoft product there taking up the space.

srs5694 wrote:

  • The boot loader must be able to read the kernel. Depending on the boot loader in use, it may not be able to read an encrypted root (/) partition, a root filesystem in an LVM or RAID setup, or a particularly exotic filesystem. In these cases, putting /boot on a separate partition is imperative. Note that although GRUB 2 can handle most of these cases, it's not the only boot loader available, and many users prefer to use something else.
  • EFI-based booting imposes its own wrinkles. One is simply that you might want to use a non-GRUB boot loader that can't read the kernel from certain partitions or filesystems (similar to the last point). In some cases, EFI boot loaders require the kernel to be on the EFI System Partition (ESP), so you must either copy the kernel to the ESP (a non-standard location and/or a nuisance to do) or you must mount the ESP at /boot.

RAID is a valid case, but uncommon on desktop systems. I don't have much experience with EFI, but I assume it can always be disabled. Rest of these are unnecessary (complicate things without adding any value) and should be avoided.

srs5694 wrote:
This depends very much on how the system is used. I routinely use more than 1GiB of RAM -- often much more. (The system on which I'm typing currently has 3.3GiB used, according to "free".) If I had 2GiB of RAM and used as much memory as I'm using now, I'd need at least 1.3GiB of swap space, directly contradicting your claim. Of course, in such a situation I'd either take steps to use less memory or I'd increase my computer's RAM, but the point is that a simple rule such as you've laid out is inadequate.


This means you are running either a lot of java programs or several virtual machines simultaneously. Or what else uses that much? I typically have have about that 3.3 GB (of 4 GB total) free, and that's what I consider to be the normal case.

For some users here, swap appears to be a Ritual Cat that just needs to be there. I have always seen it as a kludge and source of slowness.

srs5694 wrote:
Furthermore, swap space is required to use suspend-to-disk (aka hibernate) features, which are particularly popular on laptops. For this feature, you need at least as much swap space as you've got RAM. Again, this shows that how the computer is used affects the determination of how much swap space is required.

How useful is hibernation in practice? I mean, how much time it saves to wake up the system from hibernation compared to a normal boot? I don't believe it is much, but I haven't tested it myself, so I can be wrong here.
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Fri Apr 26, 2013 9:38 am    Post subject: Reply with quote

Hibernation is a _lot_ faster, certainly on my laptops. I tend not to use it because
getting all the drivers to play nicely together after being rudely woken is sometimes tricky,
and I'd really only trust my elderly laptop batteries to hold charge for short shutdowns.
Still, when I had it working, it was pretty convenient.

Will
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum