Notes on resizing file system in LVM (Shrink)

1. Umount the filesystem and check it with e2fsck

umount /var/lib/vz

e2fsck -f /dev/mapper/pve-data

2. Re-size the file system of /dev/mapper/pve-data (Let said to 500GB)

resize2fs /dev/mapper/pve-data 500G

3. Resize the Logical Volume of LVM

 lvresize -L 500G /dev/pve/data

4. Check the size of the Logical Volume

lvdisplay /dev/pve/data

5. Mount the filesystem and check the size

mount /var/lib/vz

df -h


Enjoy it.



Recover a deleted harddisk image of a running KVM guest

Assume you have deleted the harddisk image file of a running KVM guest with id 501.
You can restore the deleted image by following step.

1. Check where is the running process and its depends files
lsof | grep kvm | grep 501

2. locate the information
kvm 275741 root 13u REG 253,2 68719476736 63299585 (deleted)/var/lib/vz/images/501/vm-501-disk-1.raw
kvm 275741 root 15u REG 253,2 274877906944 63299587 (deleted)/var/lib/vz/images/501/vm-501-disk-2.raw
kvm 275741 root 16u REG 253,2 274877906944 63299586 (deleted)/var/lib/vz/images/501/vm-501-disk-3.raw

3. recover the image back!!!
cp /proc/275741/fd/13 /var/lib/vz/images/501/vm-501-disk-1.raw
cp /proc/275741/fd/15 /var/lib/vz/images/501/vm-501-disk-2.raw
cp /proc/275741/fd/16 /var/lib/vz/images/501/vm-501-disk-3.raw


轉:做「通渠佬」,畢竟比「IT 人」好

做「通渠佬」,畢竟比「IT 人」好,通渠通常很暢快,雖然臭一點,但最起碼立竿見影,通就通,唔通就唔通,一兩個鐘就可以走人;另一方面,朋友們總不好意思叫你免費通渠,也不會在通渠失敗之時,叫你拆了馬桶回家再慢慢通--眼不見為乾淨,你在家修理三十個鐘,對方隨時連一句有誠意的「多謝哂」都沒有,反過來再遇到問題,立即又詛咒你:「乜果個大學讀電腦的友仔咁渣o架,呢頭修理完果頭又壞!」即使通渠不久後又爆屎渠,大家都會怪罪於亂拋垃圾的人,至多都是怪罪於馬桶,而不會怪罪於那個不幸的通渠佬。


No more ‘php_value mbstring.func_overload’ in .htaccess

Since to the patch of php bug #43227
There is no more effect on .htaccess ‘php_value mbstring.func_overload’ setting.

The work-around is to set func_overload into Apache virtualhost config file.
php_admin_value mbstring.func_overload X
X is the value that you want to set.

How to solve “Out of resources when opening file”

When you got “23: Out of resources when opening file” or “1016: Can’t open file” from Directadmin backup output or mysqldump output, it is all about open-file-limit

what you need to do is increase the open-file-limit and set it into /etc/my.cnf
then restart the mysql service
/etc/init.d/mysqld restart

mdadm – mismatch_cnt is not 0 on /dev/md0

WARNING: mismatch_cnt is not 0 on /dev/md0
if uncounted the title's warning in weekly check. We have to do the following to repair and check the array.

echo repair >/sys/block/md0/md/sync_action
echo check >/sys/block/md0/md/sync_action

Apparently, a non-zero number is common on RAID-1 and RAID-10 due to 
various (harmless?) issues like aborted writes in a swap file.

So my take on all of that is, if you see it on RAID-5 or RAID-6, you 
should worry. But if it's on an array with memory mapped files or swap 
files/partitions that is RAID-1 or RAID-10, it's less of a worry.

Directadmin mail forward for 1st (master) account

In directadmin, mail can be forwarded to other mail box / e-mail address by setting forarder.

However, the setting for master account and virtual account are different. here is the tips.

For master account:  iammaster,

For virtual account:

The different is that for virtual e-mail forwarder, a copy must be sent to the virtual account and forward another copy to the forwarder address. However master e-mail forwarder doesn’t.