Saturday, November 23, 2013

Backing up files and folders on same system or server in linux

In this post Iam describing how to take backup of folders and files in linux local system or server. Here I used Ubuntu Linux as OS.

Step 1:Deciding source and destination directories

Decide which folder or directory that should be backed up . This directory will become the source directory. The directory in which the source files or folders must be kept.This directory is the destination directory.

Step 2: Mounting the Disk or external drive 

If the backup is the total system backup which can be in large size or very important , it should be stored in external devices or other partitions or hard disks, it should be mounted.

In this description I used another partion named /dev/sdc6 for storing backup

I mounted this on  /media/diskc1 using  command

root@ubuntu:~# mkdir /media/disk1
root@ubuntu:~# mount /dev/sdb2 /media/disk1


Step3 : Creating Backup directory or folder 

For storing the backup I created a directory called Backup_01012013.By using the following command

root@ubuntu:~# mkdir /media/disk1/Backup_01012013
root@ubuntu:~# ls -l /media/disk1
total 20
drwxr-xr-x 2 root root  4096 2013-11-23 10:50 Backup_01012013
drwx------ 2 root root 16384 2013-11-12 08:23 lost+found


Step4 : Creating backup using "rsync" command

Here Iam backing up a folder named "impfolder" in the users root directory by uising "remote synchronize " command

root@ubuntu:~# rsync -zvr impfolder /media/disk1/Backup_01012013
sending incremental file list
impfolder/
impfolder/f1
impfolder/f2
impfolder/f3
impfolder/f4

sent 356 bytes  received 92 bytes  896.00 bytes/sec
total size is 285  speedup is 0.64



Step6: Checking the backup in the destination directory 

By using "ls" command from the directory /media/disk1/Backup_01012013/

root@ubuntu:~# ls -l /media/disk1/Backup_01012013/impfolder
total 16
-rw-r--r-- 1 root root  20 2013-11-24 04:38 f1
-rw-r--r-- 1 root root 155 2013-11-24 04:38 f2
-rw-r--r-- 1 root root  22 2013-11-24 04:38 f3
-rw-r--r-- 1 root root  88 2013-11-24 04:38 f4
 


No comments:

Post a Comment