Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
tmpfs uses hard drive instead of RAM
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
SemmZemm
n00b
n00b


Joined: 05 Jul 2013
Posts: 62
Location: France, Russia

PostPosted: Fri Oct 18, 2013 12:29 pm    Post subject: tmpfs uses hard drive instead of RAM Reply with quote

Hi, I configured my system like that in order to force portage use tmpfs:


Code:
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>            <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sdb2               /                       ext4            noatime,defaults,discard        0 1
/dev/sdb1               /boot                   ext2            noatime,defaults                1 2
/dev/sda1               none                    swap            sw                              0 0
/dev/sda2               /mnt/hdd                ext4            noatime,defaults                0 1
/dev/cdrom              /mnt/cdrom              auto            noauto,ro,user                  0 0
tmpfs                   /var/tmp/portage        tmpfs           defaults                        0 0
tmpfs                   /tmp                    tmpfs           defaults                        0 0
/mnt/hdd/home           /home                   bind            defaults,bind                   0 0
/mnt/hdd/var            /var                    bind            defaults,bind                   0 0


But I have impression that it uses hdd to build the packages.
1. Memory usage doesn't increase when I build packages (even libreoffice)
2. df -a says:
Code:
Filesystem     1K-blocks      Used Available Use% Mounted on
rootfs         230490868  18676820 200082716   9% /
/dev/sdb2      230490868  18676820 200082716   9% /
proc                   0         0         0    - /proc
tmpfs             806764       552    806212   1% /run
udev               10240         0     10240   0% /dev
mqueue                 0         0         0    - /dev/mqueue
devpts                 0         0         0    - /dev/pts
shm              4033812       276   4033536   1% /dev/shm
sysfs                  0         0         0    - /sys
debugfs                0         0         0    - /sys/kernel/debug
cgroup_root        10240         0     10240   0% /sys/fs/cgroup
openrc                 0         0         0    - /sys/fs/cgroup/openrc
cpuset                 0         0         0    - /sys/fs/cgroup/cpuset
cpu                    0         0         0    - /sys/fs/cgroup/cpu
cpuacct                0         0         0    - /sys/fs/cgroup/cpuacct
freezer                0         0         0    - /sys/fs/cgroup/freezer
/dev/sdb1         126960     18316    102092  16% /boot
/dev/sda2      397236440 117453932 259581036  32% /mnt/hdd
tmpfs          397236440 117453932 259581036  32% /var/tmp/portage
tmpfs            4033812       192   4033620   1% /tmp
/mnt/hdd/home  397236440 117453932 259581036  32% /home
/mnt/hdd/var   397236440 117453932 259581036  32% /var
binfmt_misc            0         0         0    - /proc/sys/fs/binfmt_misc

while I don't have 400GB of RAM. What did I wrong?

Thanks in advance.
Back to top
View user's profile Send private message
nemectic
Apprentice
Apprentice


Joined: 20 Aug 2004
Posts: 182

PostPosted: Fri Oct 18, 2013 1:07 pm    Post subject: Reply with quote

You need to state the size of the tmpdisk, for example:

Code:
tmpfs                   /tmp                    tmpfs           defaults,size=2G                        0 0
Back to top
View user's profile Send private message
SemmZemm
n00b
n00b


Joined: 05 Jul 2013
Posts: 62
Location: France, Russia

PostPosted: Fri Oct 18, 2013 1:19 pm    Post subject: Reply with quote

And is there a way to do it without limitation of partition size?
I want it to use RAM when possible, when not I want it to use swap
Back to top
View user's profile Send private message
nemectic
Apprentice
Apprentice


Joined: 20 Aug 2004
Posts: 182

PostPosted: Fri Oct 18, 2013 1:29 pm    Post subject: Reply with quote

I don't use swap, I presume you'd just set it to a larger size though... Ie. You have 8GB RAM, 16 GB swap, set size=12GB.

It won't allocate that amount of space "just" for the disk, if it's not being used other processes can use it until the tmpdisk requires it.
Back to top
View user's profile Send private message
SemmZemm
n00b
n00b


Joined: 05 Jul 2013
Posts: 62
Location: France, Russia

PostPosted: Fri Oct 18, 2013 2:09 pm    Post subject: Reply with quote

nemectic wrote:
You need to state the size of the tmpdisk

Didn't work for me :(

Code:
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>            <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sdb2               /                       ext4            noatime,defaults,discard        0 1
/dev/sdb1               /boot                   ext2            noatime,defaults                1 2
/dev/sda1               none                    swap            sw                              0 0
/dev/sda2               /mnt/hdd                ext4            noatime,defaults                0 1
/dev/cdrom              /mnt/cdrom              auto            noauto,ro,user                  0 0
tmpfs                   /var/tmp/portage        tmpfs           defaults,size=12G               0 0
tmpfs                   /tmp                    tmpfs           defaults,size=4G                0 0
/mnt/hdd/home           /home                   bind            defaults,bind                   0 0
/mnt/hdd/var            /var                    bind            defaults,bind                   0 0


df -a
Code:
Filesystem     1K-blocks      Used Available Use% Mounted on
rootfs         230490868  18920160 199839376   9% /
/dev/sdb2      230490868  18920160 199839376   9% /
proc                   0         0         0    - /proc
tmpfs             806764       552    806212   1% /run
udev               10240         0     10240   0% /dev
mqueue                 0         0         0    - /dev/mqueue
devpts                 0         0         0    - /dev/pts
shm              4033812       184   4033628   1% /dev/shm
sysfs                  0         0         0    - /sys
debugfs                0         0         0    - /sys/kernel/debug
cgroup_root        10240         0     10240   0% /sys/fs/cgroup
openrc                 0         0         0    - /sys/fs/cgroup/openrc
cpuset                 0         0         0    - /sys/fs/cgroup/cpuset
cpu                    0         0         0    - /sys/fs/cgroup/cpu
cpuacct                0         0         0    - /sys/fs/cgroup/cpuacct
freezer                0         0         0    - /sys/fs/cgroup/freezer
/dev/sdb1         126960     18316    102092  16% /boot
/dev/sda2      397236440 117424112 259610856  32% /mnt/hdd
tmpfs          397236440 117424112 259610856  32% /var/tmp/portage
tmpfs            4194304        24   4194280   1% /tmp
/mnt/hdd/home  397236440 117424112 259610856  32% /home
/mnt/hdd/var   397236440 117424112 259610856  32% /var
binfmt_misc            0         0         0    - /proc/sys/fs/binfmt_misc
Back to top
View user's profile Send private message
nemectic
Apprentice
Apprentice


Joined: 20 Aug 2004
Posts: 182

PostPosted: Fri Oct 18, 2013 2:29 pm    Post subject: Reply with quote

I may be jumping ahead of myself, what's the output of:

Code:
grep -i config_tmpfs /usr/src/linux/.config
Back to top
View user's profile Send private message
SemmZemm
n00b
n00b


Joined: 05 Jul 2013
Posts: 62
Location: France, Russia

PostPosted: Fri Oct 18, 2013 2:38 pm    Post subject: Reply with quote

nemectic wrote:
I may be jumping ahead of myself, what's the output of:

Code:
grep -i config_tmpfs /usr/src/linux/.config


Code:
# grep -i config_tmpfs /usr/src/linux/.config
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
Back to top
View user's profile Send private message
nemectic
Apprentice
Apprentice


Joined: 20 Aug 2004
Posts: 182

PostPosted: Fri Oct 18, 2013 3:00 pm    Post subject: Reply with quote

Everything looks like it should work.

Code:
ls -la /usr/src/linux/.config && uname -a


Post the output of that please.
Back to top
View user's profile Send private message
SemmZemm
n00b
n00b


Joined: 05 Jul 2013
Posts: 62
Location: France, Russia

PostPosted: Fri Oct 18, 2013 3:13 pm    Post subject: Reply with quote

Code:
# ls -la /usr/src/linux/.config && ls -la /usr/src/ && uname -a
-rw-r--r-- 1 root root 96620 Oct  7 14:03 /usr/src/linux/.config
total 32
drwxr-xr-x  8 root root 4096 Oct 15 14:00 .
drwxr-xr-x 15 root root 4096 Oct 14 02:15 ..
-rw-r--r--  1 root root    0 Aug 22 03:31 .keep
lrwxrwxrwx  1 root root   20 Oct  8 10:26 linux -> linux-3.11.4-gentoo/
drwxr-xr-x 25 root root 4096 Oct  7 14:39 linux-3.10.10-gentoo
drwxr-xr-x 25 root root 4096 Oct  7 14:37 linux-3.11.0-gentoo
drwxr-xr-x 24 root root 4096 Sep 17 04:52 linux-3.11.1-gentoo
drwxr-xr-x 24 root root 4096 Oct  4 22:09 linux-3.11.3-gentoo
drwxr-xr-x 25 root root 4096 Oct 18 16:36 linux-3.11.4-gentoo
drwxr-xr-x 24 root root 4096 Oct 15 14:01 linux-3.11.5-gentoo
Linux szldlc 3.11.4-gentoo #1 SMP Mon Oct 7 14:21:26 CEST 2013 x86_64 Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz GenuineIntel GNU/Linux
Back to top
View user's profile Send private message
nemectic
Apprentice
Apprentice


Joined: 20 Aug 2004
Posts: 182

PostPosted: Fri Oct 18, 2013 3:32 pm    Post subject: Reply with quote

Damnit, everything was in the first post.

Move the tmpfs line in your fstab to the bottom!

Just noticed you mount /var on /sdb *after* you've already made the tmpfs, it's effectively overwriting the mount point. Move the /var tmpfs line to the bottom and it'll be fine. :D


Code:
/dev/sdb2               /                       ext4            noatime,defaults,discard        0 1
/dev/sdb1               /boot                   ext2            noatime,defaults                1 2
/dev/sda1               none                    swap            sw                              0 0
/dev/sda2               /mnt/hdd                ext4            noatime,defaults                0 1
/dev/cdrom              /mnt/cdrom              auto            noauto,ro,user                  0 0
tmpfs                   /tmp                    tmpfs           defaults                        0 0
/mnt/hdd/home           /home                   bind            defaults,bind                   0 0
/mnt/hdd/var            /var                    bind            defaults,bind                   0 0
tmpfs                   /var/tmp/portage        tmpfs           defaults                        0 0
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things 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