Wednesday, August 19, 2009

Rsync To Transfer File under Linux

What could be achieved from the Document?




  • Transferring Files on Linux Platform (Tested with 1.5 TB of Data).
  • Admin Required to take Incremental Backups.
  • Want to keep Files Synced.


Tested on Fedora/Centos Linux Platforms (But Surely it works on all Distros)
Before Starting you should have xinetd working on your Linux Distro

Or get the Xinetd for your distro from
RPM.pbone
RPM.pbone1

Read More About Xinetd
XINETD

Now Lets Start .

What is Rsync ?

Rsync is a free software computer program for Unix and Linux like systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction.

Installing Rsync

How do I install Rsync?



Use one of the following commands to install Rsync.



If you are using Debian Based like Ubuntu Linux, Execute the following command



# apt-get install rsync
OR
$ sudo apt-get install rsync


If you are using Red Hat Enterprise Linux (RHEL) type the following command


# up2date rsync


If you are using CentOS/Fedora Core Linux, type the following command


# yum install rsync



Always use Rsync over ssh



Since Rsync does not provide any security while Transferring data it is recommended that you use rsync over ssh . This allows a secure remote connection.


You Can Find Some Good Example Here
Rsync Examples

Setting Up Rsync Server


You Need to Create or Edit Three File which would make you start Rsync server

  1. /etc/rsyncd.conf
  2. /etc/rsyncd.secrets
  3. /etc/xinet.d/rsync

Lets Get in Details of all this 3 files
1. Rsyncd.conf

max connections = 5
log file = /var/log/rsync.log
timeout = 300

[backup]
comment = Anything You would like to Notify
path = /your/real/path/to_the_directory
read only = yes
list = yes
uid = root
gid = root
use chroot = no
auth users = pub
secrets file = /etc/rsyncd.secrets


The above Files say maximum connection to the server will be 2, log file to write for debugging and information about the process, timeout is set to be 300
The Next [backup] tells what should be the canonical name to the directory we have shared in the above case it is given by "path = /your/real/path/to_the_directory" (It is Similar to Samba if you have Used)
read only = yes Permission to the Directory Shared is Given Read
auth users = pub Only this user have the permission to view the directory.
secrets file = /etc/rsyncd.secrets contains the usernames and passwords

2. Rsyncd.secrets
Contains the Usernames and Passwords colon " : " seperated
pub:pub

Now the Super daemon Xinetd need to handle the Rsync daemon so

# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}

Just Copy the Above code where disable should be no.
Restart Xinetd
/etc/init.d/xinetd restart

Hoooraaayyyy We have setup the server now Check it from any remote machine having rsync.

rsync rsync://pub@ipaddr

where pub = username in the rsyncd.conf with the password specified in rsyncd.secrets

Note : rsyncd.secrets file should have only read permission from root.

You Should get the listing here.

Reveal You Hard Disk Information from Command line


Want to know the Which Make, serial No, Model is your harddisk no need to open your system there are handy command line tools which can help you retrieve Disk Information


# smartctl -i /dev/sda


smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen


Home page is http://smartmontools.sourceforge.net/



=== START OF INFORMATION SECTION ===


Model Family: Seagate Barracuda 7200.10 family


Device Model: ST3160215AS


Serial Number: 6RA3TSBV


Firmware Version: 3.AAD


User Capacity: 160,040,803,840 bytes


Device is: In smartctl database [for details use: -P show]


ATA Version is: 7


ATA Standard is: Exact ATA specification draft version not indicated


Local Time is: Wed Aug 19 12:38:14 2009 IST


SMART support is: Available - device has SMART capability.


SMART support is: Enabled



METHOD 2


# ls /dev/disk/by-id


ata-ST3160215AS_6RA3TSBV ata-ST3160215AS_6RA3TSBV-part5 scsi-SATA_ST3160215AS_6RA3TSBV scsi-SATA_ST3160215AS_6RA3TSBV-part5


Where ST3160215AS is Model Number and 6RA3TSBV is the serial No.




# hdparm -i /dev/sda


/dev/sda:


Model=ST3160215AS , FwRev=3.AAD , SerialNo= 6RA3TSBV


Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }


RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4


BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=?16?


CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=312579695


IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}


PIO modes: pio0 pio1 pio2 pio3 pio4


DMA modes: mdma0 mdma1 mdma2


UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6


AdvancedPM=no WriteCache=enabled


Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7



Note : HDPARM will give you many details please check the man page for details



There are other tools but to use them you need to install them.


1. hwtools



$ hwinfo --disk
...
Model: "ST3160215AS"
Device: "ST3160215AS"
Revision: "3.AAD"
Serial ID: "6RA3TSBV"

Installing fonts on Linux

Are you a Graphic Designer or do lot of Graphic publishing work on GIMP (Gnu Image Manipulation Program) or any other program you would want many fonts to play with them.

It is surely and not difficult to install fonts on Linux Platform, you can say its as easy as installing on windows. It will take not more than 2-5 minutes if you just follow the below instructions. We are going to install TTF ( true type fonts ) on the system per user and global basis.

Obviously the best method and handy method in Linux is doing it from command line.

First search for the fonts you want to install on the system. Google out you will get a ocean of sites. Check it if you like download the font to your local system.

We'll start of the installation with Per User Installation

In this type of installation only the user who is targeted has the access to the fonts.

Steps

1. Download the Fonts to local system.

2. mkdir ~/.fonts (where ~ is the home directory of the user)

3. mv *ttf *TTF ~/.fonts

Thats it Now log out of your desktop environment and log back in. Check the fonts in GIMP or Openoffice applications

Global Installation

Installing fonts globally allows all users access to the fonts. This is not as simple as installing per-user but it is still simple. You sill have to download all of your fonts. Once you have them downloaded unzip the files (making sure all the *ttf and *TTF files are in the same directory) and su to the root user. Once you are the root user issue the following commands:


  • mkdir   -p /usr/local/share/fonts/ttfonts




  • mv *ttf *TTF /usr/local/share/fonts/ttfonts




  • cd   /usr/local/share/fonts/ttfonts




  • ttmkfdir   -o fonts.scale




  • mkfontdir




  • chkfontpath   –add /usr/local/share/fonts/ttfonts



  • /etc/rc.d/init.d/xfs   restart


Now log out of your desktop and you can log in as any user and the fonts will be available to them.

Game Over.

Tuesday, August 18, 2009

Welcome You Abroad.

Hi Guys,

Thanks for visiting my blog, Hoped it really Helped you. Please Comment.

Ashwin