Tuesday, November 22, 2011

Unable to delete files with full disk quota on ZFS


Problem
When I was removing old build logs and source from my ZFS file serever to create for fresh builds, i tried removing old bits.
bash# rm gmake-optimize-domestic.log.1

rm: cannot remove file `gmake-optimize-domestic.log.1': Disk quota exceeded
Solution
You will need to copy /dev/null into file that is taking up space.
Example:
bash# ls -la
drwxr-xr-x   2 svbld    staff          8 Sep 26  2010 ./
drwxr-xr-x   3 svbld    staff          3 Sep 24  2010 ../
-rw-r--r--   1 svbld    staff       2707 Sep 26  2010 20100924.1.rep.1
-rw-r--r--   1 svbld    staff    1748129 Sep 24  2010 cvs-get.log.1
-rw-r--r--   1 svbld    staff        388 Sep 26  2010 email-mailx.log.1
-rw-r--r--   1 svbld    staff    3593895 Sep 26  2010 gmake-optimize-domestic.log.1
-rw-r--r--   1 svbld    staff      40709 Sep 24  2010 rt.log.1
-rw-r--r--   1 svbld    staff      43369 Sep 24  2010 sour.conf
bash# cp /dev/null gmake-optimize-domestic.log.1
bash#ls -la
total 10943
drwxr-xr-x   2 svbld    staff          8 Sep 26  2010 ./
drwxr-xr-x   3 svbld    staff          3 Sep 24  2010 ../
-rw-r--r--   1 svbld    staff       2707 Sep 26  2010 20100924.1.rep.1
-rw-r--r--   1 svbld    staff    1748129 Sep 24  2010 cvs-get.log.1
-rw-r--r--   1 svbld    staff        388 Sep 26  2010 email-mailx.log.1
-rw-r--r--   1 svbld    staff          0 Nov 22  2011 gmake-optimize-domestic.log.1
-rw-r--r--   1 svbld    staff      40709 Sep 24  2010 rt.log.1
-rw-r--r--   1 svbld    staff      43369 Sep 24  2010 sour.conf
bash# rm gmake-optimize-domestic.log.1
bash# ls -lah gmake-optimize-domestic.log.1
/bin/ls: gmake-optimize-domestic.log.1: No such file or directory

As you can see, the file is 3593895 KBs in size, I then make the file zero bytes, and then I'm able to remove it. Once enough files have been removed in this manner, you should be able to use the rm command again.
What causes this?
This is due to how ZFS functions. ZFS is a Copy On Write filesystem, so a file deletion actually takes slightly more space on disk before a file is actually deleted, as it writes the metadata involved with the file deletion before it removes the allocation for the file being deleted. This is how ZFS is able to always be consistent on disk, even in the event of a crash.

Monday, November 21, 2011

Enabling Telnet and FTP services in RHEL and Solaris

This was the problem I use to face whenever a new build machine had to be configured.

Following steps were taken to configure FTp on Linux and Solaris boxes.
Linux is configured to run the Telnet and FTP server, but by default, these services are not enabled. To enable the telnet service, login to the server as the root user account and run the following commands:
# chkconfig telnet on
# service xinetd reload
Reloading configuration: [  OK  ]
Starting with the Red Hat Enterprise Linux 3.0 release (and in CentOS Enterprise Linux), the FTP server (wu-ftpd) is no longer available with xinetd. It has been replaced with vsftp and can be started from /etc/init.d/vsftpd as in the following:
# /etc/init.d/vsftpd start
Starting vsftpd for vsftpd:         [ OK ]
If you want the vsftpd service to start and stop when recycling (rebooting) the machine, you can create the following symbolic links:
# ln -s /etc/init.d/vsftpd /etc/rc3.d/S56vsftpd
# ln -s /etc/init.d/vsftpd /etc/rc4.d/S56vsftpd
# ln -s /etc/init.d/vsftpd /etc/rc5.d/S56vsftpd


On Solaris Sparc:
#vi /etc/services - uncomment
-> ftp 21/tcp
#vi /etc/inetd.conf - uncomment
-> ftp stream tcp nowail root /usr/sbin/in.ftpd in.ftpd
# vi /etc/ftpd/ftpuser - to uncomment "root" out
-> # root
#vi /etc/shells - put in all the shell as possible
-> /usr/sbin/ksh
#vi /etc/default/login - to uncomment
-> CONSOLE=/dev/console
check ftp.allow and ftp.deny files as well
#kill -HUP pid - to restart #/usr/sbin/inetd -s

Setting passswd on RHEL

I was trying to reset the password on the newly installed build machine.

I logged in as root and tried changing the password.

when I did passwd<use-name>
A error was to pop-up saying:
"passwd: Authentication token manipulation error"

After lot of googling I came to know that the command passwd was trying to update the nis password for the user-name, who never was a NIS user.

The worksaround for this issue:
comment out passwd and group lines in ./etc/nsswitch.conf file.
for the changes to take affect run pwconv command.

Its better to make a copy of original file before inflicting any changes in the system files.

Now try changing the passwd, it should go through fine.