2

I've recently been put in charge of a RHEL6 server running our NMS. I don't know much about Linux filesystem administration. What I'm needing to do is create a partition for /tmp, instead of having it sit on /. We are using LVM to handle our partitions.

#Output of df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             4.0G  1.1G  2.7G  29% /
tmpfs                  16G  116K   16G   1% /dev/shm
/dev/sda1             504M   61M  419M  13% /boot
/dev/mapper/VolGroup00-LVusr
                      4.0G  2.8G 1003M  74% /usr
/dev/mapper/VolGroup00-LVvar
                      9.9G  4.5G  4.9G  48% /var
/dev/mapper/VolGroup00-LVopt
                      252G   11G  229G   5% /opt

#Output of cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on <REDACTED>
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=d13d3a55-39c4-4be8-81b3-3181440961ca /                       ext4    defaults        1 1
UUID=d032e7b7-f44e-499f-94e1-58064385108f /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup00-LVusr /usr                    ext4    defaults        1 2
/dev/VolGroup00/LVvar           /var            ext4    defaults        1 2
/dev/mapper/VolGroup00-LVopt /opt                    ext4    defaults        1 2
/dev/mapper/VolGroup00-LVswap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
#<REDACTED>:/volumes/nxpool-01/unix-home/home /home  nfs     defaults,rsize=8192,wsize=8192,intr,vers=3     0 0

This server has 1TB of RAID5 storage, so space isn't an issue. We have ample unallocated space to hand out, I just don't know how to create the partition using LVM. I started to run into issues of automated backups using /tmp and running out of space, so backups started to fail.

Please let me know if I'm leaving out any vital information.

  • 1
    You should probably go to the people who put you in this position and ask them for some much needed education on the tools that they are making you use - you desperately need it and will be much better off with it. – user9517 Jan 24 '14 at 14:32
  • I have never met a distro where tmp wasn't already on a separated partition. Sometimes it's over memory (tmpfs) and sometimes it's on a disk, whether it's lvm or not. – mveroone Jan 24 '14 at 14:57
  • What is the output of vgs lvs and pvs ? Oh, this was asked 3 years ago. I'm sure they are sorted by now. – Aaron May 25 '17 at 15:26
  • /tmp is cleared out between reboots. You'd have to make sure that still happens if you explicitly create a volume for that. – user38537 Dec 20 '18 at 22:43
1

Per advice given, I asked my colleague who knows more than I.

The general outline of what needed to happen:

  • vgdisplay to see Volume groups
  • lvcreate -L <size> -n <name> <volgroup> to create a new logical volume
  • mke2f -t <fstype> <path/to/volgroup/<name>> to create a filesystem out on the logical volume
  • vim /etc/fstab and add a new entry
  • mount the new partition
  • 1
    It won't harm anything, but you likely left files in /tmp on the original partition which are now hidden by the mount. You would have to do a boot-to-single-user-mode two-step to eliminate them properly. – Dan Garthwaite Jan 24 '14 at 16:46
  • Ah yeah I actually got rid of everything there first – jready Jan 25 '14 at 0:00
  • 1
    You don't need to boot into single user mode to get to a mount shadowed directory, or even unmount the directory above it. It's much easier to bind mount the shadowed filesystem at its root to a different location and remove files there - as the bind mount will be guaranteed to be a single unshadowed filesystem. – Spooler Mar 10 '18 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.