[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mount /tmp on tmpfs jessie and stretch -- howto?



On Aug 30, 2016, at 5:00 PM, Ken Heard <kenslists@teksavvy.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I would like in my jessie and stretch boxes (one of each, both with
> systemd) to mount /tmp on tmpfs instead of a hard drive partition tmp
> or /dev/mapper/SOL1-tmp.  I assumed that to do so I could not have
> either of those partitions; so I unmounted them and then deleted them
> as a partition or as part of a LVM as the case may be.
> 
> I then created a created a line in /etc/fstab as follows:
> tmpfs	/tmp/	tmpfs	nodev,nosuid,size=20%	0	0.  When I rebooted I
> received dependency errors.
> 
> In addition to the line above /etc/fstab still had a line
> /dev/mapper/SOL1-tmp	/tmp	ext2	defaults	0	2.
> 
> However, df shows the first line (tmpfs /tmp etc.), but not the second
> (/dev/mapper/SOL1-tmp etc.)
> 
> Obviously something is wrong but what?  I know that file
> /etc/default/tempfs cannot be used in systemd, but I am at a loss to
> know what if anything replaces it in systemd.  Apparently it is not
> enough to add the tmpfs /tmp tmpfs etc line in /etc/fstab or run
> "systemctl enable tmp.mount".
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
> 
> iEYEARECAAYFAlfGHiUACgkQlNlJzOkJmTceiACcCZfxiTfMOQ1i8n/gm1ZBQvTB
> rf8AnjBT3QkxzIk85aLQmZc9Yw3wMoJR
> =wWwi
> ——END PGP SIGNATURE-----

I have the following line in /etc/fstab

>     tmpfs /tmp tmpfs defaults,size=10G,nr_inodes=1M 0 0

Here’s what I know about what systemd does with that

>     rbthomas@bigal:~$ systemctl status tmp.mount
>     * tmp.mount - /tmp
>        Loaded: loaded (/etc/fstab; disabled)
>        Active: active (mounted) since Mon 2016-08-22 00:38:33 PDT; 1 weeks 1 days ago
>         Where: /tmp
>          What: tmpfs
>          Docs: man:fstab(5)
>                man:systemd-fstab-generator(8)
>       Process: 293 ExecMount=/bin/mount -n tmpfs /tmp -t tmpfs -o defaults,size=10G,nr_inodes=1M (code=exited, status=0/SUCCESS)

Here’s what df has to say 

> rbthomas@bigal:~$ df -HTiP | egrep '^Filesystem|/tmp'
> Filesystem               Type     Inodes IUsed IFree IUse% Mounted on
> tmpfs                    tmpfs      1.1M    17  1.1M    1% /tmp
> rbthomas@bigal:~$ df -HTP | egrep '^Filesystem|/tmp'
> Filesystem               Type      Size  Used Avail Use% Mounted on
> tmpfs                    tmpfs      11G   21k   11G   1% /tmp

Seems to work for me…

The second line in your /etc/fstab (/dev/mapper/SOL1-tmp…) should not be there.  Since the block device it mentions no longer exists (you deleted it, you said) it wasn’t possible to mount it.  You should get some error message at boot time on that subject.

I don’t know if the “SIZE=20%” clause is handled properly by the systemd stuff.  You might try taking it out and see what you get.  The nodev and nosuid clauses should be OK, IIUC.

Rick



Reply to: