33dots

Posts RSS Comments RSS

Archive for the 'Linux' Category

Using Pidgin to connect to a google hosted chat for your domain

Google apps for chat allows us to chat to other google users using our own domain like tony@mydomain.com or you@yourdomain.com.

To do this, you have to register for google apps account using your domain name. Then login using using you@yourdomain.com as your user id in gtalk. Simple!
However, pidgin throws an error message if you try to create a new google talk account with you@yourdomain as the user id. Instead use the following settings,
Protocol: Google talk or XMPP
Username: your username without @yourdomain.com
Domain: yourdomain.com
Click on ‘Advanced‘ tab and enter ‘talk.google.com‘ in the Connect Server box. This does the trick!

No responses yet

Resized my root filesystem online

Wanted to increase the size of my root filesystem. I have my CentOS 5.3 in an LVM

[tony@localhost ~]$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/CentOsVG-RootLV
16G   11G  3.8G  75% /

Decided to use a less used NTFS partition. (i have a Linux/Windows multiboot system)

The steps i did,
1. Created a new Physical volume using the spare partition

[tony@localhost ~]$ su -
Password:
[root@localhost ~]# pvcreate /dev/sda8
Physical volume "/dev/sda8" successfully created

Use pvdisplay to see the newly created physical volume, if required.

2. Extended the Volume Group to include this physical volume.

[root@localhost ~]# vgextend CentOsVG /dev/sda8
Volume group "CentOsVG" successfully extended

3. Now, Enlarge the size of the Logical volume and then the filesystem.
I knew i have to use lvextend command, but got confused after reading the man pages, so finally decided to use the Graphical Utiliy. :-D
System > Administration > Logical Volume Management
Clicked on my volume group and then, the required logical volume and ‘Edit Properties‘.
Set the size to use the ‘Use Remaining‘ and Ok
The system prompted for enlarging file system size, and it was all over!

Later i figured out that i should have used the command,
lvextend /dev/CentOsVG/CentOsVG-RootLV /dev/sda8
or
lvextend /dev/CentOsVG/CentOsVG-RootLV/ -l +100%FREE

And perhaps increase the size of root filesystem by using resize2fs

Shouldn’t this require an umount of the /? And so use a ‘rescue environment’ or live CD?
No! Online increase of ext3 partitions are available from kernel 2.6.10

Finally checked the size of the root

[tony@localhost ~]$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/CentOsVG-RootLV
25G   11G   13G  47% /

No responses yet

The Linux File System basics

Each file in a Linux file system (eg, ext2, ext3) is described by an Inode, and every inode is identified by a unique number.
An Inode is a datastructure that describes the blocks of data the file occupies, as well as, metadata about the file like, the file’s owner and group owner, the file’s access permissions(eg rwx-r–r–), it’s size in bytes, timestamps telling when the file was created, last modified and last accessed and a count telling how many hard links point to the inode.
It should be noted that the filename is not stored in the inode.

A File’s name along with it’s inode number are stored in special files called directories. In other words, a directory is just another file, which is treated specially by the linux, and it contains a list of filenames along with their inode numbers. All these list of files are assumed to be contained within that directory.

Use ls -i to see the inode numbers of files and directorys .

[tony@localhost ~]$ ls -ila
total 820
65538 drwx-----x 57 tony tony    4096 Feb 22 12:18 .
65537 drwxr-xr-x  4 root root    4096 Jul  6  2009 ..
65997 drwx------  3 tony tony    4096 Jul  1  2009  adobe
66027 -rw-rw-r--  1 tony tony     352 Feb 18 21:56 .aspell.en.prepl

All the inodes of a file system are created at the moment we format the disk (eg, when we use mkfs command). Thus, the maximum number of inodes (and so the maximum number of files) that the filesystem can have, is determined during the filesystem’s creation itself.
These inodes are all kept together in inode tables towards the beginning of the partition. The inode tables usually occupy about 1% of the partition’s space when using the default settings.
The decision as to how many inodes to create is made on Linux using an algorithm. The default setting creates an inode for every 2K bytes contained in the filesystem, but the number can be adjusted by the user when creating the filesystem. For example, it can be wise to create fewer inodes when setting up a filesystem that will contain just a few large files.

It should be noted that, there are two ways in which a filesystem can run out of space: it can consume all the space for adding new data (i.e., to existing files or to new files), or it can use up all the available inodes even when space is left for adding data.
Use the command df -i to see the number of inodes available, used and free.

[tony@localhost ~]$ df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/CentOsVG-RootLV
4161536  155678 4005858    4% /
/dev/sda9              26104      40   26064    1% /boot

Whenever a file is created, the kernel assigns a free inode to that file. The inode is updated to reflect the details of the file. The file’s name, along with that free inode’s number, is written to the directory, the file is supposed to be in.

Hard links and Symbolic links

Hard links are different filenames that point to same inode number (in essence to the same file).
A soft link or symbolic link is a file whose data contains the ‘path’ (eg, /home/tony/resume.txt) of another file(its target).

Since inode numbers are unique only within a filesystem, hard links cannot span across partitions or different filesystems. Where as softlinks can be to anywhere as long as a valid path is there to its target.

[tony@localhost test]$ echo "this is just some contents" > mytestfile  //create a file
[tony@localhost test]$ ln mytestfile myhardlink              //create a hardlink
[tony@localhost test]$ ln -s mytestfile mysoftlink           //create a softlink
[tony@localhost test]$ ls -li
total 8
2687664 -rw-rw-r-- 2 tony tony 27 Feb 22 14:59 myhardlink
2687665 lrwxrwxrwx 1 tony tony 10 Feb 22 14:58 mysoftlink -> mytestfile
2687664 -rw-rw-r-- 2 tony tony 27 Feb 22 14:59 mytestfile

Note in the above shell dialogue that the hardlink and the original file has the same inode number, and the same size.
The soft link has different inode number and of different size, obviously as it is another file whose data has the path to ‘mytestfile

Virtual File System

On top of the underlying filesystem, the linux maintains a Virtual FileSystem (VFS). The VFS is an interface for the operating system, system services, and programs to the underlying filesystem.
VFS allows Linux to support many, often very different, file systems, each presenting a common software interface to the VFS. All of the details of the underlying file systems are translated by VFS so that all file systems appear identical to the rest of the Linux kernel and to programs running in the system.
Each filesystem type supported by your VFS will have an associated driver routines loaded in to the kernel.
Linux’s Virtual File system layer allows you to transparently mount the many different file systems at the same time.

The /proc File System

The /proc file system really shows the power of the Linux Virtual File System. It does not really exist; neither the /proc directory nor its subdirectories and its files actually exist.
The /proc file system, like a real file system, registers itself with the Virtual File System. However, when the VFS makes calls to it requesting inodes as its files and directories are opened, the /proc file system creates those files and directories from information within the kernel.
For example, the kernel’s /proc/devices file is generated from the kernel’s data structures describing its devices.
The /proc file system presents a user readable window into the kernel’s inner workings.

References
http://tldp.org/LDP/tlk/fs/filesystem.html
http://www.linfo.org/inode.html

No responses yet

rar archive support in Cent OS 5

.rar archive is not available in linux by default, but it can be installed by the command

[root@localhost ~]# yum install unrar

This allows you to extract rar files using the command

[tony@localhost ~]# unrar e myfile.rar

The e parameter tells the unrar to extract. More details can be found in man unrar

Now In Gnome, You could right click on the file and click Extract here.

No responses yet

Installing phpMyAdmin in my Cent OS 5.3

I did this by yum, which i think is the easiest way.

[root@localhost ~]# yum install phpmyadmin

This will install it in /usr/share/phpmyadmin

Now, configure it by editing config.inc.php

[root@localhost html]# gedit /usr/share/phpmyadmin/config.inc.php 

add the blowfish secret,
$cfg['blowfish_secret'] = 'a8b7dafdferHJHJ^&U^45776TIUuiYc6d';

and i also changed to mysqli in,
$cfg['Servers'][$i]['extension'] = 'mysqli';

Now you could access the phpMyAdmin by,
http://127.0.0.1/phpmyadmin/

This is possible because an alias is created for apache to the directory where phpMyAdmin in installed [ie /usr/share/phpmyadmin]. This is done in the file,

[tony@localhost ~]$ gedit /etc/httpd/conf.d/phpmyadmin.conf

You will see a lines like,
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

————-

You could also install phpMyAdmin manually by downloading phpMyAdmin.
Make sure you download the version 2.xx and not 3.xx[requires PHP 5.2] as Cent OS 5.3 has only PHP 5.1 by default

Extract the tar.gz file to your desktop.

Copy it to /var/www/html/phpmyadmin as root,

[root@localhost ~]# mv /home/tony/Desktop/phpMyAdmin-3.2.1-all-languages /var/www/html/phpmyadmin

Give the appropriate permission for apache,
Set owner as apache

[root@localhost html]# chown apache -R /var/www/html/phpmyadmin/

Set the group owner as your user, this is good as you can edit the files easily,

[root@localhost html]# chgrp tony -R /var/www/html/phpmyadmin/

Now give group user the write permission

[root@localhost html]# chmod g+w -R /var/www/html/phpmyadmin/

Now, add the blowfish secret and mysqli extension as above,

Thats all.

12 responses so far

Next »