Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 12-08-2003, 01:54 AM   #1
Registered: Feb 2003
Distribution: redhat
Posts: 58

Rep: Reputation: 15
Help for formatting external hdd !!


I got a new external hard disk, 160 GB, connected through USB !! The main purpose of this is to backup my data...

First, I dont know how to format this hard drive.

When I connected it to my computer (running RHL 7.3) it is recognized and shows up as /dev/sda5

Now.. I want to know how do I format this external hard drive because it has been formatted using windows, when I bought !!

And when I do

> /sbin/fdisk -l /dev/sda

I get

> Cannot open /dev/sda

So.. Could someone please help me set up this hard drive and then set up the backup process too !!

Maybe I can do with help on setting up the hard drive first !!!

-- Sudhir
Old 12-08-2003, 02:00 AM   #2
Registered: Feb 2003
Distribution: redhat
Posts: 58

Original Poster
Rep: Reputation: 15
And one more note...

When I opened the "hardware browser", I saw the following, among other things....

- /dev/sda
|-sda5 2 19457 152617 FAT

the number columns being start > end > Size > Type

So in the Type column I see "FAT" ... Does this mean the external hdd I got already has a FAT partition ?? In that case, Linux does indeed recognise and work well with FAT partition right ???

Sorry if my questions are elementary... but I am not familiar with such details in linux !!

Please help me people !!!

-- Sudhir
Old 12-08-2003, 06:43 AM   #3
Registered: Feb 2003
Distribution: redhat
Posts: 58

Original Poster
Rep: Reputation: 15
Hi People

I could manage to partition the hdd using the mkfs command... I read the man pages and got done with it..

What I need to know now is how to set up the the backup facility in crontab!!

Could anyone guide me with regarding to writing a script or something to put in the crontab.daily ?? or is there any place where I can take a look at examples ??

Looking forward to your help !!

-- Sudhir
Old 12-11-2003, 02:08 PM   #4
LQ Newbie
Registered: Dec 2003
Posts: 1

Rep: Reputation: 0
Sudhir here is my backup script, I am pulling from a remote drive to a local,but the principal for a usb drive would be the same idea. Just change the rsync line to /hdba1 /mnt/whateveryoucallyourexternaldrive. Also remove the ssh entry as you arent connecting to another machine. Check the man page for specifics on the flags you will want to use.


echo "<RSYNC @`date`>" >> /var/log/rsync.log
rsync -ave ssh chronos:/export/ /mnt/hdb1/ >> /var/log/rsync.log 2>&1
echo "</RSYNC @`date`>" >> /var/log/rsync.log

exit $RETVAL

save it to /usr/local/bin as

to setup the cron job> crontab -e
write an entry something like this
0 18 * * 1-6 /usr/local/bin/
I tend to mess this up when writing cron jobs, it's supposed to translate as: at 6pm monday-saturday run which is in /usr/local/bin

Hope this gets you started.
Old 12-11-2003, 11:30 PM   #5
Registered: Feb 2003
Distribution: redhat
Posts: 58

Original Poster
Rep: Reputation: 15
Hi Trogers..

Thanks a lot for ur message..

I got some info on using tar for the backup and I set it up... It has been working well for the past coupla days. What I did was write scripts for a daily incremental backup and a weekly full backup.. and automated this with crontab....

Anyway thanks for ur info pal.. I got rsync downloaded but din set it up coz I was able to set up the one with tar...

Thanks again !!

NOTE.. For others who might be wanting to do something like this and dont know how to do it (like I was a coupla days back... ... ) Here is my script.... Hope this and the one with rsync posted by Trogers shud help you all !!

** This is for a Daily Incremental Backup !!!

LastBackupTime=`cat /mnt/usd1/Last.txt`
tar czv --newer-mtime $LastBackupTime -f /mnt/usd1/`date '+%w'`.tgz /<dir you want to backup>
echo `date '+%Y-%m-%d'` > /mnt/usd1/Last.txt

Put this in /etc/cron.daily/<file name>... and make it executable !!!

** This one is for a Weekly Full Backup !!!

mv /mnt/usd1/Full.tgz /mnt/usd1/Full.tgz.old
tar zcvf /mnt/usd1/Full.tgz /<dir you want to backup>
rm /mnt/usd1/Full.tgz.old
rm /mnt/usd1/0.tgz
rm /mnt/usd1/1.tgz
rm /mnt/usd1/2.tgz
rm /mnt/usd1/3.tgz
rm /mnt/usd1/4.tgz
rm /mnt/usd1/5.tgz
rm /mnt/usd1/6.tgz

Put this in /etc/cron.weekly/<file name> ... again make this one executable too...

What I have done is set up a daily incremental backup which will dump files like 0.tgz, 1.tgz......6.tgz
(0 being Sunday...)

And in the weekly full backup, I have made the previous week' full backup to be renamed and then the current week' full backup happens... and after this, the previous week' daily backup files and the full back files are removed ... This rountine is called rotation I think (thats wat I learnt fromthe websites) This is primarily done to save space on the external HDD...

And finally edited the /etc/crontab.... Actually there is no need to edit it if U have something like run-parts in the crontab file with separate daily, weekly, hourly or monthly sections....

So I just edited the crontab files with regard to the time... thats all !!!

And this has been doing the job well !!! Hope this helps !!!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bootable partion on external HDD? 40 gb firelight hdd. Trebile34 Linux - Hardware 1 03-14-2005 11:50 AM
Partioning and formatting HDD Hikito Linux - Newbie 4 09-11-2004 03:35 PM
Formatting a Laptop HDD Haggy Linux - Laptop and Netbook 2 01-01-2004 02:02 AM
system freezes when formatting external hdd hobylinux Linux - Hardware 6 09-10-2003 10:23 AM
formatting HDD mrengc Linux - Newbie 1 01-10-2003 01:06 AM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration