Gentoo Archives: gentoo-user

From: Pandu Poluan <pandu@××××××.info>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Partitioning strategy...?
Date: Sat, 26 Nov 2011 19:07:11
Message-Id: CAA2qdGXzgGJ9G32E-OOKRXOH1A-hK5NzN4wEb79TCTMZi8BERw@mail.gmail.com
In Reply to: Re: [gentoo-user] Partitioning strategy...? by Mick
1 On Sun, Nov 27, 2011 at 01:22, Mick <michaelkintzios@×××××.com> wrote:
2 > On Friday 25 Nov 2011 20:08:01 Walter Dnes wrote:
3 >> On Fri, Nov 25, 2011 at 11:12:42PM +0700, Pandu Poluan wrote
4 >>
5 >> > Everytime I read some guide on LVM, my eyes becomes blurry, the room
6 >> > starts spinning, and I can hear wolves howling ... :D
7 >> >
8 >> > Seriously, LVM looks mighty nice, but it also looks (and is!) mighty
9 >> > complex.
10 >> >
11 >> > So, I want to start from something simple.
12 >> >
13 >> > Aaaanyways, after reviewing my production boxes, I decided to
14 >> > implement the following strategy:
15 >> >
16 >> > /  == 800 MiB
17 >> > /boot == 20 MiB
18 >> > /usr == 1800 MiB
19 >> > /usr/portage == 2000 MiB
20 >> > /var == 4000 MiB
21 >> > /var/lib/postgresql == 1000 MiB
22 >> >
23 >> > Comments, suggestions, are welcome :)
24 >>
25 >>   I have my own weird approach that's even weirder than my mdev setup<G>.
26 >> I start with...
27 >> * 250 megabytes for / as ext2fs (No that is not a typo)
28 >> * 4 gigs for swap
29 >> * the rest of the drive is /home as one huge reiserfs partition
30 >>
31 >>   And I do *NOT* use LVM.  "fdisk -l" shows...
32 >>
33 >>    Device Boot      Start         End      Blocks   Id  System
34 >> /dev/sda1            2048   976773167   488385560    5  Extended
35 >> /dev/sda5            4096      516095      256000   83  Linux
36 >> /dev/sda6          518144     8906751     4194304   83  Linux
37 >> /dev/sda7         8908800   976773167   483932184   83  Linux
38 >>
39 >> "df" shows
40 >>
41 >> Filesystem           1K-blocks      Used Available Use% Mounted on
42 >> rootfs                  247919     29315    205804  13% /
43 >> /dev/root               247919     29315    205804  13% /
44 >> devtmpfs                 10240         0     10240   0% /dev
45 >> rc-svcdir                 1024        44       980   5% /lib/rc/init.d
46 >> mdev                     10240         0     10240   0% /dev
47 >> shm                    1551308         0   1551308   0% /dev/shm
48 >> /dev/sda7            483917384 251951296 231966088  53% /home
49 >>
50 >>   The secret is that I bindmount /opt, /var, /usr, and /tmp onto the
51 >> large reiserfs partition.
52 >>
53 > ###########################################################################
54 >> ### /dev/sda5               /         ext2     noatime,nodiratime,async
55 >>    0 1 /dev/sda7               /home     reiserfs
56 >> noatime,nodiratime,async,notail 0 1 /home/bindmounts/opt    /opt      auto
57 >>     bind                            0 0 /home/bindmounts/var    /var
58 >> auto     bind                            0 0 /home/bindmounts/usr    /usr
59 >>     auto     bind                            0 0 /home/bindmounts/tmp
60 >> /tmp      auto     bind                            0 0 /dev/sda6
61 >>     none            swap            sw              0 0 /dev/cdrom
62 >>      /mnt/cdrom      iso9660         noauto,users,ro 0 0 /dev/cdrom1
63 >>       /mnt/cdrom1     auto            noauto,user,ro  0 0 /dev/sdb1
64 >>  /mnt/extb       auto  noauto,user,noatime,async       0 0 /dev/sdc1
65 >>   /mnt/extc       auto  noauto,user,noatime,async       0 0
66 >>
67 >> # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
68 >> # POSIX shared memory (shm_open, shm_unlink).
69 >> # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
70 >> #  use almost no memory if not populated with files)
71 >> shm               /dev/shm        tmpfs nodev,nosuid,noexec       0 0
72 >>
73 > ###########################################################################
74 >> ###
75 >
76 > I recall your interesting mounting approach, but never really understood the
77 > benefit of it.  Would you please explain why you use bindmount?
78 >
79
80 Not really explaining waltdnes' interesting layout, but using
81 bindmount (instead of symlinks) ensures that when a program tries to
82 find a relative directory from a path, it will not attempt to do so
83 from the symlink's target.
84
85 E.g.:
86
87 Say I have /lib/gzampl/, which is actually a symlink/bindmount to
88 /mnt/gzampl/. Then theres another directory /lib/morethings. With a
89 symlink, if a program wants to do "../morethings" from within
90 /lib/gzampl/, it might end up in /mnt/morethings if the program tries
91 to resolve the symlink first. With a bindmount, doing "../morethings"
92 from /lib/gzampl/ will always end up in /lib/morethings.
93
94 (CMIIW)
95
96 That said... mentioning bindmount made me rethink things...
97
98 What if I have:
99
100 /mnt/.temporaries ==> ext4, 4GiB
101 /mnt/.persistents ==> reiserfs, 2GiB
102
103 then I make some directories and bindmounts:
104
105 /mnt/.temporaries/tmp --bm--> /tmp
106 /mnt/.temporaries/vartmp --bm--> /var/tmp
107 /mnt/.temporaries/run --bm--> /run
108 /run --bm--> /var/run
109 /run/lock --bm--> /var/lock
110 /mnt/.persistents/postgresql --bm--> /var/lib/postgresql
111 /mnt/.persistents/vardb --bm--> /var/db
112 /mnt/.persistents/varlog --bm--> /var/log
113 /mnt/.persistents/varspool --bm--> /var/spool
114
115 Ta da! The ephemeral directories can now just fight among themselves,
116 and the important directories can be backed up in one fell swoop (via
117 /mnt/.persistents)?
118
119 Thoughts are welcome, of course :)
120
121 Rgds,
122 --
123 FdS Pandu E Poluan
124 ~ IT Optimizer ~
125
126  • LOPSA Member #15248
127  • Blog : http://pepoluan.tumblr.com
128  • Linked-In : http://id.linkedin.com/in/pepoluan

Replies

Subject Author
Re: [gentoo-user] Partitioning strategy...? Alan McKinnon <alan.mckinnon@×××××.com>