Click to See Complete Forum and Search --> : A question on dump and restore command
satimis
09-04-2004, 05:52 AM
Hi folks,
Debian
Can I apply dump and restore commands as follow to clone a partition from Drive-A to Drive-B, connected as slave
Drive-A is the system drive
Drive-B is a brand drive, partitioned but without formatted
# dump –f - /var | (cd /mnt/var; restore –rf -)
/var is the 'var' partition of Drive-A
/mnt/var is the mount point of an empty partition of Drive-B
Kindly advise whether the above syntax is correct
TIA
B.R.
satimis
saikee
09-04-2004, 06:56 AM
Moderator DMR has a good thread (reference at my signature) which I use regularly. His suggested tar command seems very similar to your dump command
tar cf - . | (cd /mnt/tmp; tar xvf -)
I omit the v to save the fileanames displaying on the screen. May be useful to try it yourself. I move my partitions mainly with tar.
evac-q8r
09-04-2004, 09:31 AM
If the empty partition on the brand new drive that you want to restore on doesn't have a filesystem on it, I believe, although not completely sure, then restore will not be able to put the files on this partition. If you read in the man pages you will see the following under option -r: -r Restore (rebuild) a file system. The target file system should
be made pristine with mke2fs(8), mounted, and the user cd'd into
the pristine file system before starting the restoration of the
initial level 0 backup. If the level 0 restores successfully, the
-r flag may be used to restore any necessary incremental backups
on top of the level 0. The -r flag precludes an interactive file
extraction and can be detrimental to one's health (not to mention
the disk) if not used carefully. An example:
mke2fs /dev/sda1
mount /dev/sda1 /mnt
cd /mnt
restore rf /dev/st0
Note that restore leaves a file restoresymtable in the root
directory to pass information between incremental restore passes.
This file should be removed when the last incremental has been
restored.
Restore, in conjunction with mke2fs(8) and dump(8), may be used
to modify file system parameters such as size or block size.
I don't know if this is what you already did. If you want to clone the partition thus making it an identical copy byte for byte then I suggest you use the dd command, but in that case the new partition must be exactly the same size as the old. Or you can use tar which was already mentioned which is doing exactly what you're trying to achieve. Or you can use cpio which will archive and and also restore files. The only thing dump does is create an archive of all the files for restore to retrieve. So any one of those commands with the exception of dd will assist you.
EVAC
satimis
09-04-2004, 07:56 PM
Hi folks,
Tks for your advice.
Sorry for not having explained clear the target which I expect to achieve in my first posting. In fact I'm prepared to clone a HD (ATA-33) to a new HD (ATA-100) of bigger storage capacity. It can be easily achieved with "dd" command. However to avoid further resizing each partitions after cloning, I was planning to follow point 6) of following URL;
http://www.linuxmafia.com/faq/VALinux-kb/copying-directory-trees.html
My planned steps to be taken as follows;
1)
# fdisk -l (to discover the partitions on ATA-33 drive, e.g.)
Device Boot System
/dev/hda1 * Linux
/dev/hda2 Linux
/dev/hda3 Linux swap
/dev/hda4 /var Linux
etc.
2)
Creat partitions on ATA-100 drive same as ATA-33 drive but of different capacity
# fdisk n /dev/hdb
etc.
(Remark: Hi evac-q8r,
I will create a filesystem first before proceeding further. Tks.)
3)
Create following mount points (on ATA-33)
# mkdir /mnt/boot
# mkdir /mnt/root
# mkdir /mnt/var
4)
# mount /dev/hdb1 /mnt/boot
# mount /dev/hdb2 /mnt/root
(/dev/hdb3 is swap)
# mount /dev/hdb4 /mnt/var
5)
Execute follows;
# dump -f - /boot | (cd /mnt/boot; restore -rf -)
# dump -f - / | (cd /mnt/root; restore -rf -)
# dump -f - /var | (cd /mnt/var; restore -rf -)
I'm not confident on the syntax correctness of above command lines. Furthermore its warning, as follow, scared me;
Important: Never use dump/restore on live filesystems, only on absolutely quiescent ones, preferably not even mounted read/write.
To my understanding "live filesystems" refers to the PC in operation/use excluding the operation of cloning and executing the above steps on Init3 (not even on KDE/GNOME desktop) Therefore I started searching around for information on this respect as well as the syntax error, if any.
If no positive information/advice found then I will follow point 4) on the abovementiond URL using 'tar' command on following step;
5)
# (cd /boot && 'tar Sczpf - . ) | (cd /mnt/boot && tar Sxvzpf -)
# (cd /root && 'tar Sczpf - . ) | (cd /mnt/root && tar Sxvzpf -)
# (cd /var && 'tar Sczpf - . ) | (cd /mnt/var && tar Sxvzpf -)
Kindly advise whether I make any mistake or overlook any points.
TIA
B.R.
satimis
saikee
09-13-2004, 10:21 AM
Satimis,
Sorry I have been away.
Can't comment on the dump method but for the tar command I think you have got it.
The command that I used before (for your /boot as an example) would be
cd /boot
tar cf - . | (cd /mnt/boot; tar xvf -)
Think I even omit the v in the xvf to stop seeing screen scrolling.
satimis
09-13-2004, 11:47 AM
Originally posted by saikee
Satimis,
Sorry I have been away.
Can't comment on the dump method but for the tar command I think you have got it.
The command that I used before (for your /boot as an example) would be
cd /boot
tar cf - . | (cd /mnt/boot; tar xvf -)
Think I even omit the v in the xvf to stop seeing screen scrolling. Hi saikee,
Noted with thanks
B.R.
satimis