• Find and identify where inodes are used

    Your monitoring system is claiming that your server is running out of free inodes but your disks are not full at all? Maybe you just need to check your filesystem usage and how many files are being used at the same time… Here are some tips to check and identify the inodes being used.

    First of all, you can check percentage of inodes used with this simple command:

    df -ih
    

    You will see inode usage for your partitions and mouting points:

    #dh -ih
    Filesystem                                    Inodes IUsed IFree IUse% Mounted on
    rootfs                                          120K  7.1K  112K    6% /
    udev                                            495K   356  495K    1% /dev
    tmpfs                                           497K   299  496K    1% /run
    /dev/mapper/vg-root                             120K  7.1K  112K    6% /
    tmpfs                                           497K     6  497K    1% /run/lock
    tmpfs                                           497K     2  497K    1% /run/shm
    /dev/sda1                                       122K   241  122K    1% /boot
    /dev/mapper/vg-usr                              179K   51K  129K   29% /usr
    /dev/mapper/vg-var                              242K  199K   43K   83% /var
    

    Here, we can easily see that /var is using 83% of inodes, which is quite high.

    Let’s now identify how those inodes are used with a compound command using find:

    find /var -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n

    You will get a sorted result like this (I truncated to display only the last lines which are the most important):

    #find /var -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
         52 /var/lib/ucf/cache
        106 /var/spool/exim4/input
        153 /var/log
        184 /var/log/apache2
        301 /var/lib/mibs/ietf
        319 /var/cache/apt/archives
       2289 /var/lib/dpkg/info
      10893 /var/spool/postfix/maildrop
    

    We can clearly see that inodes are mostly used by /var/spool/postfix/maildrop. You just have to go in that folder and check if files are useful and/or if you can do some cleaning there.
    Then, once files are removed and directory clean, your inodes will be freed and everything will be back to normal!

  • Calculate Database/Table size in MySQL

    MySQL is an open-source relational database management system (RDBMS) available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements.

    Thanks to some few functions, it’s possible to retrieve important information about database size and/or table size for a MySQL instance.

    Size for all databases

    SELECT table_schema "Database Name", SUM(data_length+index_length)/1024/1024
    "Database Size (MB)"  FROM information_schema.TABLES GROUP BY table_schema;
    +---------------------+--------------------+
    | Database Name       | Database Size (MB) |
    +---------------------+--------------------+
    | db_1                |       113.51562500 |
    | db_2                |       172.59375000 |
    | db_3                |        48.70312500 |
    | db_4                |      1830.53125000 |
    | db_5                |       432.89062500 |
    | information_schema  |         0.07812500 |
    | mysql               |         1.03164101 |
    | performance_schema  |         0.00000000 |
    +---------------------+--------------------+
    8 rows in set (0.41 sec)
    

    Size of tables for a specific database

    SELECT table_name "Table Name", table_rows "Rows Count", round(((data_length + index_length)/1024/1024),2) "Table Size (MB)" FROM information_schema.TABLES WHERE table_schema = "db_4";
    +-------------------------------+------------+-----------------+
    | Table Name                    | Rows Count | Table Size (MB) |
    +-------------------------------+------------+-----------------+
    | table_1                       |        245 |            0.05 |
    | table_2                       |          1 |            0.03 |
    | table_3                       |        537 |            0.11 |
    | table_4                       |          1 |            0.05 |
    | table_5                       |         57 |            0.05 |
    | table_6                       |          0 |            0.05 |
    | table_7                       |          2 |            0.05 |
    | table_8                       |        584 |            0.13 |
    | table_9                       |         48 |            0.03 |
    | table_10                      |      12972 |            2.16 |
    | table_11                      |        584 |            0.11 |
       [ ... ]
    | table_50                      |          0 |            0.05 |
    | table_51                      |     119864 |           16.03 |
    | table_52                      |     146688 |            9.55 |
    | table_53                      |         48 |            0.05 |
    | table_54                      |     852591 |          208.30 |
    | table_55                      |     138786 |           66.64 |
    | table_56                      |         47 |            0.08 |
    | table_57                      |        169 |            0.09 |
    | table_58                      |          0 |            0.03 |
    +-------------------------------+------------+-----------------+
    58 rows in set (0.00 sec)
    

    For a complete documentation, please refer to the official documentation on their website https://www.mysql.com

  • Skype group chat not working on linux

    With Linux version for Skype, it can happen that group conversation are not working as expected (conversations do not start, or updates are not working, or group members do not appear, …).

    You can check MSNP version you are using by typing this command in any conversation chat:

    /dumpmsnp
    

    If you are getting this message (“LoggedOut”), this means that you have the MSNP issue:

    System: MSNP: Connection Data:
     * Status: LoggedOut
    

    You can so enter in the chat:

    /msnp24
    

    Then, restart Skype.

    Once restarted, you can check again the MSNP version:

    /dumpmsnp
    

    You should now get “LoggedIn”:

    System: MSNP: Connection Data (MSNP24):
     * Status: LoggedIn
    

    Et voila, Skype will now work correctly 🙂Avec la version Linux de Skype, il arrive parfois que les conversations de groupe rencontrent des soucis (elles ne dĂ©marrent pas, ou les mises Ă  jour ne se font pas, ou les participants n’apparaissent pas, …).

    Vous pouvez vĂ©rifier la version de MSNP utilisĂ©e en tapant cette commande dans n’importe quelle conversation :

    /dumpmsnp
    

    Si vous obtenez ce message (“LoggedOut”), c’est que vous avez le problème de MSNP :

    System: MSNP: Connection Data:
     * Status: LoggedOut
    

    Vous pouvez alors taper :

    /msnp24
    

    Puis redémarrez votre Skype.

    Une fois redémarré, vous pouvez vérifier à nouveau la version de MSNP :

    /dumpmsnp
    

    Et vous devriez maintenant avoir “LoggedIn” :

    System: MSNP: Connection Data (MSNP24):
     * Status: LoggedIn
    

    Et voilà, Skype fonctionnera désormais correctement 🙂