Jun 16

How to mount windows directory to Centos 5.3

CentOS Comments Off on How to mount windows directory to Centos 5.3

For CentOS that also using windows as their dual boot OS must have diffilcuties to see or mount windows on their CentOS directory, at least it happen with one of my friend and here is the solution.

First you need to check the windows partition first

# fdisk -l
Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 3187 25599546 7 HPFS/NTFS
/dev/hda2 3188 4865 13478535 83 Linux
Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 4865 39078081 7 HPFS/NTFS

as you can see windows partition located on /dev/hda1 ( program files , windows etc) and /dev/hdb1 (data)

Now installed the required packages

yum install fuse fuse-ntfs-3g dkms dkms-fuse
(dkms and dkms-fuse install the fuse kernel module)

If the rpmforge repo is disabled by default,
# yum --enablerepo=rpmforge install fuse fuse-ntfs-3g dkms dkms-fuse

Mounting windows NTFS filesystem

First, create a mount point.

mkdir /mounting/win

Next, edit /etc/fstab as follows. To mount read-only:

/dev/hda1 /mounting/win ntfs-3g ro,umask=0222,defaults 0 0
/dev/hdb1 /mounting/win1 ntfs-3g ro,umask=0222,defaults 0 0

To mount read-write:

/dev/hda1 /mounting/win ntfs-3g rw,umask=0000,defaults 0 0
/dev/hdb1 /mounting/win1 ntfs-3g rw,umask=0000,defaults 0 0

You can now mount it by running:

#mount /mounting/win
# mount /mounting/win1

Common Error
When you try to mount you will see this error

# mount /mymnt/win
FATAL: Module fuse not found.
ntfs-3g-mount: fuse device is missing, try 'modprobe fuse' as root

and when you try to run modprove fuse you will get this error
# modprobe fuse
FATAL: Module fuse not found.

Solution :
The error could be cause by the kernel dependecies problem here you should do

Lets just check which kernel packages you have installed and which kernel you are currently running.
# uname -a
Linux cahpct 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686 i686 i386 GNU/Linux

then use depmod (handle dependency descriptions for loadable kernel modules )

# depmod -a 2.6.18-128.el5

Then reboot the machine and select the 2.6.18-53.1.21.el5 kernel from the list available( if you don’t see it , it’s usually use the default 2.6.18-53.1.21.el5 kernel)
# reboot

then run modprobe fuse again and mount it:

# modprobe fuse dan mount
# mount -t ntfs-3g /dev/hdb1 /mymnt/win1
# mount -t ntfs-3g /dev/hda1 /mymnt/win

or

#mount /mounting/win
# mount /mounting/win1

Jun 13

How to create nfs server (ubuntu) and nfs client (centos) client

CentOS Comments Off on How to create nfs server (ubuntu) and nfs client (centos) client

This article was base on the need of higher storage. Recently i need to divide my web (centos 5.3) and mysql server(Ubuntu 8.04.2) and since mysql server need a higher spec ( high hdd capacity) i set the web server on slightly lower spec server with lower hdd size and memory somekind of “virtual” hard-disk . And therewere a question on my mind how to use the Mysql server high hdd  capacity on my web server , i think of mapping on windows OS okay so i need a mounting between server right ? and after some searching i found NFS.

What is NFS ?

NFS stands for Network File System, a file system developed by Sun Microsystems, Inc. It is a client/server system that allows users to access files across a network and treat them as if they resided in a local file directory. For example, if you were using a computer linked to a second computer via NFS, you could access files on the second computer as if they resided in a directory on the first computer. This is accomplished through the processes of exporting (the process by which an NFS server provides remote clients with access to its files) and mounting (the process by which file systems are made available to the operating system and the user).

NFS Advantages

• Local workstations use less disk space because commonly used data can be stored on a single machine and still remain accessible to others over the network.

• There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.

• Storage devices such as floppy disks, CDROM drives, and Zip® drives can be used by other machines on the network. This may reduce the number of removable media drives throughout the network.

User Permissions

NFS user permissions are based on user ID (UID). UIDs of any users on the client must match those on the server in order for the users to have access. The typical ways of doing this are:

  • Manual password file synchronization
  • Use of LDAP

  • Use of NIS

It’s also important to note that you have to be careful on systems where the main user has root access – that user can change UID’s on the system to allow themselves access to anyone’s files. This page assumes that the administrative team is the only group with root access and that they are all trusted. Anything else represents a more advanced configuration, and will not be addressed here.

My Spec

Okay on NFS you need to set NFS server and NFS client and here is my spec:

– NFS Server

+ Ubuntu 8.04.2

+ ip address : 10.21.0.220

– NFS Client

+ Centos 5.3

+ ip address: 10.21.0.221

Installation

NFS Server

1 .Install NFS Server

# sudo apt-get install portmap nfs-kernel-server

2. Config the exports files on /etc/exports

# vi /etc/exports
and add this
/root/tes 10.21.0.221(rw,fsid=0,insecure,no_subtree_check)

/root/tes was my files directory on NFS server(ubuntu 8.0.2) that i want to mount

–  10.21.0.221 was the NFS client ip address that i want to allow on NFS server

– rw : Allow clients to read as well as write access

– The “fsid=0” option tells the server to use the NFSv4 pseudofilesystem.

– insecure : Tells the NFS server to use unpriveledged ports (ports > 1024).

– no_subtree_check : If the entire volume (/users) is exported, disabling this check will speed up transfers.

if you want to allow all to access the NFS share you add this on /etc/exports

/root/tes *(rw,fsid=0,insecure,no_subtree_check)
for another example and option you may refer to http://linux.die.net/man/5/exports

Restart the nfs server

#/etc/init.d/nfs-kernel-server restart

If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command

# exportfs -a

To see the NFS share path and ip you can also use

# exportfs
# showmount -e

To check if NFS have already working or not on your system you can also use this command
# rpcinfo -p

NFS Client (CentOS)

1. Please maksure you have nfs installed on your client server,nfs -utils by default are installed on centOS 5.3

# rpm -qa | grep nfs

nfs-utils-lib-1.0.8-7.2.z2

nfs-utils-1.0.9-40.el5

2. Create the folder you want to mount and do the mount

# mkdir /root/testing

# mount -t nfs 10.21.0.220:/root/tes /root/testing
3. now you can check it
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
71G 1.4G 66G 3% /
/dev/sda1 99M 18M 77M 19% /boot
tmpfs 506M 0 506M 0% /dev/shm
10.21.0.220:/root/tes
584G 15G 540G 3% /root/tes