0% found this document useful (0 votes)
87 views6 pages

MY Designprblm

The document describes a shell script that automatically backs up files from a hard disk to an external hard disk drive. It creates a directory structure on the external drive organized by file extension to back up text, PDF, document, audio and video files. The script recursively searches through file locations, copies matching files to the external drive under the appropriate extension-named subdirectory. The document also provides background on backups, and includes sample inputs, outputs and limitations of the script.

Uploaded by

Sandeep Kaur
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views6 pages

MY Designprblm

The document describes a shell script that automatically backs up files from a hard disk to an external hard disk drive. It creates a directory structure on the external drive organized by file extension to back up text, PDF, document, audio and video files. The script recursively searches through file locations, copies matching files to the external drive under the appropriate extension-named subdirectory. The document also provides background on backups, and includes sample inputs, outputs and limitations of the script.

Uploaded by

Sandeep Kaur
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

TITLE A Design Problem

MAKING BACKUP OF FILES IN EXTERNAL HARD DISK

Submitted By: Emmanuel Raj(K1R14 B37) (Regd no-11008778) Submitted To: Mr.Pushpendra kumar Petriya

PROBLEM STATEMENT
Whenever I format my system, I take backup of my HDD in my external HDD. After installationt it becomes a tedious task to manage all the files in a proper manner. I just want to write a Shell script which creates a backup of all my files inside an external USB drive in a structured manner. Structure: Backup txt pdf doc avi mpeg ... ... etc... 1. Script should create a directory named as BACKUP inside the external HDD. 2. Inside the BACKUP directory it will start creating more directories according to the file extentions. 3. Backup of all the files will be created according to the extension of file.

PRE-REQUISITE KNOWLEDGE
Backup is the activity of copying files or databases so that they will be preserved in case of equipment failure or other catastrophe. Backup is usually a routine part of the operation of large businesses with mainframes as well as the administrators of smaller business computers. For personal computer users, backup is also necessary but often neglected. The retrieval of files you backed up is called restoring them. Personal computer users can consider both local backup and Internet backup. Local Backup These are some options, with the least expensive approach listed first.

Backing up critical files to diskettes. This approach is commonly used by people who keep their checkbooks and personal finance data on the computer. Programs like Quicken and Managing Your Money always remind users when they quit the program to backup their data. If your hard disk crashes, you'll be able to reconstruct your checkbook balances. If you have other files (for example, chapters of a book you're working on), you'll want to backup every single day's work. Copying it to a diskette is quick and economical. Backing up to a Zip drive, Jaz, Syquest, or similar hard disks. Once a week or so, you should back up your files (at least your own data files and perhaps the entire contents of your hard drive) to an alternative storage device, such as a Zip drive. These devices hold at least one million bytes on a special hard disk. Backing up usually takes a while (about 45 minutes for the contents of a 500 megabyte hard disk).

There are also easily removable drives that you can back up to, especially if you have other reasons to use these (for example, for large graphic images that you store offline).

Internet Backup You can also consider sending your files to another site for safekeeping. In case your hard disk crashes, you'll be able to download them from the safekeeping site. These are some products and services that are offered:

Atrieva provides the user with a client program that allows the user to send files being backed up to an Atrieva-designated backup site. One monthly charge entitles you to back up up to 25 megabytes. BackupNet sells both a server and a client and is aimed at helping you set up your own intranet. QuickBackup is a client program from McAfee Associates. They have a modest charge for the client and a relatively low monthly charge for storing 30 MB. QuickBackup lets you save by folder or file types.

3.1(ALGORITHM)
1.START 2. enter the name of file 3.search through all the locations (recur() ) 4.finding the file. 5.copy the file from the location 6.Copy it to external HDD 7.END

3.2(SOURCE CODE)
This is "designproblem.sh"(This makes backup files in our specified location below) recur() { cd "$1" for trav in "*" do if [ -d $trav ] then recur $1/trav cd .. else Udp=$(echo ${trav}|awk -F\. '{print $2}')

mkdir -p /home/emmanuel/backup/$udp/ cp $trav /home/emmanuel/backup/$udp/ fi done }

echo enter directory read direct recur $direct

Now to Make backup files in external drive we need to mount our external drive to do this we hav to follow the below steps:

emmanuel@ubuntu:~$ sudo mkdir /mnt/extdisk [sudo] password for emmanuel: emmanuel@ubuntu:~$ ls /mnt/ dvd extdisk usb win Now we can mount the external hard drive with Linux mount command: emmanuel@ubuntu:~$ sudo mount /dev/sdb /mnt/extdisk/ mount: you must specify the filesystem type The external hard drive cannot be mounted. This happened when we mount a windows formatted external hard drive. We must specify the filesystem. Windows filesystem format is known as nsfs3g in Linux. So we mount the external hard drive again with the complete command: emmanuel@ubuntu:~$ sudo mount -t ntfs-3g /dev/sdb /mnt/extdisk/ NTFS signature is missing. Failed to mount '/dev/sdb': Invalid argument The device '/dev/sdb' doesn't have a valid NTFS. Maybe you selected the wrong device? Or the whole disk instead of a partition (e.g. /dev/hda, not /dev/hda1)? Or the other way around? We still cannot mount the external hard drive. Again, we mount the external hard drive but this we change the device name from /dev/sdb to /dev/sdb1 as suggested by Ubuntu message above. emmanuel@ubuntu:~$ sudo mount -t ntfs-3g /dev/sdb1 /mnt/extdisk/

emmanuel@ubuntu:~$ ls /mnt/extdisk/ ghost dell170l ghost mimos RECYCLER System Volume Information emmanuel@ubuntu:~$ We successfully mounted the external hard drive this time. Now that the external drive has been mounted, we can use it as other directory in Ubuntu. To unmount the external hard drive, we can use the Linux umount command like in the example below: emmanuel@ubuntu:~$ sudo umount /mnt/extdisk/ [sudo] password for emmanuel: emmanuel@ubuntu:~$

SAMPLE INPUT Assume file named Downloads is in "/home/emmanuel/Downloads" contains a Doc file then ENTER THE DIRECTORY: Downloads

SAMPLE OUTPUT Now go to external drive and trace a directory named "Backup" open and you will find directory called "Doc" open it you will find your file which is backup of original file. ex: Downloads has tp1.doc then a back up is created in external drive in path "/Backup/Doc/tp1.doc"

LIMITATIONS

This scripting can only create a backup of the following files: txt,sh,doc,pdf,mp3 and mpeg

CONCLUSION
This was a great learning for making backup files and this will successfully create the backup before formating the system.

References
1.www.sourcecode.com 2.www.youtube.com(Videos) 3. Beginning Linux Programming, 3rd Ed Neil Matthew and Richard Stones 4. Sams' Teach Yourself Linux In 24 Hours 5.www.bing.com

You might also like