best way to mirror partitions
Folks, I want to mirror my linux partitons to another drive before running checks on the original HD. There are numerous ways to "mirror" filesystem including dd, tar, cp, cpio, etc... In addition there are utilities to do the same thing. The question is, which method is best at preserving the copy as closely as the original? thanks, Babu __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
--- babu walad <vyav@yahoo.com> wrote:
cp, cpio, etc... In addition there are utilities to do the same thing. The question is, which method is best at preserving the copy as closely as the original?
What do you mean by "as closely as the original?" All the tools you mentioned will copy the "contents" of the files equally well. If you want to preserve the time stamp, symlinks etc. then look up the man page of the specific tool. If you simply want to back up the files, while you run your diagnostics on the HDD, then tar the filesystem to a different HDD and extract them using the time stamp and other relevant options. -- Arun Khan
Hi Arun, I did a tar to move a partition to a newly formatted HD partition. When I do a df of the filesystems, the amount of space used is NOT equal. Therefore the copies are NOT identical at some level as far as the file system is concerned. I made sure to copy sym links as links and not resolve them. Babu --- Arun Khan <knura@yahoo.com> wrote:
--- babu walad <vyav@yahoo.com> wrote:
cp, cpio, etc... In addition there are utilities to do the same thing. The question is, which method is best at preserving the copy as closely as the original?
What do you mean by "as closely as the original?"
All the tools you mentioned will copy the "contents" of the files equally well.
If you want to preserve the time stamp, symlinks etc. then look up the man page of the specific tool. If you simply want to back up the files, while you run your diagnostics on the HDD, then tar the filesystem to a different HDD and extract them using the time stamp and other relevant options.
-- Arun Khan
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Friday 2005-09-16 at 10:50 -0700, babu walad wrote:
I did a tar to move a partition to a newly formatted HD partition. When I do a df of the filesystems, the amount of space used is NOT equal. Therefore the copies are NOT identical at some level as far as the file system is concerned. I made sure to copy sym links as links and not resolve them.
Read this: /usr/share/doc/howto/en/txt/Hard-Disk-Upgrade.gz /usr/share/doc/howto/en/html/Hard-Disk-Upgrade/modify.html Hard Disk Upgrade Mini How-To v2.11, 13 April 2000 How to copy a Linux system from one disk to another. ... 7. Copy the files from the old disk to the new disk ... Previous versions of the Mini How-To stated that you could also use tar to copy the disk, but this method was found to have a bug. There are of course many other ways to copy the disks, but these three are the simplest, quickest, and most reliable. So... I don't know why everybody recomends using tar for that task, if it is known to be a buggy method... (what the bug is, I have no idea; ask the howto writer). - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFDKxHBtTMYHG2NR9URAnp4AJ9mjNaZTY9Sgh7lHOEvl7+2A8VwFQCfbc1T 9MQPiEXNQhGjVcwqJ4OVD7w= =IVml -----END PGP SIGNATURE-----
-----Original Message----- From: Carlos E. R. [mailto:robin1.listas@tiscali.es] Sent: Friday, September 16, 2005 11:41 AM To: suse list Subject: Re: [SLE] best way to mirror partitions
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
The Friday 2005-09-16 at 10:50 -0700, babu walad wrote:
I did a tar to move a partition to a newly formatted HD partition. When I do a df of the filesystems, the amount of space used is NOT equal. Therefore the copies are NOT identical at some level as far as the file system is concerned. I made sure to copy sym links as links and not resolve them.
Read this:
/usr/share/doc/howto/en/txt/Hard-Disk-Upgrade.gz /usr/share/doc/howto/en/html/Hard-Disk-Upgrade/modify.html
Hard Disk Upgrade Mini How-To
v2.11, 13 April 2000
How to copy a Linux system from one disk to another.
...
7. Copy the files from the old disk to the new disk
... Previous versions of the Mini How-To stated that you could also use tar to copy the disk, but this method was found to have a bug. There are of course many other ways to copy the disks, but these three are the simplest, quickest, and most reliable.
So... I don't know why everybody recomends using tar for that task, if it is known to be a buggy method...
(what the bug is, I have no idea; ask the howto writer).
This is from over 5 years ago. I am sure this has been corrected. There can be many reasons the sizes are different. Different block size, different file system, etc. If the partitions are on the same drive or on a drive in the system the best way would be to just do a cp -av of the files. If they are not tar will work just fine. I use it for all my backups. Brad Dameron SeaTab Software www.seatab.com
I did not follow this thread without jumping in it, I hope I will not repeat things already said, or be too much off-topic. Be kind with me! :-)
If you want to preserve the time stamp, symlinks etc. then look up the man page of the specific tool. If you simply want to back up the files, while you run your diagnostics on the HDD, then tar the filesystem to a different HDD and extract them using the time stamp and other relevant options.
If you have the luxury of having the old and new partitions available at the same time, the easiest might be (OLD and NEW are mounted partitions): cd .../OLD cp -av .* * .../NEW The `-v' is only for entertainment, you may avoid it if you prefer a silent copy. If both your partitions happen to have exactly the same physical size, you may even copy them bit-by-bit (being root), with something looking like, say: cp /dev/hda2 /dev/hdb3 but you ought to understand that the second partition may not be smaller than the first, and that the second partition contents is fully lost.
I did a tar to move a partition to a newly formatted HD partition. When I do a df of the filesystems, the amount of space used is NOT equal. Therefore the copies are NOT identical at some level as far as the file system is concerned.
Both file systems should be of the same type and be formatted with the same parameters. Directories might usually be smaller on the resulting copy, depending on how the space of unused directory entries were handled on the original file system. One particular problem may come from sparse files (files with holes in them). It is a rather difficult problem (very hard if you want to be perfect) copying a sparse file so it uses the same physical space. See option `-S' in `tar'. Other tools may have, or not, similar provision. -- François Pinard http://pinard.progiciels-bpi.ca
On Fri, 2005-09-16 at 10:50 -0700, babu walad wrote:
I did a tar to move a partition to a newly formatted HD partition. When I do a df of the filesystems, the amount of space used is NOT equal. Therefore the copies are NOT identical at some level as far as the file system is concerned. I made sure to copy sym links as links and not resolve them.
I have been using tar to backup entire file systems (including restore of / and C: of Windows) and have not encountered any problems yet. Another member has already responded as to why df reports different sizes. If you are not convinced that the file contents are the same then do a "cmp" or "md5sum" on the original and copied files. -- Arun Khan (knura at yahoo dot com) God made machine language; all the rest is the work of man.
babu walad wrote:
Folks,
I want to mirror my linux partitons to another drive before running checks on the original HD. There are numerous ways to "mirror" filesystem including dd, tar, cp, cpio, etc... In addition there are utilities to do the same thing. The question is, which method is best at preserving the copy as closely as the original?
thanks,
Babu
All the above are capable of doing just that. I use a script to mirror stuff to my LAN and to hard drives on the same box, $1 is the local (from) directory and $2 is the remote/local (to) directory. Excellent for restoring, just reverse which is from and which is to. # o /usr/local/mybin/RSYNC ####rsync -avz --rsh=ssh <local directory> <remote_host:remote_directory> rsync -avubpoDrz --delete --exclude=/proc --rsh=ssh $1 $2 Regards Sid. -- Sid Boyce ... Hamradio License G3VBV, licensed Private Pilot Retired IBM/Amdahl Mainframes and Sun/Fujitsu Servers Tech Support Specialist Microsoft Windows Free Zone - Linux used for all Computing Tasks
babu walad wrote:
Folks,
I want to mirror my linux partitons to another drive before running checks on the original HD. There are numerous ways to "mirror" filesystem including dd, tar, cp, cpio, etc... In addition there are utilities to do the same thing. The question is, which method is best at preserving the copy as closely as the original?
partimage may be what you want. copy the sectors of the disk, so absolutely all is saved. nice to restrore on the very same disk. jdd -- pour m'écrire, aller sur: http://www.dodin.net http://valerie.dodin.net http://arvamip.free.fr
participants (8)
-
Arun K. Khan
-
Arun Khan
-
babu walad
-
Brad Dameron
-
Carlos E. R.
-
François Pinard
-
jdd sur free
-
Sid Boyce