Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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
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.
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.
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.
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?
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
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.