Solved

Newbie - CP Question

Posted on 2004-09-15
10
311 Views
Last Modified: 2010-04-21
Hi

How can I make a backup of my whole linux drive, I've got hda2 and hda5 which has data, how can I back these up to a local hard drive set as slave (hdb1) I don't need compression at all, can I use cp or dd? If I copy my data back will my linux work again if I backed up the mbr as well?

Just another thing, how can I show a picture in another tty session while cp or dd or copy process runs on tty1?

Thanks

0
Comment
Question by:reaper_11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 12070129
The best way would be to use dump (see 'man dump' for details). You can write the dump image to a file(s) on hdba1, or by using a pipe to restore write each file system to a separate partition on hdb. The MBR won't be copied using that method, but it is easy to reset it from a floppy or rescue boot.

Linux supports multiple consoles (Ctrl-Alt-F2, Ctrl-Alt-F3, etc) so you can run the backup in in one session and do something else in another.
0
 

Author Comment

by:reaper_11
ID: 12070258
can you maybe gove me an example of how dump works? how long will dumpp take on an 8 gig drive...

The diffrent session thing: I want to automate it and not push alt+F2 etc. while dump runs in tty1 I want to write "echo hello" in tty2 atomatically?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12070822
Since dump only operates on the actual data in use how long it would take depends on how much of that 8Gb is actually used. When I do this on my laptop across the network (100Mbps) to another system it takes a few of hours. That's a total of about 15Gb.

I don't know what Linux version you have and whether it & dump supports large files (greater than 2Gb) or not. But in its simplest form you might do something along the lines of:

mkdir /mnt/backup
mount /dev/hdb1 /mnt/backup
dump 0af /mnt/backup/root-fs.dump /
dump 0af /mnt/backup/home-fs /home

To avoid the "open files" problem where a file changes during a backup I like to do my backups with the system in single mode when using dump or tar. Commercial products like Legato Networker can do backups that are valid even if a file changes during the backup.
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

Author Comment

by:reaper_11
ID: 12071391
Thanks for the help!!!

So if I have a HDA2(Primary) and a HDA5(Logical) and another drive local HDB1(set as slave) I can do the following:

mkdir/mnt/src1
mkdir /mnt/src2
mkdir /mnt/des
mount /dev/hda2 /mnt/src1
mount /dev/hda5 /mnt/src2
mount /dev/hdb1 /mnt/dest

dump 0af /mnt/dest/backup /mnt/src1

What does the 0af do?

Thanks again!
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12071526
I presumed that hda2 & hda5 are already mounted, probably as / & maybe /home or /usr. So all you need to do is mount hdb1, do the dumps, and then unmount it. You can take the system down to run level 1 (single user mode) and back up to 3 or 5 without even rebooting. If it's done that way the Linux file system will remain mounted. Done this way you can script this process so that it is run from cron when it won't interfere with normal use.

0 - do a level zero dump, which is a full dump of all data
a - write until end of media is seen, i.e., don't assum the media is of fixed (known) length
f - the output filespec for the dump follows
0
 

Author Comment

by:reaper_11
ID: 12071633
so all I do is mount hdb1 mount /dev/hdb1 /mnt/dest and then dump it
dump 0af /mnt/dest/image.img /

how can I extract the above image.img? if my drive fails, how can I copy the data back to hda1 (new drive), will it wirk if I dump the data back to the nw hda1 and restore the boot record then restart?

Thanks again
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12072028
Restoring things gets a little more interesting. The worst case is if hda dies. In that case the first step is to boot into rescue mode from a distro CD or any of the mini-linuxen (Knoppix, tomsrtbt, etc) and partition the new disk, make file systems and swap (see 'man mke2fs' & 'man mkswap'), and then restore the data. For that you use, surprisingly, 'restore'. As an example assuming that we are in rescue mode and the file systems have been created you could do:

mkdir /mnt/disk
mount /dev/hda2 /mnt/disk
mkdir /mnt/backup
mount /dev/hdb1 /mnt/backup
cd /mnt/disk
restore rvf /mnt/backup/root-fs.dump
rm restoresymtable

When all of the data has been restored you'd do:

chroot /mnt/disk
lilo
--or--
grub-install

to re-create the MBR.
0
 

Author Comment

by:reaper_11
ID: 12078734
Hi jlevie  

Thanks alot for your time and patients! This will be the last post then I will accept your answer. Please try helping me out as much as you can. The reason I asked the question in the first place is becaause I want to do the following:

Background: I've got a live linux cd, ISO Linux that just boots and extracts, no install. The machine I'm booting it on is an OS/2 box with 1 physical drive that's split into 2 partitions both 7.98 Gb (HDA2 - Physical) and (HDA5 - Logical) with the filesystem as HPFS. Like I said before, I want to do the following:

1.) Make a backup of the whole hard drive (the 2 partitions) I think I can use dump, onto another local disk (HDB1)
2.) I want to back up the partition tables and mbr onto another local disk (HDB1.) I then want to FDISK the whole drive, then with my ISO linux make a script that runs on startup and creates 2 partitions on the drive as above (HDA2) and (HDA5) and format the 2 partitions as HPFS and then restore the data, I can prob. do this with the restore command like you said.
4.) I want to restore the partition tables and MBR

Every thing gets backed up onto the extra local physical drive (HDB1), So basically a breakdown would be to back the drive as is, fdisk it so there's no filesystem and restore everything so that it operated like normal before I did the back up with dump...

I've read up and I think I can back up the partition table and MBR with:
<SNIP>
cd /root
mkdir partition-backup
cd partition-backup
dd if=/dev/hda of=backup-hda.mbr count=1 bs=512

sfdisk -d /dev/hda > backup-hda.sf
<SNIP>


And restore the partition tables and MBR with:
<SNIP>
dd if=backup-hda.mbr of=/dev/hda

sfdisk /dev/hda < backup-hda.sf
<SNIP>

Thanks again for your time, please help me as far as you can, I appreciate it. I will accept your answer.

Thanks
R.
0
 
LVL 40

Accepted Solution

by:
jlevie earned 325 total points
ID: 12080329
> The machine I'm booting it on is an OS/2 box

You should have said that in the question, because it changes everything. From a linux boot you'll only be able to use dd to do this backup.

What you'd want to do there is 'dd if=/dev/hda of=/dev/hdb1/disk.img which will get everything (the MBR, hda2, & hda5). That means of course that /dev/hdb1 must be at least as large or larger than hda. The restore would simply be the inverse of that (dd if=/dev/hdb1/disk.img of=/dev/hda).

I'd recommend that you test the restore onto a a different disk before wiping out your OS/2 system.
0
 

Author Comment

by:reaper_11
ID: 12086510
Thanks alot!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question