≡ Menu

redhat linux

Linux: Set Environment Variable

Bash shell is used for various purposes under Linux. How do I customize the shell environment variable under Linux operating systems?
[click to continue…]

How do I check the ram size from my Redhat Linux desktop system using command line and GUI tools? How do I find out memory size on Red Hat Enterprise Linux server?
[click to continue…]

HowTo: Find Out MySQL Server Version Number

How do I find out mysql server version number under UNIX / Linux operating systems?
[click to continue…]

Q. How can I backup Fedora / CentOS / Redhat Linux Directory server database?

A. You can back up your databases from the command-line using the db2bak command-line script. This script works when the server is running or when the server is stopped. Run script as follows:
# ./db2bak
OR
# /path/to/installed-directory/db2bak

The db2back script will create a backup folder with a format of year_month_day__hour (YYYY_MM_DD_hh_mm_ss). The backup folder will contain the exported LDIF files and other Berkeley databases (.db4 files).

Restore backup

First stop server:
#./stop-slapd

Next restore the backup database. For example:
#./bak2db /path/to/bak/2007_02_02_01_02_12/

Again start the Red Hat Directory Server:
# ./start-nslapd

References:

=> Populating Directory Databases - Red Hat Directory Server

Q. How do I access NAS server using NFS? I am using Redhat Linux (RHEL).

NFS (Network File System) is a protocol originally developed by Sun Microsystems.

NFS used by UNIX and Linux oses as a distributed file system which allows a computer/server/workstation to access files over a network.

NFS is a popular file-sharing protocol for Linux and UNIX. NAS (Network attached storage) also supports NFS configuration.

Linux NFS service

In order to use NFS you need to run portmap service and rpc.statd and rpc.lockd daemons. Use following commands to start these services (RedHat/Fedora Linux):
# chkconfig portmap on
# chkconfig nfslock on
# /etc/init.d/portmap start
# /etc/init.d/nfslock start
Assuming that NAS is configured properly you need to type following command to access NAS (please refer our sample configuration diagram):# mkdir /backup
# mount -o tcp 202.54.20.111:/mountpoint /backup
Linux supports UDP by default and TCP as an option. TCP may improve performance in some cases (as a side effect it may increase the CPU load on the local server). If you want to use UDP just type following command:# mount 202.54.20.111:/mount/point /backupYou can also mount NFS share by editing /etc/fstab file:# vi /etc/fstabAppend following line:202.54.20.111:/mountpoint /backup nfs defaults 0 0Save the file and exit to shell prompt.Try to pass following values to mount command improve NFS performance:# mount -t nfs -o nocto, rsize=32768,wsize=32768 202.54.20.111:/mountpoint /backupWhere,

  • rsize=32768,wsize=32768:This will make your nfs connection faster than with the default buffer size of 4096. risze is read size and wsize is write size.
  • nocto : Suppress the retrieval of new attributes when creating a file.

There are few more options supported to tweak NFS please consult man page of nfs.

A note for FreeBSD users

NFS configuration is a relatively straightforward, all you need to do is open /etc/rc.conf and put following line (FreeBSD client system):# vi /etc/rc.confAppend following line:nfs_client_enable="YES"Save the file and use mount command as follows:
# /etc/init.d/nfsclient start
# mkdir /backup
# mount 202.54.20.111:/mountpoint /backup
There are few options supported to tweak NFS client under FreeBSD please consult man page of nfs/mount for more information.
See also: