Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How do I disable tmpfs on /run/shm? I searched through initscripts and found that the following code checks the entry in fstab, but what should I change to make it not mount /run/shm? I'm running Debian sid.

/lib/init/mount-functions.sh

read_fstab_entry () {
        # Not found by default.
        found=1

        for file in "$(eval ls $(fstab_files))"; do
                if [ -f "$file" ]; then
                        while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do
                                case "$MNT_FSNAME" in
                                  ""|\#*)
                                        continue;
                                        ;;
                                esac
                                if [ "$MNT_DIR" = "$1" ]; then
                                        if [ -n "$2" ]; then
                                                [ "$MNT_TYPE" = "$2" ] || continue;
                                        fi
                                        found=0
                                        break 2
                                fi
                        done < "$file"
                fi
        done

        return $found

Function callsite

 if read_fstab_entry /run/lock; then
            if [ "$MNT_TYPE" = "tmpfs" ] ; then
                RAMLOCK="yes"
            else
                RAMLOCK="no"
            fi
        fi

Later

if [ yes = "$RAMLOCK" ]; then
                domount "$MNTMODE" tmpfs shmfs /run/lock tmpfs "-o${NODEV}noexec,nosuid$LOCK_OPT"
                # Make sure we don't get cleaned
                touch /run/lock/.tmpfs
        else
                chmod "$LOCK_MODE" /run/lock
        fi
share|improve this question
add comment

3 Answers 3

It's not clear what you're trying to achieve. By default (at least on Debian wheezy), /run/shm is a subdirectory of /run, which is mounted as tmpfs. So if you don't want /run/shm to be a mount point, don't change the default configuration. If you create an entry for /run/shm in /etc/fstab, it will be mounted only if you specify the filesystem type; otherwise /dev/shm is bind-mounted there. Not having /run/shm as tmpfs is not a supported configuration. If you want to use some other filesystem type, create an fstab entry and edit /etc/init.d/mountall.sh and /etc/init.d/mountdevsubfs.sh so that they call mount_shm with an argument other than mount or mount_update. Whatever you do, make sure that /run/shm is mode 1777 and has no files left over from a previous boot.

share|improve this answer
    
I want /run/shm not mounted, run also as well, because tmpfs slowdown system. –  eicto Nov 11 '12 at 8:25
    
The slowdown case here –  eicto Nov 11 '12 at 8:33
add comment

Put # in front of the fstab-Entry, to mark it as a comment.

If you look at the script that will trigger the continue-branch within the case-statement, making it skip that line.

share|improve this answer
    
there is no fstab entry here. –  eicto Mar 11 '13 at 15:26
    
@eicto There has to be a file with an entry for "/run/lock" in one of the files denoted by fstab_files. Can you locate the place, where fstab_files is allocated a value? –  Nils Mar 12 '13 at 11:21
    
I solved the problem, just installed 16G to workstation. –  eicto Mar 12 '13 at 11:35
add comment

Read the comments on /etc/default/tmpfs, edit the file (add RAMSHM=no), save and reboot.

share|improve this answer
    
no such file bro –  eicto Jul 8 '13 at 16:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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