LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-05-2004, 10:22 AM   #1
phahn
Member
 
Registered: Apr 2002
Location: Philadelphia
Posts: 48

Rep: Reputation: 15
disk to disk backup


My Dell 7150 PowerEdge server (running Linux 7.2) came with two SCSI drives 0 and 1. 0 is the boot drive. 1 is the auxiliary. Today I installed two more SCSI drives, identical in size to drives 0 and 1. These are drives 2 and 3. Now, I wish to backup 0 onto 2 and 1 onto 3. (I gave up on tape backup as being tedious, frustrating and unreliable.)

On my Sun workstation I have two identical HDs. One is the boot drive and the other is the backup. I use the following command to copy from the boot drive to the backup:

dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2 bs=128k (where rdsk is the raw device)

This backs up the boot drive and allows me to boot off the backup drive, in an emergency.

I guess that identical drives aren't possible with RH 7.2. I read that raw devices are not implemented. So, I probably need to format the new drives with Linux file systems (they are already low-level formatted). And, I need a suggestion as to how best to backup to them (dump, tar, cp, dd, etc.). Any ideas or instructions?

I am relatively new to Linux.

Peter
 
Old 05-05-2004, 11:44 AM   #2
peacebwitchu
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 185

Rep: Reputation: 30
have you tried dd if=/dev/sda of=dev/sdc bs=???
 
Old 05-05-2004, 12:46 PM   #3
phahn
Member
 
Registered: Apr 2002
Location: Philadelphia
Posts: 48

Original Poster
Rep: Reputation: 15
disk to disk backup

Hi peacebwitchu,

Thanks loads for the suggestion. I tried the following and it seemed to work:

dd if=/dev/sdb of=/dev/sdd bs=128k

However, I am unable to mount the drive to see what is on it. The command I used is

mount -t -ext3 /dev/sdd /mnt/disk4

The error message is:

mount: wrong fs type, bad option, bad superblock on /dev/sdd, or too many mounted file systems

If I try to mount /dev/sdd1 instead of /dev/sdd, I get the message that "/dev/sdd1 is not a valid block device".

Remember, I did only low level formatting of sdd. I had hoped that the dd command would give the correct format for the file system. sdb has a single partition with and ext 3 format.

Any ideas?

Peter
 
Old 05-05-2004, 01:23 PM   #4
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
I personally use rsync and backup /home on an hourly basis. The drive is only ever mounted during the actual backup phase and rsync only updates the files. You would have to create the necessary file systems before starting. The following is the script that I use in /etc/cron.hourly;

#!/bin/bash
#mount /dev/hda6 on /mnt
mount -t ext3 /dev/hda6 /mnt
#backup files to hda6
rsync --delete-after -avH /home/ /mnt/backup/home > /var/log/backup.log
##umount hda6
umount /dev/hda6

#To make it executable do chmod 700 ./backup

#to run it do ./backup

#I put it in /etc/cron.hourly

#The following entry was put in /etc/crontab so that a backup is made 10 min past each hour.

# m h dom mon dow user command
#10 * * * * root /etc/cron.hourly/backup
 
Old 05-05-2004, 01:24 PM   #5
peacebwitchu
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 185

Rep: Reputation: 30
You could try with a block size of 4096.
 
Old 05-05-2004, 11:47 PM   #6
phahn
Member
 
Registered: Apr 2002
Location: Philadelphia
Posts: 48

Original Poster
Rep: Reputation: 15
disk to disk backup

Dear TigerOC,

Your suggestions worked perfectly to back up the auxiliary disk. Tomorrow, I plan to work on the boot disk, for which I have to create several partitions. I haven't yet put the script into /etc/cron.hourly, but plan to do so as soon as I get everything backed up.

Thanks,

Peter
 
Old 05-06-2004, 03:06 AM   #7
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Great to hear. Just remember that you need to also run e2fsck regularly as well. eg another script for /etc/cron.daily;
make a script called chkdisk
#!/bin/bash
e2fsck /dev/hda6

then
chmod 700 ./chkdisk

then make an entry in crontab;

25 10 * * * root /etc/cron.daily/chkdisk

the time is set for 25 minutes past 10 to alter just change those 2 values.
 
Old 05-06-2004, 03:42 AM   #8
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
You can still use dd but the commnd line that peacebwitchu gave and you have used is almost correct. You need to add a few options and change a few options. For example

dd if=/dev/sdb of=/dev/sdd bs=512 conv=sync

What this does both drives are sync together and both drives are reading and writing 512 bytes (sector by sector). It gives you a near perfect copy.

BTW, backups are rarely reliable.
 
Old 05-06-2004, 08:57 AM   #9
phahn
Member
 
Registered: Apr 2002
Location: Philadelphia
Posts: 48

Original Poster
Rep: Reputation: 15
disk to disk backup

Hi Electro and TigerOC,

Thank you both for all the help. I was really stuck.

First a question for TigerOC: Your suggestions worked nicely for the auxiliary drive (sdb). I was able to format sdd with one Linux partition using fdisk and mkfs, though I could not duplicate the Amoeba format of sdb. Still, I was able to use rsync to make a 'perfect' copy of the files on sdb.

However, when I look at the boot drive (sda) with fdisk, in order to know how to organize partitions on sdc, I run into trouble. All I can find is one Amoeba partition. Yet, I know that sda has 6 partions. Don't I have to organize sdc exactly as sda is organized and then backup each partition separately?

Now a couple of questions for Electro: I would much prefer to use the dd command, as it has served me well in the past. But, what do you mean by "backups are rarely reliable"? Is that true for any type of backup? Or, are you warning me about the types of backups I am attempting? If I do decide use dd to copy the boot disk (sda) to sdc, should I do that from single user runlevel? Would I then be able to boot from sdc?

Again, many thanks,

Peter
 
Old 05-06-2004, 09:40 AM   #10
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Re: disk to disk backup

Quote:
Originally posted by phahn


First a question for TigerOC: Your suggestions worked nicely for the auxiliary drive (sdb). I was able to format sdd with one Linux partition using fdisk and mkfs, though I could not duplicate the Amoeba format of sdb. Still, I was able to use rsync to make a 'perfect' copy of the files on sdb.

However, when I look at the boot drive (sda) with fdisk, in order to know how to organize partitions on sdc, I run into trouble. All I can find is one Amoeba partition. Yet, I know that sda has 6 partions. Don't I have to organize sdc exactly as sda is organized and then backup each partition separately?

Peter
if you are using rsync there is no need to have the structure identical. You could use folders as well. Have you considered raid? I would suggest look at this article as it is where I got some of my ideas from. I think he also covers md5sum utilisation which will ensure that the data is intact. If the drives in question are servers and therefore in constant use then going down to single user mode is almost imperative. I carry out fire insurance by using partimage off knoppix to do a backup once a week. With this method the drive is not mounted at all but it is time consuming. i have been using computers for 24 years, mainly in a business environment, and know from long experience how important backups are and what a difference a few days can make.
Just to add to what I said above I have found another document relating to how rsync works and also how md5sum can be included to ensure integrity of data if you are worried about this aspect which you'll find here

Last edited by TigerOC; 05-06-2004 at 04:49 PM.
 
Old 05-06-2004, 05:03 PM   #11
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
The dd works at the low level but people recommend that you unmount the partition or drive before using it. I do not have any trouble while the partition or drive is mounted, but if data is being written to the partition or drive it probably will be corrupted on the copy or image.

Backups are not reliable or you have to think they are not reliable. Use md5sum on every file that you copy can be use to make sure the file is 99.9% intact. For /boot you have to make another entry in your bootloader just in case your original /boot does not work. You can use cp with the preserve and recursive option. Use grub instead of LILO because it uses a file for the menu instead of hard coded in the MBR what LILO does.

You may want to save three or more versions of boot or the other partitons on seperate storage mediums. This way you have a greater chance of not having corrupted data. Then you have to worry about partition table corruption. Use sfdisk for that.

The storage mediums you could use are CD, DVD, FLASH, FRAM, and other storage mediums that have not been introduce yet. DVD can hold up to 4 gigabytes for single layer and for double layer it can hold up to 8 gigabytes. FLASH can hold up to 2 gigabytes and they are very durable. Problems with FLASH is it has limited writes and only last about 5 to 10 years. To get the full use of FLASH you have to use archival files such as tar, gzip, bzip, zip, rar. Next medium is FRAM. Few people knows about it but it a lot of advantages. First its much faster than FLASH. Second it has unlimited writes. Like FLASH, its durable. The disadvantage of FRAM is it takes a lot of space on a chip, so the maximum capacity for FRAM right now is about 512 kilobytes per chip. Its great for storing small files. /boot is small so you will get a lot uses of FRAM. If you have engineers, you can ask them to make a FRAM disk. The only company that provides 512 kilobytes FRAM chips is Vertical Circuits, Inc..

There is another storage medium coming out soon (I hope). It uses the material that is used for antistatic bags for storing data. It stores data by using high voltage or I think high frequency. The data capacity is either 1 gigabyte per centimeter or 1 gigabyte per inch (2.54 cm). Then there is Seagate found a way to store hundreds of terabytes on a hard drive.
 
Old 05-08-2004, 01:19 PM   #12
phahn
Member
 
Registered: Apr 2002
Location: Philadelphia
Posts: 48

Original Poster
Rep: Reputation: 15
disk to disk backup

Hi Electro,

Thanks so much for the detailed explanation of the problems with backup and your easy to follow suggestions for preventing backup errors. I am keeping a copy and plan to follow your suggestions when I get my system moved and back into operation. RH 7.2 will no longer be supported by RH, so I will probably move to RH AS.

I did try DD, just as you described in a previous update. But, I still couldn't produce a mountable disk. I was copying from the boot drive, so I did not try to dismount it first. The destination disk (sdc), was not mounted. When I saw that the destination disk would not mount, I went ahead and formatted it with the command "fdisk /dev/sdc", giving it only one partition. After that, I was able to mount it using the command "mount /dev/sdc1". Surprisingly, it contained the data from the first (boot) partition. I tried "mount /dev/sdc2", etc. But, none of these worked.

Finally, I used the command "mkfs /dev/sdc" which wiped out the boot partition data and left me with sufficient space for backing up the boot drive data. I then set up folders for all the directories found on my boot drive and used rsync to copy those directories from the boot drive to /dev/sdc1. I wasn't as fastidious as you suggest, since I hadn't read your most recent advice. But, I now felt confident enough to shut down the system and prepare it for a move to my basement. Actually, one boot drive directory (usr) gave me a problem. rsync was taking over 40 minutes to copy usr. It looked like it was caught in a loop, so I killed the copying. However, all other directories copied fine, in reasonable time.

Thanks for listening to all this.

Best wishes,

Peter
 
Old 05-08-2004, 03:48 PM   #13
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Why not use a lighter LINUX distribution like Slackware or Gentoo.

I did use dd about a month ago but afterwards I ran a repair utility. The filesystem that I was using is XFS. I think its much better at repairing corrupted partitions than other filesystems that I tried like ext2, ext3, reiserfs, jfs.

You can try using the lazy option when mounting. Sometimes it works.

To copy /usr perfectly make sure you are in single user mode or use knoppix.

Be careful transporting the system. The possibility of damaging a computer is high while carrying it to its destination.
 
Old 05-09-2004, 08:36 AM   #14
phahn
Member
 
Registered: Apr 2002
Location: Philadelphia
Posts: 48

Original Poster
Rep: Reputation: 15
disk to disk backup

Hi Electro,

Interesting suggestion to go to Slackware or Gentoo. I have never heard of them. I will look them up. I used RH 7.2 because it was delivered with the system. I am used to Unix, so I felt comfortable dealing with Linux. The machine is a 64-bit w/Itanium processors. Would the other Linux software be appropriate?

Regarding moving the machine. It is extremely heavy. So, I first dismantle anything that can be removed. The drives are pluggable from the front panel. So, I carry those separately. Also, the memory and processors come in a separate cage that also can be carried separately. That cage probably weighs about 35 lbs by itself.

Peter
 
  


Reply


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
Disk backup? rookworm Linux - Newbie 3 11-13-2005 06:38 PM
disk to disk backup for debian/Mempis on bootable cd-- advice loninappleton Linux - Software 3 05-27-2005 02:00 AM
can I backup a root disk and boot from the new backup disk linuxbkp Linux - Enterprise 3 10-15-2004 07:42 PM
Using Knoppix for disk image backup johnp Linux - Software 1 04-29-2004 12:26 AM
What have I got already for disk backup in RedHat 8.0? SparceMatrix Linux - General 8 02-19-2003 04:13 AM


All times are GMT -5. The time now is 04:01 PM.

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