Sunday, August 2, 2009

Samba Server on Centos HOWTO

TDB database
root: > smbd -b | grep PRIVATE_DIR
/etc/samba

root: >smbd -b | grep LOCKDIR
/var/cache/samba

use tdbbackup utility to backup those tdb files

mkdir a directory and change its ownship
chown account.group /path/to/directory

Samba Configruation File
root: >smbd -b | grep smb.conf
/etc/samba/smb.conf

Dry run Samba Configurations
root: >testparm /etc/samba/smb.conf
root: >smbclient -L xxx.xxx.xxx.xxx(SambaServerIP) -U%

Samba valid user setup
root: >smbpasswd -a csguest
New SMB password:
Retype new SMB password:
startsmbfilepwent_internal: file /etc/samba/smbpasswd did not exist. File successfully created.
Added user csguest.

chown user.group /path/to/sambashare

Run/start/stop/restart Samba Server
root: >service smb reload
root: >service smb start
root: >service smb stop
root: >service smb condrestart

Mount Samba Share in Linux
root: >apt-get install smbfs
root: >smbmount //SambaServerIP/SambaShare /mnt/Dir -o username=account, password=pwd

Access Samba Share in WindowsXP
Control Panel -> User Accounts -> yourUserAccount
Click Manage my network passwords
Add button to enter Server, User name and Password
Server: xxx.xxx.xxx.xxx(SambaServerIP)
Username: xxx.xxx.xxx.xxx\AccountName
Password:******

My Computer -> Tools -> Map Network Drive
Folder: //SambaServerIP/SambaShare

Friday, May 1, 2009

Centos: nilfs compiling from src

Download source:
2.6.18 centos kernel source code (kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm)
http://rpm.pbone.net/index.php3/stat/4/idpl/12390365/com/kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm.html
kernel module source code
http://www.nilfs.org/download/nilfs-2.0.12.tar.bz2
patch for Centos
http://www.nilfs.org/pub/centos/5/SRPMS/nilfs-kmod-2.0.12-r.src.rpm
userland utilities source code
http://www.nilfs.org/download/nilfs-utils-2.0.12.tar.bz2

Required packages:
gcc
yum install gcc
e2fsprogs-devel
yum install e2fsprogs-devel

default installed: make binutils

Installation Instructions:
I. use Centos rpm installer to unpackage the kernel source code
The source code will be in the directory :
/usr/src/kernels/2.6.18-128.1.6.el5-i686

2. untar the nilfs kernel module source code and userland utilities source code
kernel module is in the directory: nilfs-2.0.12
utilities is in the directory: nilfs-utils-2.0.12

3. uncompress the nilfs-kmod-2.0.12-r.src.rpm package and copy the patch file nilfs-rhel5-kern-feature.patch to the kernel module src directory nilfs-2.0.12
_______________________________________________________

--- a/fs/kern_feature.h 2008-02-12 08:38:22.000000000 -0000
+++ b/fs/kern_feature.h 2009-04-09 12:27:24.000000000 -0000
@@ -30,6 +30,25 @@
/*
* Please define as 0/1 here if you want to override
*/
+/* for Red Hat Enterprise Linux / CentOS 5.x */
+#if defined(RHEL_MAJOR) && (RHEL_MAJOR == 5)
+# define NEED_MOUNT_SEMAPHORE 1
+# define NEED_INODE_GENERIC_IP 0
+# define NEED_INODE_BLKSIZE 0
+# define HAVE_PAGE_MKWRITE 1
+# if (RHEL_MINOR < 1)
+# define PageChecked PageFsMisc
+# define SetPageChecked SetPageFsMisc
+# define ClearPageChecked ClearPageFsMisc
+# endif
+# if (RHEL_MINOR > 0)
+# define NEED_INC_NLINK 0
+# if (RHEL_MINOR > 2)
+# define NEED_DROP_NLINK 0
+# define HAVE_LE32_64_ADD_CPU 1
+# endif
+# endif
+#endif

/*
* defaults dependent to kernel versions
_______________________________________________________

4. apply the patch to the kernel module source code
root: ~> patch -p1 < nilfs-rehel-kern-feature.patch

5. compile the kernel module source code root: ~> make
root: ~> make install

6. compile the utils source code
root: ~> make
root: ~> make install

Userful resource:
http://www.nilfs.org/download/READMEv2
http://www.cyberciti.biz/faq/appy-patch-file-using-patch-command/
http://rpm.pbone.net/index.php3/stat/4/idpl/12390365/com/kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm.html
http://www.nilfs.org/en/faq.html
http://www.nilfs.org/en/pkg_centos.html

Tuesday, April 21, 2009

NilFS: tutorial

Nilfs is a LFS that NTT(Nippon Telegraph and Telephone Corp.) Group distributed to the Linux world. 

It has been merged into Linux mainline 2.6.30 rc-1

Below is the tutorial of how to set up a LFS partition in a VMware VM.

1. Attach multiple virtual disks to the VM in VMware

Editing virutal machine settings ->  add -> add a hard disk

 2. Install a CentOS5.1 distro in the VM and run the more than 260 updates 
(It is said CentOS5.1/5.2 are both OK. But CentOS5.0 needs to be patched.)

root : centos


3. Download the NilFS kmod and utils rpms from nilfs.org site.



Look for the nilfs utilities : nilfs-utils-2.0.12-1.i386.rpm 
Look for the exact kernel version 2.8.18_128 : kmod-nilfs-2.0.12-2.2.6.18_128.1.6.el5.i686.rpm

the utilities and the kernel module version should match the same nilfs version and also the centos kernel version.

(It also includes PAE and Xen rpm packages in the same directory)

4. Install the NilFS rpm package

root: ~>rpm -Uvh  kmod-nilfs-2.0.12-2.6.18_128.1.6.el5.i686.rpm

5. Format the virtual disk as nilFS and mount to the system.
(The extra disk is /dev/hda)

Format the disk by mkfs command
root: ~>mkfs -t nilfs2  /dev/hda
mount the LFS disk by mount command
root: ~>mount -t nilfs2   /dev/hda      /root/nilfs



6. Use the nilFS to recover the data

Before you make some changes, you can set a checkpoint by mkcp
root: ~>mkcp
root: ~>lscp   (lscp will show what checkpoints you have)


After you make the changes, you sjhould  make the previous checkpoint to be a snapshot and then mount that previous snapshot to a new spot
root: ~>chcp  ss  5
root: ~>mount -t  nilfs2 -r -0 cp=5   /dev/hda   /root/nilfs-cp

 



nilfs.org website instructions are at the link  http://www.nilfs.org/en/about_nilfs.html (how to use nilfs --incomplete)




7. Umount nilFS disk
root: ~>umount     /root/nilfs-cp
root: ~>umount    /root/nilfs

Next --> Setup NilFS in a Xen Guest



Monday, January 19, 2009

gcc linking error

Sympton:
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in \
/tmp/ccox5xu2.o
/lib/libc.so.6: could not read symbols: Bad value

Diagnosis:
Link error

Analysis:
/usr/include/unistd.h includes features.h which is using errno.h

So errno.h should be included.

Solution:
(Final)
#include before #include

(Temporary)
gcc -include /usr/include/errno.h code.c

Reference:
  1. http://www.robotercoding.com/blog/?p=36
  2. http://blog.chinaunix.net/u1/36607/showart_313647.html

Lab build

Ubuntu Hardy 8.04 LTS

Sun java
sudo apt-get install sun-java6-jdk - For the JDK (Developer)
sudo apt-get install sun-java6-jre - For the JRE (User)
sudo update-alternatives --config java

Acrobat Reader 8
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
sudo apt-get install acroread

emacs
sudo apt-get install emacsx
smart-compile tag
/usr/share/emacs/site-lisp/smart-compile.el