What are “/run/lock” and “/run/shm” used for?

1
...
0 0
2

Recently I found /run/lock and /run/shm folders to be missing.

I tried to recover some files with a mounted disk, I now know that this may caused the harm. So unaware what to do, I created these directories by myself.

Now I looked up the command df -h and saw this output:

Filesystem Size Used Avail Use% Mounted on /dev/sda6 913G 69G 798G 8% / udev 5,9G 4,0K 5,9G 1% /dev tmpfs 2,4G 872K 2,4G 1% /run none 5,0M 0 5,0M 0% /run/lock none 5,9G 2,1M 5,9G 1% /run/shm /dev/sda1 915M 358M 509M 42% /boot

I didn't know there were such file systems, how can I mount them in again? Is this something harmful?

I also saw that I have high I/O with my Journal jbd2/sda6-8 always around 40%, has this something to do with this?

I think df is getting thrown by the lack of specified device. If you look with mount, you'll see that the filesystem is definitely tmpfs.

$ df -h | grep run tmpfs 4.8G 1.4M...
0 0
3

What is a Ram Disk you ask? Simply put, you carve out a piece of your system’s RAM and use it as a normal file system. But you probably have some more questions…

Why would I want to do this?

Simply put, RAM is very fast. Faster than most (any?) SSD drive. So if you have an application that would benefit from being able to access data very quickly, a RAM disk makes a lot of sense.

That’s amazing… why don’t I just load everything into a RAM disk all the time?

Two primary reasons… First… RAM is expensive and therefore quite scarce compared with conventional hard drive space. So your system probably has a fairly limited amount to work with. Second, and perhaps more critical, RAM is erased whenever power is lost. So if you do a system reboot, or lose power, everything stored on your RAM disk, even the RAM disk itself, is completely lost.

Oi’ that’s bad… when exactly would I want to use a RAM disk then?

Some applications, like MySQL for example,...

0 0
4

This question already has an answer here:

UPDATE: this was fixed after Meteor v0.4 (2012). For historical purposes:

I'm testing Meteor on a micro EC2 Ubuntu 11.10 instance (8GiB) and upon installing it and logging in I ran the df command to see how much memory had been consumed by core files (about 10%):

Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 8256952 782068 7055456 10% / udev 295276 4 295272 1% /dev tmpfs 121248 148 121100 1% /run none 5120 0 5120 0% /run/lock none 303112 0 303112 0% /run/shm

Upon installing NodeJS & NPM I again ran df to determine how much more room had been consumed and it didn't look like much (an additional 2%):

Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 8256952 919444 6918080 12% / udev 295276 4 295272 1% /dev tmpfs 121248 148 121100 1% /run none 5120 0 5120 ...
0 0
5

I have a situation where I need to create 100s of thousands of 0 byte lock files for concurrency control.

I've tested creating them by using:

for i in `seq 1 50000`; do touch "/run/lock/${i}.lock"; done

Since the files are 0 bytes, they don't up any space in the partition. Looking at df -h:

Filesystem Size Used Avail Use% Mounted on tmpfs 50M 344K 49M 1% /run none 5.0M 0 5.0M 0% /run/lock none 246M 0 246M 0% /run/shm none 100M 0 100M 0% /run/user

The 0% figure doesn't change at all in the /run/lock row.

However the memory size does increase at an average of approximately 1KB per lock file. I discovered this by comparing free -h before and after creating 70,000 lockfiles inside /run/lock. This memory increase was reflected in real memory usage (virtual memory minus the buffers/cache).

Later I discovered that this 1KB increase is most likely due to the inodes. So I checked inode usage using df -i:

Filesystem ...
0 0
6

I have a Xen VPS with Debian Linux installed with ext4 filesystem. Once I found that all inodes are used. I checked this:

~# df -i Filesystem Inodes IUsed IFree IUse% Mounted on rootfs 3932160 3932160 0 100% / udev 59227 262 58965 1% /dev tmpfs 63251 215 63036 1% /run /dev/xvda 3932160 3932160 0 100% / tmpfs 63251 2 63249 1% /run/lock tmpfs 63251 2 63249 1% /run/shm

Then I tryed to find where all inodes were used. Usually them were used by PHP session files (bacause of cron task or PHP internal cleaner were broken). But I can't find what directory contains very large amount of files. I tryed many methods, there is one:

/# for i in /*; do echo $i; find $i |wc -l; done /aquota.group 1 /aquota.user 1 /bin 124 /boot 9 /dev 264 /etc 1746 /home 1 /initrd.img 1 /lib 4002 /lib64 2 /lost+found 1 /media 1 /mnt 1 /opt 1 /proc 26590 /root 17 /run 214 /sbin 127 /selinux 1 /srv 3 /sys 3609 /tmp 1 /usr 37020 /var 8636 /vmlinuz 1 /# mount...
0 0
7

DESCRIPTION

The

/etc/default/tmpfs

file contains variable settings in POSIX format:

VAR=VAL

Only one assignment is allowed per line. Comments (starting with '#') are also allowed.

This file is for the configuration of tmpfs filesystems mounted in early boot, before filesystems from /etc/fstab are mounted. This currently includes the filesystems /run, /run/lock, /run/shm and /tmp. /run is required to be a tmpfs on systems supporting tmpfs mounts. /run/lock and /run/shm may be separate tmpfs mounts, useful for enforcing separate size limits. /tmp is not required to be a tmpfs, and is not mounted as a tmpfs by default.

/run Previously configured using RAMRUN in /etc/default/rcS, /run is now always mounted as a ram file system (tmpfs). The size of the tmpfs can be controlled using TMPFS_SIZE and RUN_SIZE. If desired, the defaults may also be overridden with an entry in in /etc/fstab, for example:

tmpfs /run tmpfs nodev,nosuid,size=10%,mode=755...

0 0
8
Hello Everyone,

I am working on installing some camera monitoring software (Zoneminder). It is installed on Ubuntu 14.04 and is working great with 3 cameras. When I add a fourth it stops getting streams from some of the cameras. I have tracked this down to a maxed out /run/shm.

df-h produces the following (this is with 3 cameras running):

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 228G 1.9G 214G 1% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 986M 4.0K 986M 1% /dev
tmpfs 200M 576K 199M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 997M 816M 181M 82% /run/shm
none 100M 0 100M 0% /run/user

Notice /run/shm is at 82%. If I add a fourth camera /run/shm goes all the way to 997M and the feeds start crashing out. I guess simply put, is there anyway to make the size of the /run/shm greater than 997M?

Thanks,
...

0 0
9

devtmpfs 118672 0 118672 0% /dev

A filesystem that contains information about devices. The files is pointers to device drivers in the kernel.


tmpfs 25388 (8044) 17344 32% /run

Used by daemons to save temporary information.


tmpfs 5120 0 5120 0% /run/lock

Used to prevent the same daemon to be started more than once.


tmpfs 50760 0 50760 0% /run/shm

Can be used by You to save temporary files instead of /tmp.


if the tmpfs dirs are on devtmpfs,
devtmpfs - 3 subdir tmpfs: 35MB missing
or are these not related?

No, they are like different partitions on a hard disk.

tmpfs is used to minimize wear on the SD-card. It takes a portion of RAM memory and is always cleared when the computer shuts down, so no good to save lot of...

0 0
10
I'm trying to write files to the file system in a java programme but it fails with an exception throwing 'No space left on device' when df -h (and df -i) says otherwise. Here is the output of df -h: Filesystem Size Used Avail Use% Mounted on udev 5.9G 4.0K 5.9G 1% /dev tmpfs 1.2G 1.4M 1.2G 1% /run /dev/sda5 156G 139G 9.1G 94% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 5.9G 105M 5.8G 2% /run/shm none 100M 28K 100M 1% /run/user /dev/sda2 105G 102G 2.7G 98% /media/sam/System /dev/sda3 176G 163G 14G 93% /media/sam/Sam //where I'm trying to write and here is the output of df -i: Filesystem Inodes IUsed IFree IUse% Mounted on udev 1523763 552 1523211 1% /dev tmpfs 1526458 584 1525874 1% /run /dev/sda5 10362880 4750381 5612499 46% / none 1526458 2 1526456 1% /sys/fs/cgroup none 1526458 3 1526455 1% /run/lock none 1526458 191 1526267 1% /run/shm none 1526458 26 1526432 1% /run/user /dev/sda2 3832820 1045155 2787665 28% /media/sam/System /dev/sda3 35769712 22090147...
0 0
11

At some point in the past, your root filesystem filled up, and a small, temporary /tmp was created to allow boot to succeed. This small /tmp was never deleted, so now, even though you have room on /, you still are filling up the small /tmp and seeing your problem. Simply unmount it:

sudo umount /tmp

and of course, try to ensure your / is as clean as possible.

Normally, /tmp is just a part of the root (/) filesystem, no separate mount is needed, unless there are special circumstances, like running out of root filespace (when some daemon creates the one you see), or maybe you have / on a very slow media (like an USB flash stick) and want /tmp in ram for performance, even with limited...

0 0
12

Once you insert new hard disks into your system, you’ll typically use utilities like fdisk or parted to create partitions. Once you create a partition, you’ll use mkfs command to create ext2, ext3, or ext4 partition.

Once you create a partition, you should use mount command to mount the partition into a mount point (a directory), to start using the filesystem.

This tutorial explains everything you need to know about both mount and umount command with 15 practical examples.

The general mount command syntax to mount a device:

mount -t type device destination_dir

1. Mount a CD-ROM

The device file for CD would exist under /dev directory. For example, a CD-ROM device will be mounted as shown below.

# mount -t iso9660 -o ro /dev/cdrom /mnt

In the above example, the option “-o ro” indicates that the cdrom should be mounted with read-only access. Also, make sure that the destination directory (in the above example, /mnt) exist before you execute...

0 0
13

This file is for the configuration of tmpfs filesystems mounted in early boot, before filesystems from /etc/fstab are mounted. This currently includes the filesystems /run, /run/lock, /run/shm and /tmp. /run is required to be a tmpfs on systems supporting tmpfs mounts. /run/lock and /run/shm may be separate tmpfs mounts, useful for enforcing separate size limits. /tmp is not required to be a tmpfs, but is mounted as a tmpfs by default.

/run Previously configured using RAMRUN in /etc/default/rcS, /run is now always mounted as a ram file system (tmpfs). The size of the tmpfs can be controlled using TMPFS_SIZE and RUN_SIZE. If desired, the defaults may also be overridden with an entry in in /etc/fstab, for example:

tmpfs /run tmpfs nodev,nosuid,size=10%,mode=755 0 0

The contents of /run will always be lost on system reboot, and it it is no longer explicitly cleaned at boot. Packages can not expect directories in /run to exist after boot. Packages expecting this...
0 0
14
root@new:/etc/collectd# cat /proc/mounts rootfs / rootfs rw 0 0 /dev/root / ext3 rw,relatime,errors=remount-ro,data=ordered 0 0 devtmpfs /dev devtmpfs rw,relatime,size=1085360k,nr_inodes=271340,mode=755 0 0 tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=217328k,mode=755 0 0 tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0 proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=460860k 0 0 devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0...
0 0
15

I have searched all over for the answer for this and I can't find it so here I am.

My disk layout looks like this:


Code: Select all

Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 14953656 7919256 6284064 56% /
udev 10240 0 10240 0% /dev
tmpfs 760992 856 760136 1% /run
/dev/disk/by-uuid/0eee66b0-bbc1-4206-a318-fcee7bc264f1 14953656 7919256 6284064 56% /
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1521980 2132 1519848 1% /tmp
tmpfs 1521980 340 1521640 1% /run/shm
/dev/sda6 457269468 97464188 336915608 23% /home

I want to move /tmp to my /home partition where I have a lot of space for temporary files.
Seems like when I am downloading an .iso or multiple .iso files I run out of space...

0 0