Linux увеличить папку temp

unixforum.org

У меня стал раздел /tmp занимать все 100%. Я хочу увелчить место на этом разделе (гигабайт до 5), для того, чтобы впредь такого не повторялось. Вопрос — как это сделать?
у меня дебиан 5,06; на tmp раздел сделано 373 мб; вывод df -l

/dev/sda1 334460 275990 41202 88% /
tmpfs 1033452 0 1033452 0% /lib/init/rw
udev 10240 784 9456 8% /dev
tmpfs 1033452 0 1033452 0% /dev/shm
/dev/sda9 296633284 170459744 111105376 61% /home
/dev/sda8 381138 361483 0 100% /tmp
/dev/sda5 4806904 2787116 1775604 62% /usr
/dev/sda6 2885780 505168 2234024 19% /var

drBatty Сообщения: 8735 Статус: GPG ID: 4DFBD1D6 дом горит, козёл не видит. ОС: Slackware-current Контактная информация:

Re: увеличить tmp раздел

Сообщение drBatty » 30.10.2010 07:27

У меня стал раздел /tmp занимать все 100%. Я хочу увелчить место на этом разделе (гигабайт до 5), для того, чтобы впредь такого не повторялось. Вопрос — как это сделать?

создайте раздел (например на другом диске)
перепишите /etc/fstab
перезагрузитесь.

После чего старый раздел /tmp и данные на нём можно будет удалить (я очищаю /tmp при каждой перезагрузке)

Re: увеличить tmp раздел

Сообщение taaroa » 30.10.2010 10:01

drBatty Сообщения: 8735 Статус: GPG ID: 4DFBD1D6 дом горит, козёл не видит. ОС: Slackware-current Контактная информация:

Re: увеличить tmp раздел

Сообщение drBatty » 30.10.2010 10:11

NickLion Сообщения: 3408 Статус: аватар-невидимка ОС: openSUSE Tumbleweed x86_64

Re: увеличить tmp раздел

Сообщение NickLion » 30.10.2010 10:15

Если сможете избавиться от всех программ, использующих /tmp, то можно и без перезагрузки — вместо неё сделать

warlock:/home/nicklion # lsof /tmp lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/nicklion/.gvfs Output information may be incomplete. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME kdm 1370 root 6u unix 0xffff88013e833c80 0t0 7208 /var/run/xdmctl/dmctl- mysqld 3528 nicklion 4u REG 8,7 0 14 /tmp/ibWklVb2 (deleted) mysqld 3528 nicklion 5u REG 8,7 0 25 /tmp/ibF37Vnj (deleted) mysqld 3528 nicklion 6u REG 8,7 0 67 /tmp/ibmYeXzA (deleted) mysqld 3528 nicklion 7u REG 8,7 0 326 /tmp/ib9frONR (deleted) mysqld 3528 nicklion 11u REG 8,7 0 344 /tmp/ibI1KXn9 (deleted) qtcreator 3838 nicklion 10uW REG 8,7 0 21 /tmp/qtsingleapplication-5e9b-3e8-lockfile konqueror 5330 nicklion 31w unix 0xffff880080c603c0 0t0 44245 /tmp/ksocket-nicklion/konquerorla5330.slave-socket konqueror 5330 nicklion 32u unix 0xffff88008d601380 0t0 43724 /tmp/ksocket-nicklion/konquerorEU5330.slave-socket konqueror 5330 nicklion 33u unix 0xffff88008d601c80 0t0 43595 /tmp/ksocket-nicklion/konquerorAn5330.slave-socket konqueror 5330 nicklion 34u unix 0xffff88009663c6c0 0t0 43660 /tmp/ksocket-nicklion/konquerormp5330.slave-socket konqueror 5330 nicklion 36u unix 0xffff880080c60cc0 0t0 43776 /tmp/ksocket-nicklion/konquerorwA5330.slave-socket konqueror 5330 nicklion 37u unix 0xffff880092e91980 0t0 43704 /tmp/ksocket-nicklion/konquerorwb5330.slave-socket konqueror 5330 nicklion 38u unix 0xffff880092e91080 0t0 43725 /tmp/ksocket-nicklion/konquerorHk5330.slave-socket konqueror 5330 nicklion 39u unix 0xffff880098466680 0t0 44251 /tmp/ksocket-nicklion/konquerorQq5330.slave-socket konqueror 5330 nicklion 40u unix 0xffff8800a927e980 0t0 43778 /tmp/ksocket-nicklion/konquerorLR5330.slave-socket konqueror 5330 nicklion 41u unix 0xffff8800a92800c0 0t0 44190 /tmp/ksocket-nicklion/konquerorLy5330.slave-socket konqueror 5330 nicklion 46u unix 0xffff88009844c9c0 0t0 44246 /tmp/ksocket-nicklion/konqueroryJ5330.slave-socket konqueror 5330 nicklion 47u unix 0xffff880098466c80 0t0 44247 /tmp/ksocket-nicklion/konquerorzS5330.slave-socket konqueror 5330 nicklion 48u unix 0xffff8800a92d4cc0 0t0 44248 /tmp/ksocket-nicklion/konquerorRm5330.slave-socket warlock:/home/nicklion # find /tmp | xargs fuser /tmp/virt_1113: 3687 /tmp/.ICE-unix/3455: 3455 /tmp/ksocket-nicklion/kio_http_cache_cleaner: 4480 /tmp/ksocket-nicklion/kdeinit4__0: 3400 /tmp/ksocket-nicklion/klauncherOT3401.slave-socket: 3401 /tmp/orbit-nicklion/linc-e69-0-6d524e5c12c03: 3689 /tmp/orbit-nicklion/linc-e2e-0-afe6511ff67: 3630 /tmp/gpg-QDlbBY/S.gpg-agent: 3349 /tmp/qtsingleapplication-5e9b-3e8-lockfile: 3838 /tmp/.X11-unix/X0: 1483 /tmp/ssh-cOmth3296/agent.3296: 3350 /tmp/qtsingleapplication-5e9b-3e8: 3838 warlock:/home/nicklion # ps aux|grep 1483 root 1483 5.0 1.4 149632 57508 tty7 Ss+ 07:41 4:46 /usr/bin/Xorg -br :0 vt7 -nolisten tcp -auth /var/lib/xdm/authdir/authfiles/A:0-d04Xfc

Источник

Читайте также:  Linux which files open by process

How to change tmpfs partition size in Linux ( RHEL / CentOS 7 )

In my last article I gave an overview on tuned and steps to create a custom tuned profile as per your performance requirement. In this article I will share the steps to (increase/decrease) change tmpfs partitions size in Linux. With RHEL 7 the Linux kernel provides a number of different ways for userspace to communicate with it.

For many facilities there are system calls, others are hidden behind netlink interfaces, and even others are exposed via virtual file systems such as /proc or /sys . These file systems are programming interfaces, they are not actually backed by real, persistent storage. They simply use the file system interface of the kernel as interface to various unrelated mechanisms.

Now by default systemd assigns a certain part of your physical memory to these partitions as a threshold. But what if your requirement requires you to change tmpfs partition size?

For some of the tmpfs partitions, you can change the threshold size by using fstab . While for other partitions like ( /run/user/ ) which are created runtime, you cannot use fstab to change tmpfs partition size for such runtime directories.

Below are the list of tmpfs partitions available in RHEL 7

Filesystem Size Used Avail Use% Mounted on tmpfs 187G 0 187G 0% /dev/shm tmpfs 187G 41M 187G 1% /run tmpfs 187G 0 187G 0% /sys/fs/cgroup tmpfs 38G 0 38G 0% /run/user/1710 tmpfs 38G 0 38G 0% /run/user/0

You may notice that /etc/fstab does not contains entries for these tmpfs partitions but still df -h will show these partitions.

Change tmpfs partition size for /dev/shm

If an application is POSIX compliant or it uses GLIBC (2.2 and above) on a Red Hat Enterprise Linux system, it will usually use the /dev/shm for shared memory (shm_open, shm_unlink). /dev/shm is a temporary filesystem (tmpfs) which is mounted from /etc/fstab . Hence the standard options like «size» supported for tmpfs can be used to increase or decrease the size of tmpfs on /dev/shm (by default it is half of available system RAM).

Читайте также:  Клиент sql на linux

For example, to set the size of /dev/shm to 2GiB, change the following line in /etc/fstab :

none /dev/shm tmpfs defaults 0 0
none /dev/shm tmpfs defaults,size=2G 0 0

For the changes to take effect immediately remount /dev/shm :

A mount -o remount to shrink a tmpfs will succeed if there are not any blocks or inodes allocated within the new limit of the smaller tmpfs size. It is not possible to predict or control this, however a remount simply will not work if it cannot be done. In that case, stop all processes using tmpfs, unmount it, and remount it using the new size.

Lastly validate the new size

# df -h /dev/shm Filesystem Size Used Avail Use% Mounted on tmpfs 2.0G 0 2.0G 0% /dev/shm

Change tmpfs partition size for /run

/run is a filesystem which is used by applications the same way /var/run was used in previous versions of RHEL. Now /var/run is a symlink to /run filesystem. Previously early boot programs used to place runtime data in /dev under numerous hidden dot directories. The reason they used directories in /dev was because it was known to be available from very early time during machine boot process. Because /var/run was available very late during boot, as /var might reside on a separate file system, directory /run was implemented.

By default you may not find any /etc/fstab entry for /run, so you can add below line

none /run tmpfs defaults,size=600M 0 0

For the changes to take effect immediately remount /run :

lastly validate the new size

# df -h /run Filesystem Size Used Avail Use% Mounted on tmpfs 600M 9.6M 591M 2% /run

Change tmpfs partition size for /run/user/$UID

/run/user/$UID is a filesystem used by pam_systemd to store files used by running processes for that user. In previous releases these files were typically stored in /tmp as it was the only location specified by the FHS which is local, and writeable by all users. However using /tmp can causes issues because it is writeable by anyone and thus access control was challenging. Using /run/user/$UID fixes the issue because it is only accessible by the target user.

tmps partition size for /run/user/$UID is taken based on RuntimeDirectorySize value from /etc/systemd/logind.conf

# grep -i runtime /etc/systemd/logind.conf RuntimeDirectorySize=10%

By default the default threshold for these runtime directory is 10% of the total physical memory.

From the man page of logind.conf

Modify this variable to your required value, for example I have provided threshold of 100M

# grep -i runtime /etc/systemd/logind.conf RuntimeDirectorySize=100M

Next restart the systemd-logind service

Change tmpfs partition size for /sys/fs/cgroup

/sys/fs/cgroup is an interface through which Control Groups can be accessed. By default there may or may not be /etc/fstab content for /sys/fs/cgroup so add a new entry

Читайте также:  Linux узнать права папок

Current value for /sys/fs/cgroup

# df -h /sys/fs/cgroup Filesystem Size Used Avail Use% Mounted on tmpfs 63G 0 63G 0% /sys/fs/cgroup

Add below line in your /etc/fstab to change the threshold to 2GB

none /sys/fs/cgroup tmpfs defaults,size=2G 0 0

Remount the partition /sys/fs/cgroup

# mount -o remount /sys/fs/cgroup

Lastly validate the updated changes

# df -h /sys/fs/cgroup Filesystem Size Used Avail Use% Mounted on tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup

Lastly I hope the steps from the article to change tmpfs partition size on Linux was helpful. So, let me know your suggestions and feedback using the comment section.

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

How to Resize tmpfs on Linux

tmpfs is a temporary file system that stores data in virtual. It does not create an file or directory on your hard drive. If you umnount and remount tmpfs file system all the files and directory residing in it are lost permanently.

tmpfs is similar to ramfs and RAM disk but with a few additional features. tmpfs is able to grow or shrink its space to accommodate files,and it can use swap space to store unneeded data. ramfs and RAM disk doesn’t have this capability.

In this article I will show you how to resize tmpfs on Linux machine.

Resize TMPFS

1. Login to you server with root access.

2. Check the current volume information using df command like below:

# df -h Filesystem Size Used Avail Use% Mounted on /dev/simfs 3.0G 2.6G 505M 84% / none 3.6G 4.0K 3.6G 1% /dev tmpfs 3.0G 3.0G 0.0G 100% /dev/shm 

3. Next check how much tmpfs space is beeing used using du command like below.

As you can see tmpfs 100% is used.

4. Lets resize the tmpfs volume by remounting it with a new size parameter. Make sure that the size is at least twice as large as current usage.

# mount -o remount,size=6G,noexec,nosuid,nodev,noatime /dev/shm

5. Verify the made changes using df command.

# df -h Filesystem Size Used Avail Use% Mounted on /dev/simfs 3.0G 2.6G 505M 84% / none 3.6G 4.0K 3.6G 1% /dev tmpfs 6.0G 3.0G 3.0G 50% /dev/shm 

6. Edit the /etc/fstab file to make this changes permanently.

# vim /etc/fstab none /dev/pts devpts rw 0 0 tmpfs /dev/shm tmpfs size=6G,noexec,nosuid,nodev,noatime 0 0 

Save and close file. You can also run mount command to apply changes in /etc/fstab file.

Источник

Оцените статью
Adblock
detector