The way to transfer /tmp on a separate disk as a separate mount level

Get real time updates directly on you device, subscribe now.

A fast submit explaining how one can transfer out /tmp listing from / to new mount level on the brand new disk

Create /tmp as a brand new mount level

One of many complications for sysadmin is getting a file system full. It might have many causes from blaming software, un-adequate capability planning until an un-organized file system construction. We’re going to have a look at the file system side of it.

Server with a single disk strategy i.e. root disk is formatted as one partition and mounted as / is widespread lately. However, there are servers on-prem nonetheless observe the slicing of disks and mounting totally different root FS on them strategy. So in case your server is one in every of them and for some purpose, your /tmp listing is a part of / and never separate mount level then this text is for you.

On this article, we’ll stroll you thru step-by-step process to mount /tmp on one other disk as a separate mount level. We’re going to separate out /tmp listing from / file system as /tmp mount level. We’re taking an instance with LVM however the process stays the identical if you wish to mount /tmp on one other partition. Solely exchange LVM components i.e. VG, LV stuff with equal partition creation process.

Be sure to have a legitimate backup of the server earlier than continuing.

The way to transfer /tmp as new mount level with downtime

/tmp is utilized by many processes on the server to open up temp information throughout execution. So this listing is at all times in use and rebooting in single-user mode to carry out such exercise is the most secure and clear approach. You possibly can examine processes utilizing /tmp by lsof command.

The whole process could be accomplished in under order –

Put together new disk for /tmpCreate LV on new disk (pvcreate, lvcreate)pvcreate /dev/sdbvgcreate vg_tmp /dev/sdblvcreate -l 100percentFREE -n lv_tmp vg_tmpFormat LV with filesystem of your choicemkfs.ext4 /dev/vg_tmp/lv_tmpMount it on a short lived mount mount /dev/vg_tmp/lv_tmp /mntCopy information from /tmp listing to the brand new diskcp -pr /tmp/* /mntls -lrt /mntls -lrt /tmpReboot server into single-user modePrepare new /tmp mount pointDelete/transfer current /tmp listing relying of area availability in / rm -rf /tmp ORmv /tmp /tmp.origCreate new /tmp for the mount pointSet permission and ownershipchmod 1777 /tmpchwon root:root /tmpAdd entry in /and so on/fstabecho “/dev/vg_tmp/lv_tmp /tmp defaults 1 2″>>/and so on/fstabReboot server usually.Log in and examine /tmp is mounted because the sperate mount level.

Establishing permission 1777 is a vital step on this. In any other case /tmp won’t perform because it anticipated to.

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More