Posts Tagged ‘centos’

Một số lệnh SSH kết hợp với Cpanel !

Một số lệnh SSH kết hợp với Cpanel !

Một số lệnh SSH kết hợp với Cpanel !

Một số lệnh SSH kết hợp với Cpanel !

s (cho thấy mọi thứ trong thư mục hiện tại)
ls -a (cho thấy mọi file kể cả file ẩn )
ls -l (Cho thấy mọi file bao gồm cả kích cỡ thông tin file )
tar -zxpf <file.tar.gz> (Giải nén file .tar.gz)
tar -xpf <file.tar> (Giải nén file .tar) Xem chi tiết…

Tăng dung lượng cho phân vùng /tmp trong cPanel (Xử lý lỗi /tmp: 100% Full)

Tăng dung lượng cho phân vùng /tmp trong cPanel (Xử lý lỗi /tmp: 100% Full)

(Anh em chịu khó đọc tiếng anh xí)

It’s quite common for a cPanel server to need a larger /tmp partition.

cPanel, by default, creates a loopback device that mounts to /tmp. The default size is only 512MB. This is quite small, especially for shared systems.

Reasons /tmp might become full:

  • MySQL operation or Repair requiring temporary space. Keep in mind the /tmp partition must be big enough to support the largest table size on your system. (8GB table would require 8+GB /tmp space)
  • PHP sessions consuming space in /tmp
  • Rogue scripts living in /tmp

To resize follow these steps:

** Note that this will stop MySQL and will cause service interruption. These commands will resize /tmp to 2GB. If you wish to resize to a greater or smaller size simply change 2048000 to your desired size in bytes.

/etc/init.d/chkservd stop
/etc/init.d/mysql stop
umount /var/tmp
umount /tmp
sed -i -e ‘s/512000/2048000/g’ /scripts/securetmp
rm /usr/tmpDSK
/scripts/securetmp –auto
cd /tmp
ln -s /var/lib/mysql/mysql.sock
/etc/init.d/mysql start
/etc/init.d/chkservd start

If you receive errors stating that /tmp could not be unmounted simply run the following command to identify the PID (Process ID) still using /tmp

lsof /tmp

Next, kill all processes using /tmp using “kill –9 <pid>”

Thay đổi kích thước file tmpDSK (/tmp) (Xử lý lỗi /tmp 100% Full)

Thay đổi kích thước file tmpDSK (/tmp) (Xử lý lỗi /tmp 100% Full)

You may have noticed that cPanel’s default partition size for /tmp is 512 MB, which in some cases can be way too small.  The /tmp partition on cPanel servers, assuming it was the one cPanel created and not one you did yourself, is a file-based partition that can easily be resized.

By default on most servers, /tmp is the temporary dumping place for a lot of things, for example:

* PHP session files
* PHP temporary file uploads
* MySQL temporary files
* Cache files for certain Apache modules

Most software that uses temporary files or sessions will automatically prefer to use /tmp – this folder is usually set to 777  permissions and therefore writeable by every user on the server.

When your /tmp partition fills up, it can cause noticeable problems for your users. If you run a larger server, the /tmp folder can fill up quickly and be very annoying as far as maintenance is concerned. Fortunately there is a very easy way to increase the size of this partition on a standalone server.

1. Stop MySQL, Apache, and cPanel to prevent writing to the /tmp partition
2. Copy the contents of /tmp to another location, such as /home (cp -rfp /tmp /home)
3. Unmount /tmp. If you’re unable to, you can do an lsof (lsof |grep /tmp) to see what processes are still writing to it, and kill them off. Or do a lazy unmount (umount -l /tmp) .
4. Delete /usr/tmpDSK (rm -rf /usr/tmpDSK)

Now open /scripts/securetmp and look for this line:

my $tmpdsksize     = 512000;    # Must be larger than 250000

And change the “512000″ value to your desired size in MB, and save the file. Now run the following script to recreate /tmp:


This will recreate your /tmp (tmpDSK) partition using the size you specified. While the securetmp script may be overwritten in a cPanel update, the size of /tmp will not be affected one you alter its size.