Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
installing from scratch.. with some new ideas/concepts..
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
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Thu Aug 23, 2012 9:49 pm    Post subject: installing from scratch.. with some new ideas/concepts.. Reply with quote

Hello again

Since my last Gentoo system broke a couple of days ago (suddenly every package failed during compilation) I've decided use this opportunity(sic!) and perform a fresh install with some new (read: more complicated/time consuming) ideas.

Let's start with partitioning.. this http://forums.gentoo.org/viewtopic-t-922914-start-0.html plus some security articles made my re-think the whole concept once again. Bellow You can find the new scheme:

Code:
sda (120GB)
   sda1, ext2, 100-250MB, /boot
   sda2. ext4, 6-8GB, /         # maybe even less
   sda3, swap, 1-3GB, swap         # have 3GB of RAM

   sda4, lvm,
      lv_usr, ext4, <size>??, /usr         # size will depend on if /usr/portage is placed on a separate partition
      lv_local, ext4, <size>??, /usr/local
      lv_portage, ext4, <size>??, /usr/portage      # ??; lots of <~1k files; set block size to 1k
      lv_distfiles, ext4, <size>??, /usr/portage/distfiles   # ??; lots of big tarballs; set block size to 4k
      lv_packages, ext4, <size>??, /usr/portage/packages   # ??
      lv_var, ext4, <size>??, /var         # size will depend on if /var/tmp or only /var/tmp/portage is placed on a separate partition
      lv_vartmp, ext4/tmpfs, 6-8GB, /var/tmp      # ??; maybe only /var/tmp/portage
      lv_opt, ext4, 15GB, /opt
      lv_tmp, ext4/tmpfs, <size>??, /tmp
      lv_home, ext4, <free space left - 20GB>, /home
      free space left, 20GB


What bugs me:
1. How much will / actually need given all the extra partitions? (I used to spend 6-8GB.. will it suffice?)
2. I wan't to place /usr on a separate partition and mount it as read-only. Is this a good idea considering all the bogus with initramfs and udev (which I use)? How much space should I spend (in reference to point 3)?
3. Is /usr/portage granulation (3 separate partitions) really worth it? If it is, how much space should I spend on each one?
4. I used to spend ~12GB on /var. How much space should I reserve considering /var and /var/tmp (or /var/tmp/portage) separation?
5. /var/tmp or only /var/tmp/portage on a separate partition?
6. What are the benefits of /tmp and /var/tmp formated as tmpfs?
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"


Last edited by kamilsok on Thu Aug 23, 2012 10:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
gerard82
Advocate
Advocate


Joined: 04 Jan 2004
Posts: 2229
Location: Netherlands

PostPosted: Thu Aug 23, 2012 10:00 pm    Post subject: Reply with quote

Read this before you install.
http://forums.gentoo.org/viewtopic-t-901206.html
Gerard.
_________________
To install Gentoo I use sysrescuecd.Based on Gentoo,has firefox to browse Gentoo docs and mc to browse (and edit) files.
The same disk can be used for 32 and 64 bit installs.
You can follow the Handbook verbatim.
http://www.sysresccd.org/Download
Back to top
View user's profile Send private message
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Fri Aug 24, 2012 12:37 pm    Post subject: Reply with quote

Got through the post, did some notes..

To me it does not matter if udev requires initramfs or not, because I want my partitions encrypted (next step after dealing with filesystem scheme) so, either way, I probably would need initramfs anyway.
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1696

PostPosted: Sat Aug 25, 2012 9:11 am    Post subject: Reply with quote

I'd set / to 16G - certainly not less than 12 - and the same goes for /usr/portage
I have /var on a separate partition, rather than mess around with /var/tmp and
whatever - also it's the only partition that's ever got corrupted enough to need
a rebuild. If you don't want to rebuild the big packages, eg. openoffice, 6G
should be enough for /var, but I give it 16G anyway. I find it easier to have
all the partitions, except for swap (2x memory), the same size.

Will
Back to top
View user's profile Send private message
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Sat Aug 25, 2012 11:09 am    Post subject: Reply with quote

cwr wrote:
I'd set / to 16G - certainly not less than 12 - and the same goes for /usr/portage


In my previous setup I had 25GB for / (containing both /tmp and /usr) and had it utilized at about 30%. When I take out /usr and /tmp, / should not take more then 3/4GB based on my experience (/ does not tend to grow that much or even at all when we "take out" directories mentioned above). I would assume leaving extra 2/3GB of free space there is more then enough. It's /usr and /tmp that concern me. I did not check space utilization for those directories when they where on /. Thus the "what bugs me part";)

cwr wrote:
I have /var on a separate partition, rather than mess around with /var/tmp and
whatever - also it's the only partition that's ever got corrupted enough to need
a rebuild. If you don't want to rebuild the big packages, eg. openoffice, 6G
should be enough for /var, but I give it 16G anyway.


I do not plan on compiling any "big" packages. After almost half a year I have grown very found of lightweight, "single appliance" programs and thus plan to base my setup mostly on those. Even if i did one day need firefox or OO, I would go for binary (compiling every new upgrade is not worth the time). It's the 3rd party programs (Xilinx ISE i.e.) that would take much more space.. hence 15GB for /opt.

What bugs me for now in is how to divide space dedicated to:
1. /usr (16-18GB) between /usr, /usr/local, /usr/portage, /usr/portage/packages and /usr/portage/distfiles (assuming the division between the last three is worth the time)
2. and /var (10-12GB) between /var and /var/tmp (or /var/tmp/portage only)
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7835
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Aug 25, 2012 12:32 pm    Post subject: Reply with quote

Regarding /usr/portage:
  • /usr/portage/packages and /usr/portage/distfiles contain very similar content: a relatively small number of relatively large files. Thus probably doesn't make sense to have them on separate partitions: combine 'em.
  • /usr/portage is very different: a huge number of small files: different partition and filesystem might be warranted. But the overall size (if you split out distfiles and packages) is relatively small.
My preference for /var would be:
  • /var should be a high reliability filesystem, but
  • /var/tmp should be high performance. Also remember that compiling some of the monsters (libreoffice especially) now requires 10-12GiB in /var/tmp.
It's probably not worth further granularity in /var.

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Sat Aug 25, 2012 4:42 pm    Post subject: Reply with quote

John R. Graham wrote:
Regarding /usr/portage:
  • /usr/portage/packages and /usr/portage/distfiles contain very similar content: a relatively small number of relatively large files. Thus probably doesn't make sense to have them on separate partitions: combine 'em.
  • /usr/portage is very different: a huge number of small files: different partition and filesystem might be warranted. But the overall size (if you split out distfiles and packages) is relatively small.



Hmm.. so I would have something like this (consider 18-20GB for /usr as a whole):

/usr (2-4GB)
/usr/local (2GB)
/usr/portage (2GB, small files -> 1K block size)
/usr/portage/distfiles + /usr/portage/packages (10-12GB, large files -> 4K block size)

Would this be enough (I do clean distfiles on regular basis)? What about filesystems? Should I use different ones for /usr/portage and for /usr/portage/distfiles + /usr/portage/packages?

John R. Graham wrote:
My preference for /var would be:
  • /var should be a high reliability filesystem, but
  • /var/tmp should be high performance. Also remember that compiling some of the monsters (libreoffice especially) now requires 10-12GiB in /var/tmp.
It's probably not worth further granularity in /var.
- John


For this I would go with something like this (consider 12-14GB for /var as a whole):

/var (2-4GB)
/var/tmp (8-10GB)

Should be ok since, as mentioned before, I don't plan on compiling any "big fish". What about some other filesystem for /var/tmp? Maybe tmpfs to speed things up?
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sat Aug 25, 2012 6:05 pm    Post subject: Reply with quote

kamilsok,
My desktop fs layout is
Code:
~ # df -T
Filesystem               Type      1K-blocks      Used Available Use% Mounted on
rootfs                   rootfs     15511956   1145632  13578356   8% /
/dev/md126               ext4       15511956   1145632  13578356   8% /
/dev/dm-0                ext4       41284928  30279308   8908724  78% /usr
/dev/dm-3                ext4       60895292  29684044  28118616  52% /var
tmpfs                    tmpfs       8207404       568   8206836   1% /run
cgroup_root              tmpfs         10240         0     10240   0% /sys/fs/cgroup
udev                     devtmpfs      10240         4     10236   1% /dev
shm                      tmpfs       8207404       232   8207172   1% /dev/shm
/dev/mapper/vg-home      ext4     1056894132 796424400 206782644  80% /home
/dev/mapper/vg-opt       ext4       10321208    607256   9189664   7% /opt
/dev/mapper/vg-tmp       ext2        1572243      3110   1464276   1% /tmp
/dev/mapper/vg-local     ext4        1032088     65620    914040   7% /usr/local
/dev/mapper/vg-portage   ext2        2046355    391315   1550183  21% /usr/portage
/dev/mapper/vg-distfiles ext4       61927420  40959264  17822812  70% /usr/portage/distfiles
/dev/mapper/vg-packages  ext4       61927420  29164200  29617876  50% /usr/portage/packages
/dev/shm                 tmpfs       8207404         0   8207404   0% /var/tmp/portage
/dev/md125               ext2          38792     21483     15306  59% /boot

This system was installed when stage3-amd64-20090402.tar.bz2 was current. distfiles and packages have never been cleaned.
Portage is on an ext2 fs with one inode per 1k block, due to the large number of samll files. Its also expendable along with /tmp, which should really be a smfs.

The only reason for you to have more than 512Mb swap is that you want to hibernate to swap, then it needs to be the same size as RAM.
If you actually use 512Mb swap, someting is wrong.

Notice /usr and /var have raw device names - they are mounted by the initrd. /boot is a 4 spindle raid1, everything else is on top of raid5.
I still have a /dev/mapper/vg-vmware for VMware virtual machines. Its no longer mounted by defualt as I've moved to KVM and Virtualbox for virtualisation.

Code:
Filesystem               Type       Inodes   IUsed    IFree IUse% Mounted on
/dev/mapper/vg-portage   ext2       200704  188958    11746   95% /usr/portage
lets you see the effect if the inode ratio.
_________________
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
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Sat Aug 25, 2012 11:39 pm    Post subject: Reply with quote

After some research (http://forums.gentoo.org/viewtopic-p-6233551.html) on compiling in RAM I decided to leave that idea for now.. at least till I will be upgrading to a new workstation with more RAM. Will get back to "performance" governor instead.

NeddySeagoon I have seen Your scheme (the link, that I mentioned in my first post) and it's where I got (some) ideas from. Unfortunately with every entry I'm getting more and more angry at myself for not checking disk usage BEFORE formatting.. arrrgh :x

What concerns me is the main directory partition sizes (I have a lot less space to dedicate then You). If I leave /usr at 2-4GB and /var at 2-4GB, will it suffice? And, with only lightweight programs compilation at hand (the biggest one would probably be uzbl and gcc itself), is it worth to give /var/tmp 8-10GB?

I'm also thinking about moving swap to lvm. I used it to be the same size as RAM but never utilized much of that (if any at all) so why not do some testing and eventually dedicate spared space elsewhere :wink:
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"
Back to top
View user's profile Send private message
zappatized
n00b
n00b


Joined: 18 Aug 2012
Posts: 21

PostPosted: Sun Aug 26, 2012 2:43 pm    Post subject: Reply with quote

+1 @John
I haven't built any packages on this system, but from past systems I think ~200-250 ebuilds cost an additional ~3-4GB.
Code:
$ df -h;du -hs /usr/portage/distfiles/ /usr/portage/packages/ /usr/local/;sudo du -hs /var/tmp/portage/
Filesystem                  Size  Used Avail Use% Mounted on
rootfs                       10G  607M  8.9G   7% /
/dev/dm-2                    10G  607M  8.9G   7% /
tmpfs                       1.8G  240K  1.8G   1% /run
udev                         10M  4.0K   10M   1% /dev
shm                         1.8G   76K  1.8G   1% /dev/shm
/dev/mapper/funtoo-usr       20G  7.3G   12G  39% /usr
/dev/mapper/funtoo-var       15G  695M   14G   5% /var
tmpfs                       1.8G   31M  1.8G   2% /tmp
/dev/mapper/funtoo-portage   10G  5.8G  3.7G  61% /usr/portage
/dev/mapper/funtoo-vtmp      15G  1.8G   13G   13% /var/tmp
/dev/mapper/funtoo-opt       10G  510M  9.0G   6% /opt
/dev/mapper/funtoo-home     300G  4.7G  293G   2% /home
4.8G   /usr/portage/distfiles/
4.0K   /usr/portage/packages/
3.3M   /usr/local/
1.6G   /var/tmp/portage     (currently building libreoffice)

I set default PORTAGE_TMPDIR="/tmp" with per-package exceptions (so far) for libreoffice, firefox and thunderbird that get directed to build in /var/tmp. This is a 32bit system with 4GB RAM so default tmpfs size is just under 2GB but it is still enough to build gcc. As you can see, my allocations for var & vtmp probably exceed needs.
I've used ext4 for all of these (/boot is also separated, though with ext2 bs=1024 -O ^large_file,^resize_inode). Both portage and vtmp are sans journal with default block size though portage would probably benefit from smaller block size if separating out ../{distfiles,packages}. I don't know what other options would most benefit /var/tmp[/portage]. I've also seen reiser3 mentioned as a good candidate for portage due to supposed fast access for large number of small files. I chose to stick with the ext's due to in-place upgradeability (looking forward to btrfs) and minimizing number of fs drivers needed in kernel. I've also heard the claim that xfs can yield better performance for large filesystems, although I don't know if that also means better performance for large files (a la tarballs on distfiles,packages although I can't imagine a personal workstation where those would need to be large filesystems).
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Aug 26, 2012 5:29 pm    Post subject: Reply with quote

zappatized,

With lvm and a suitable filesystem you can move space around. You don't even need to allocate all of your lvm space to start with.
You add and delete logical volumes too.
_________________
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
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Sun Aug 26, 2012 8:13 pm    Post subject: Reply with quote

@zappatized

I have only 3GB of RAM which I would rather spare for compiling self-written software and building bit files for FPGA boards (synthesis, placement&route etc. cost a lot when it comes to memory). So for now let's stick with /var/tmp placed on disk.

Thanks for printing Your disk usage per partition (helped a lot on evaluating space needed). And so here's how it looks (let's call it ver. 0.9 :P )

/ (6GB should be more then enough with the proposed granulation)
/usr (8GB)
/usr/local (2GB should be enough since most of additional software will go to /opt)
/usr/portage (2GB)
/usr/portage/distfiles (6GB)
/usr/portage/packages (2-4GB)
/var (2-4GB since I don;t run any www, mail or ftp servers.. yet)
/var/tmp (8-10GB, ext4 with -pipe option added to CFLAGS and performance governor set as default)

@Neddy

I (almost) forgot about the beauty of lvm.. decided to move swap to lvm leaving only /boot and / as separate primary partitions and thinker with remaining question marks (1/2GB are small differences) after installation.


Uff.. that was a long but very building discussion. Thanks guys.
Partitioning scheme [checked]. Let's move to the next question (I hope this will not mess things up to much Neddy.. I can always start a new thread)..

So.. drive encryption. Was planning on encrypting the whole drive, but, since I'm not at that paranoia level yet, I think I should encrypt only those partitions, that the unprivileged user has write access:

swap
/var
/var/tmp
/tmp
/home

plus /boot because of grub password stored in grub.conf.

Am I missing something? Will the effort be less problematic then whole drive encryption in other words, will this setup require initramfs?
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"
Back to top
View user's profile Send private message
zappatized
n00b
n00b


Joined: 18 Aug 2012
Posts: 21

PostPosted: Mon Aug 27, 2012 12:39 am    Post subject: Reply with quote

A dual-boot system:
Code:
$ sudo fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeb78aba0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048       67583       32768    7  HPFS/NTFS/exFAT
/dev/sda2           67584      477183      204800   83  Linux
/dev/sda3          479169   976766975   488143903+   f  W95 Ext'd (LBA)
/dev/sda5          479232   886140927   442830848   8e  Linux LVM
/dev/sda6       886140992   916656064    15257536+   7  HPFS/NTFS/exFAT
/dev/sda7       916656128   925571008     4457440+   7  HPFS/NTFS/exFAT
/dev/sda8       925571072   976766975    25597952    7  HPFS/NTFS/exFAT

One OS to rule them all:
Code:
$ sudo gdisk -l /dev/sda
Password:
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E86A692E-C67E-449C-86CB-F53C2093EBA5
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40            2047   1004.0 KiB  EF02  BIOS
   2            2048          411647   200.0 MiB   8300  Boot
   3          411648      1953525134   931.3 GiB   8E00  funtoo

In both cases I have only boot-related data on unencrypted partitions and use slashbeast's initramfs. This is the only encryption setup I've ever used so I can't offer comparisons.
Back to top
View user's profile Send private message
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Tue Aug 28, 2012 6:21 pm    Post subject: Reply with quote

Zappatized I am looking at Your gdisk log and can't crack it.. is the whole disk encrypted or just Linux-dedicated partitions?

For the moment I'm quite sure that I don't want to encrypt everything, just the partitions I mentioned. Will I need initramfs image if my / partition will stay unencryped?
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"
Back to top
View user's profile Send private message
zappatized
n00b
n00b


Joined: 18 Aug 2012
Posts: 21

PostPosted: Tue Aug 28, 2012 7:37 pm    Post subject: Reply with quote

Yes sda3 is encrypted. I use an initramfs and have no experience of not using one. But I think you can go without if / is not encrypted. I think there's a gentoo article that discusses a separate /usr without using initramfs, if you go that route.
Back to top
View user's profile Send private message
kamilsok
n00b
n00b


Joined: 02 Mar 2010
Posts: 57
Location: Gdynia

PostPosted: Mon Sep 24, 2012 9:42 am    Post subject: Reply with quote

So much concerns and so little time.. argh :x

I'm having some second thoughts concerning filesystems.. at first I was planning on using ext2 for /boot and ext4 for other partitions, but now, after doing some reading, I leaning toward something like this:

Code:

sda1                            /boot                              ext2
sda2
        vg1                                                                                                               # LVM
        lv_root                  /                                     ext4/btrfs
        lv_usr                  /usr                                ext4/btrfs
        lv_usrlocal           /usr/local                       ext4/btrfs
        lv_usrportage      /usr/portage                   reiserfs/reiser4                          # lots of <~1k files; set block size to 1k
        lv_usrdistfiles     /usr/portage/distfiles     xfs                                              # lots of big tarballs; set block size to 4k
        lv_usrpackages  /usr/portage/packages   xfs                                              # small number of large files; 4k block size
        lv_opt                   /opt                                 ext4/btrfs
        lv_home               /home                             ext4/btrfs
sda3
        vg2                                                                                                                # LVM
        lv_swap               swap                              swap
        lv_tmp                  /tmp                                ext4/btrfs
        lv_var                   /var                                reiserfs/reiser4
        lv_vartmp             /var/tmp                         reiserfs/reiser4   


Basically I'm considering dumping ext4 for btrfs and reiserfs for reiser4. My concerns are as follows:
- performance (I know btrfs and reiser 4 are faster but is the gap worth the extra work in deploying/maintaining them?)
- stability (raiser4 and btrfs are rather new and not yest established.. will stability be enough for a home-based workstation?)
_________________
"If you are using Linux as a development platform, do not skip first learning administration and security. It is a foolish programmer indeed who is not master of his or her own computer"
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1696

PostPosted: Tue Sep 25, 2012 9:22 am    Post subject: Reply with quote

I'd leave everything as ext2/ext4 until btrfs has had a bit more of a workout;
say another year or so.

Generally on desktop systems filesystem type changes aren't going to make any
noticeable difference to speed, given a current version of a filesystem. It's best
just to keep things simple.

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