Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unusual partitioning schema, comments sought
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
machine slave
n00b
n00b


Joined: 27 Jul 2011
Posts: 6

PostPosted: Thu Jul 28, 2011 10:46 am    Post subject: Unusual partitioning schema, comments sought Reply with quote

Hi all,

I'm going to install Gentoo for the first time (currently I'm on Ubuntu) and now thinking over which partitions to create.

I think the goal of separating partitions (except for /boot) is to separate less-important and often-changing files (i.e. temporal) from not-so-often-changing (important or not) to minimize risk of important information loss. If you have other opinions on that, please share.

Therefore I'm thinking to create two ext4 partitions exactly for that:
  • temporal partition (20 GB?) with several directories, symlinked in root partition at:
    • /tmp
    • /var
    • /usr/tmp if there's such
    • other temp directories if they exist (please comment if you know them)
    • completed mldonkey downloads
    • completed web browser downloads (yes, they are dumped to particular directory at first, most never leave it :D)

  • root partition (remaining GB) with all remaining filesystem and symlinks to temporal partition as written above
  • and swap, obviously


So now I'm asking for any opinions, namely on whether such scheme is reasonable, whether such requirement is reasonable, or maybe I got it all wrong. I didn't do anything yet.

Thanks
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6319
Location: /usr/lib64/lv2

PostPosted: Thu Jul 28, 2011 3:48 pm    Post subject: Re: Unusual partitioning schema, comments sought Reply with quote

machine slave wrote:


  • temporal partition (20 GB?) with several directories, symlinked in root partition at:
    • /var





8O

The rest might work, but I really would not do this. You might run into problems with programs not finding things even with a symlink. In other words, it's better not to mess with the basic file system setup.

Most people either follow the handbook partition scheme or use a two-partition scheme with /root and swap, placing /boot in /root. This works with ext4, so you shouldn't have any trouble with that.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
disi
Veteran
Veteran


Joined: 28 Nov 2003
Posts: 1354
Location: Out There ...

PostPosted: Thu Jul 28, 2011 3:52 pm    Post subject: Reply with quote

The main reason to do anything with /var is security, I think.

You can set stuff like noexec during mount, so nothing will be executed ever on those filesystems.
I have one machine with /var as a seperate partition and the rest of the system is on another.
/usr/tmp ? does that exist, need to check later
most stuff is done in /var/tmp (like compiling packages)

I have a sumlink for /tmp to /var/tmp so all tmp stuff is in the same folder and could be wiped easily.
_________________
Gentoo on Uptime Project - Larry is a cow
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Thu Jul 28, 2011 4:07 pm    Post subject: Re: Unusual partitioning schema, comments sought Reply with quote

audiodef wrote:
The rest might work, but I really would not do this.

I second audiodef on this.
Any programm working with relative pathnames, climbing up to the root then coming down, will fail.

If you want to achieve such a thing then forget about symlinks. Mount bind are your friends.

For example, I made a partition UsrOpt with two directories usr and opt.
If I just symlink /UsrOpt/usr on /usr and /UsrOpt/opt on /opt then about all builds will fail when trying to fetch /UsrOpt/usr/foo/../../../../../lib

Instead I just mount -o bind /UsrOpt/usr on /usr and /UsrOpt/opt on /opt
And do the same with /var/tmp and /tmp

If you get >=4Go RAM then I believe you can safely ignore a dedicated swap partition.
In case you realise that swap is needed you can swap on a file you can create for the occasion when needed on your partition dedicated to TMPs
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Thu Jul 28, 2011 6:28 pm    Post subject: Reply with quote

machine slave,

Welcome to Gentoo.

If you want to play with lots of partitions, use LVM and the xt family of filesystems. You can grow and shrink and add and delete partitions without reformatting. I'm with everyone else on the symlinking - don't do it. I'm also a believer in splitting things up for security, space saving or whatever.

Code:
$ df -hT 
Filesystem               Type    Size  Used Avail Use% Mounted on
rootfs                   rootfs   15G  1.2G   13G   9% /
/dev/root                ext4     15G  1.2G   13G   9% /
rc-svcdir                tmpfs   1.0M   84K  940K   9% /lib64/rc/init.d
udev                     tmpfs    10M  488K  9.6M   5% /dev
shm                      tmpfs   7.9G  100K  7.9G   1% /dev/shm
/dev/mapper/vg-home      ext4   1008G  764G  194G  80% /home
/dev/mapper/vg-opt       ext4    9.9G  1.2G  8.2G  13% /opt
/dev/mapper/vg-tmp       ext2    2.0G  8.5M  1.9G   1% /tmp
/dev/mapper/vg-var       ext4     59G   26G   30G  47% /var
/dev/mapper/vg-usr       ext4     40G   20G   18G  53% /usr
/dev/mapper/vg-local     ext4   1008M   55M  903M   6% /usr/local
/dev/mapper/vg-portage   ext2    2.0G  286M  1.6G  16% /usr/portage
/dev/mapper/vg-distfiles ext4     30G   22G  6.2G  79% /usr/portage/distfiles
/dev/mapper/vg-packages  ext4     30G   17G   12G  61% /usr/portage/packages
/dev/mapper/vg-vmware    ext4     82G   25G   53G  33% /mnt/vmware
/dev/shm                 tmpfs   7.9G     0  7.9G   0% /var/tmp/portage
/dev/md1                 ext2     38M   25M   12M  69% /boot

I have /boot on raid1, root on raid5, 4 identical swaps that the kernel manages and everything else in LVM. Thats total of 4 partitions.

tmp, portage distfiles and packages are all expendable and are made with ext4 -O ^has_journal.
further, portage is made with a small block size and a large number of inodes.

I have been thinking of moving tmp into /dev/shm as /tmp is cleared every boot and I have the RAM to support this.
_________________
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
machine slave
n00b
n00b


Joined: 27 Jul 2011
Posts: 6

PostPosted: Fri Jul 29, 2011 8:40 am    Post subject: Re: Unusual partitioning schema, comments sought Reply with quote

Thanks everyone for reply, and sorry in advance for long message, I just would like to respond to every point.

audiodef wrote:
machine slave wrote:

  • temporal partition (20 GB?) with several directories, symlinked in root partition at:
    • /var


8O

I just classified /var as temporal as well, i.e constantly changing and not critically important files. Is it some sort of sacrilege to remount /var in Linux? :D

audiodef wrote:

Most people either follow the handbook partition scheme or use a two-partition scheme with /root and swap, placing /boot in /root. This works with ext4, so you shouldn't have any trouble with that.

Do you mean that ext4 is so robust that separating often-written files from the rest of the system is unnecessary? Personally I'm not sure, that's why I have to ask.

disi wrote:
You can set stuff like noexec during mount, so nothing will be executed ever on those filesystems.

Is it some sort of additional security measure? I see noexec option in mount manual, but what's exactly will it be necessary for?

disi wrote:
I have a sumlink for /tmp to /var/tmp so all tmp stuff is in the same folder and could be wiped easily.

But note that /tmp is different from /var/tmp in that it doesn't preserve files between reboots (at least FHS recommends that, so programs might depend on that). Also, since it's two different directories, why can't a program use both of them, and accidentally with conflicting filenames? That's why I think they belong to same partition, but not to same directory.

aCOSwt wrote:
If you want to achieve such a thing then forget about symlinks. Mount bind are your friends.

I didn't know that, thanks.

aCOSwt wrote:
If you get >=4Go RAM then I believe you can safely ignore a dedicated swap partition.
In case you realise that swap is needed you can swap on a file you can create for the occasion when needed on your partition dedicated to TMPs

But do you know that in that case Linux won't be able to use all of your memory? See LinuxJournal. Note that if you have similarily large harddrive, you could use vm.overcommit_memory=2 and configure swap as twice the size of RAM to ensure full memory availability and enforce system reliability at the same time by protecting it from the very worst case (which is possible anyway).

NeddySeagoon wrote:
If you want to play with lots of partitions, use LVM and the xt family of filesystems. You can grow and shrink and add and delete partitions without reformatting.

I'm enough with two, thank you. :D Thanks for suggestion though.

NeddySeagoon wrote:
I have been thinking of moving tmp into /dev/shm as /tmp is cleared every boot and I have the RAM to support this.

Just for your consideration, I once read in some FreeBSD documentation that for example to write DVD one needs something like 9GB of space in /tmp for interim file, so you could still run out of RAM in some cases.

Thanks
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Fri Jul 29, 2011 10:10 am    Post subject: Reply with quote

I tend to use a separate /var since it has a lot of files, eg: news/spool, coming
and going; it's also the only partition I've ever had to reformat because of
corruption. /boot because it makes tinkering easier, /, /var, and /home seem
a reasonable collection.

I tend leave tmp on /, but you could put it on a fast drive if you have one spare.
Note that emerge keeps failed emerges in /var/tmp, which is often useful.

Will
Back to top
View user's profile Send private message
disi
Veteran
Veteran


Joined: 28 Nov 2003
Posts: 1354
Location: Out There ...

PostPosted: Fri Jul 29, 2011 10:14 am    Post subject: Reply with quote

I have tmpfs for /tmp and /var/tmp links to /tmp, never had problems. The /tmp is wiped on every reboot (and so is /var/tmp)
_________________
Gentoo on Uptime Project - Larry is a cow
Back to top
View user's profile Send private message
Goverp
l33t
l33t


Joined: 07 Mar 2007
Posts: 741

PostPosted: Fri Jul 29, 2011 10:34 am    Post subject: Reply with quote

FWIW, here's my configuration.

  1. /boot partition. Actually, I meant to have two of them using RAID 1, but never got around to it.

  2. The remaining partitions are on top of a 750 GB RAID 5 array:
    1. /var 50 GB
    2. /var/tmp 50 GB. This has a subdirectory bind mounted as /tmp.
    3. A gap, empty space, so I could grow the partitions on either side if I found them too small.
    4. /home 150 GB. This gets all CD collection ripped to flac files, and photo album in DigiKam and videos in Kdenlive, so it will grow into that gap. Though I might allocate a new "big stuff" partiton in the free space and move them there, and use bind mounts to put bits of it back into /home.
    5. rootfs 40GB


The gap was made by allocating partitions 1 & 2 at the start of free space, and 4 & 5 at the end of free space.

The above layout means I don't bother to backup the /var/tmp+/tmp ("ephemera") partition. If I had the big stuff partition, I might back it up on a different schedule or device. I use sys-fs/dump as my backup tool, putting the system into rc single mode before running it, copying it all to a 1 TB USB drive. I have relatime on the ephemera partition & a cron job to delete stuff on it that's not been touched for 4 weeks.

Here's my fstab
Code:
# <fs>          <mountpoint>    <type>          <opts>                  <dump/pass>
# The components of my Gentoo system
LABEL=boot      /boot           ext4            noauto,noatime          1 2
LABEL=raidroot  /               ext4            noatime                 1 1
LABEL=home      /home           ext4            relatime                1 2
LABEL=var       /var            ext4            noatime                 1 2
LABEL=ephemera  /var/tmp        ext4            relatime                0 2
/var/tmp/tempfs /tmp            none            bind

_________________
Greybeard
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3410

PostPosted: Fri Jul 29, 2011 2:20 pm    Post subject: Reply with quote

I've fiddled with your "temporal partitioning" before, with a slight tweak. I would set up "/" and "/var" as my read-mostly and read-write partitions, but I also generally make "/home" its own partition as well, so that my stuff will survive a reinstall. When using this technique I would bind-mount the rest of the stuff - like /tmp, into the right location instead of symlinking.

I used temporal mounts in the ext3 days. From what I could see of ext4 it made it so I didn't need to, so these days I have boot, root, swap, cache, and home.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
machine slave
n00b
n00b


Joined: 27 Jul 2011
Posts: 6

PostPosted: Fri Jul 29, 2011 3:00 pm    Post subject: Reply with quote

depontius wrote:
From what I could see of ext4 it made it so I didn't need to, so these days I have boot, root, swap, cache, and home.

May I ask, what exactly did ext4 change? Has it become reliable enough that filesystem never gets corrupted?
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3410

PostPosted: Fri Jul 29, 2011 3:21 pm    Post subject: Reply with quote

machine slave wrote:
depontius wrote:
From what I could see of ext4 it made it so I didn't need to, so these days I have boot, root, swap, cache, and home.

May I ask, what exactly did ext4 change? Has it become reliable enough that filesystem never gets corrupted?

No, but I got the impression that it was less prone to fragmentation.
_________________
.sigs waste space and bandwidth
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