Showing posts with label mount. Show all posts
Showing posts with label mount. Show all posts

Monday, December 30, 2013

Configure NFS server on CentOS 6.4

I use two physical machines to conduct this experiment.
NFS Server IP: 192.168.0.21
NFS Client IP: 192.168.0.27

Install NFS Server (CentOS 6.4)

$ yum install nfs-utils -y
$ service nfs start
$ chkconfig nfs on

Configure NFS Server

$ mkdir /nfs_dir
$ chmod 777 /nfs_dir
$ vim /etc/exports
add this line into the file
/nfs-dir 192.168.0.27(rw.sync,root_squash)

These settings accomplish several tasks:
  • rw: This option allows the client server to both read and write within the shared directory

  • sync: Sync confirms requests to the shared directory only once the changes have been committed.

  • no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.

  • no_root_squash: This phrase allows root to connect to the designated director

$ exportfs -a
$ exportfs 
$ showmount -e

You may want to flush the IP Tables to allow the NFS connection
$ iptables -L 
$ iptables -F

Configure NFS Client

$ mkdir /nfs_mnt
$ mount -t nfs 192.168.0.21:/nfs_dir /nfs_mnt

Or you can set the /etc/fstab file, and this line into the file
192.168.0.21:/nfs_dir  /nfs_mnt   nfs4     defaults,acl        1 1

Show mount list
$ mount
$ df -h

If you have an error message:
# mount -a
mount: wrong fs type, bad option, bad superblock on 172.31.27.164:/nfs_meerkats,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try

       dmesg | tail  or so

Solution: You need to install nfs-utils on the client side. Also, you need to service rpcbind start


Friday, November 22, 2013

mount NFS using /etc/fstab

First, you may need to authenticate the local machine to the NFS server.

Then,

Please add the following line to the end of your /etc/fstab:

NFS_SERVER:/vol/vol1_home    /home           nfs4    defaults        1 1

This is the format:
SERVERIP:REMOTE_FILE      LOCAL_FILE    FILE_FORMAT 


After this, do "mount -a" should get your home directory mounted.

Other commands about mount:
mount -a: mount all of the files in /etc/fstab
umount /home: unmount the local home direcotry from NFS server


Tuesday, November 29, 2011

/boot directory is full and remount another partition to /boot direcotry

Problem: /boot directory on /dev/hda1 is full, and no more space on disk
Solve: re-mount /dev/hda6 to /boot 

[root@centos5 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2             9.5G  7.7G  1.4G  86% /
/dev/hda6              23G  4.7G   17G  22% /home
/dev/hda3             1.9G   37M  1.8G   3% /tmp
/dev/hda1              90M  85M   5M 100% /boot

mount /dev/hda6 /boot


[root@centos5 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2             9.5G  7.7G  1.4G  86% /
/dev/hda6              23G  4.7G   17G  22% /home
/dev/hda3             1.9G   37M  1.8G   3% /tmp
/dev/hda1              23G  4.7G   17G  22% /boot
tmpfs                 251M     0  251M   0% /dev/shm
/dev/hda6              23G  4.7G   17G  22% /boot

Wednesday, December 15, 2010

Disk parition and mount

show all the partitions on hard disk
sudo fdisk -l


Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000db6bb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       18249   146585061   83  Linux
/dev/sda2           18250       36485   146480670   83  Linux
/dev/sda3           36486       54721   146480670   83  Linux
/dev/sda4           54722       60802    48839073    5  Extended
/dev/sda5           54722       55207     3903763+  82  Linux swap / Solaris
/dev/sda6           55208       60802    44935168   83  Linux

This is an example

For this hard disk. I only installed Debian on sda1. installed Ubuntu on sda6.
sda5 is the swap patition. I setted as logically.

I also partitioned sda2 and sda3. I set ext3 journaling format.
my previous blog has more detailed installation information.
I don't understand why sda4 came out. 

sda1 installed Debian
You could check OS version.

$ cd /mnt
$ sudo mkdir sda1
$ sudo mount /dev/sda1 sda1
$ cd sda1
$ cat /etc/lsb-release or /etc/redhat-release
e