move /tmp to separate partition - /tmp not mounted

General support questions
Post Reply
thorben
Posts: 1
Joined: 2017/04/22 16:05:04

move /tmp to separate partition - /tmp not mounted

Post by thorben » 2017/04/22 16:27:16

Hello,
I have an existing VM with an application installed and would like to move /tmp to a separate partition.

I did the following
1) add new disk
2) create partition on that disk (cfdisk)
3) create xfs filesystem on that partition (mkfs.xfs /dev/sdb1)
4) tested a manual mount - works
5) added tmp directory on that new filesystem with chmod 1777 (I also tried without tmp folder)
6) edited fstab and added /tmp to /etc/fstab

Code: Select all

/dev/mapper/centos-root /                       xfs     defaults        1 1
UUID=eaae7e0c-f069-4071-8852-708cefbc9bc1 /boot                   xfs     defaults        1 2
UUID=f408b19f-ceb3-45af-a59d-23fe93851e07 /tmp                   xfs     defaults        1 2
/dev/mapper/centos-swap swap                    swap    defaults        0 0
7) reboot to single mode and moved old /tmp to /tmp-old
8) created new /tmp in single mode (tried first without)

the result of all my tries it that /tmp is not mounted automatically which results in a readonly root-filesystem

If I do "mount -a", it mounts correctly but it does not work during boot.

Code: Select all

uname -a
Linux application1 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
during boot I get the error message

Code: Select all

failed to start dynamic system tuning daemon
commands after boot with readonly root-filesystem

Code: Select all

# mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=933444k,nr_inodes=233361,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mapper/centos-root on / type xfs (ro,relatime,seclabel,attr2,inode64,noquota)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
sunrpc on /proc/fs/nfsd type nfsd (rw,relatime)
/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

Code: Select all

# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   38G   27G   11G  72% /
devtmpfs                 912M     0  912M   0% /dev
tmpfs                    921M  4.0K  921M   1% /dev/shm
tmpfs                    921M  8.7M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                497M  119M  379M  24% /boot

Code: Select all

# mount -a
# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   38G   27G   11G  72% /
devtmpfs                 912M     0  912M   0% /dev
tmpfs                    921M  4.0K  921M   1% /dev/shm
tmpfs                    921M  8.7M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                497M  119M  379M  24% /boot
/dev/sdb1               1021M   33M  989M   4% /tmp

Any ideas?

Thanks,
Thorben

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: move /tmp to separate partition - /tmp not mounted

Post by TrevorH » 2017/04/22 17:48:34

Your new partition will end up being /tmp so you do not want a /tmp directory on it - that way you will end up with a /tmp/tmp. Mount the filesystem and then chmod 1777 /tmp so that the right permission is set on the filesystem to be mounted. Might also want to do a restorecon -r /tmp as well and then see if it automatically mounts.
Linux application1 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
You also need to yum update your system. That is an unpatched 7.0 kernel and we're now on 7.3 with a 3.10.0-514* kernel with many bugs fixed and security fixes made.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

bits45
Posts: 5
Joined: 2016/08/27 01:04:36

Re: move /tmp to separate partition - /tmp not mounted

Post by bits45 » 2017/04/23 01:45:16

Mounting /tmp in CentOS/RHEL 7 is now controlled by systemctl and is likely "masked" as well. This target must be enabled first.

Here's out of the box without /tmp mounted:

Code: Select all

# systemctl  list-unit-files --type=mount
UNIT FILE                     STATE   
dev-hugepages.mount           static  
dev-mqueue.mount              static  
proc-fs-nfsd.mount            static  
proc-sys-fs-binfmt_misc.mount static  
sys-fs-fuse-connections.mount static  
sys-kernel-config.mount       static  
sys-kernel-debug.mount        static  
tmp.mount                     disabled
var-lib-nfs-rpc_pipefs.mount  static  
See half way down this page for section called "Control and Manage Mount Points using Systemctl"

http://www.tecmint.com/manage-services- ... -in-linux/

Code: Select all

# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount

Code: Select all

# systemctl is-active tmp.mount
# systemctl enable tmp.mount
* Unmask /tmp for use

Code: Select all

# systemctl unmask tmp.mount

Post Reply