dieing hdd

Brian Somers brian at freebsd-services.com
Fri Nov 23 17:28:53 GMT 2001


> Hiten Pandya <hitmaster2k at yahoo.com> wrote:
> 
> > i had this type of dying hdd problem with a scsi
> > drive... so.. what i did was... use the ol' cp(1)
> > command.. which did the trick of copying the stuff
> > exactly as it was before....
> 
> Just be aware that some cp implementations follow symlinks,
> which is not always ideal. ;)  When copying trees of files I
> normally use the tar trick, and it should preserve all
> permissions and timestamps correctly.
> 
> (cd /source; tar -cpf - .) | (cd /dest; tar -xvpf -)
> 
> It looks like -R cp(1) option in FreeBSD is intelligent
> and handles symlinks and special device files properly. :)

You're right - cp isn't the right tool, but because it breaks all 
hard links.

Unfortunately, tar isn't good either because it fails to copy device 
nodes with minors greater than 255.

pax is better, but it gets things wrong WRT file flags.

The only tool I know of (besides dd - which is only good for 
filesystems that are exactly the same) that'll do the job is 
dump/restore, although ports/sysutils/cpdup may do it too (I've never 
used cpdup).

  dump 0af - /dev/filesystem | (cd /newfs; restore -rf -) && rm restoresymtable

> -Paul-

-- 
Brian <brian at freebsd-services.com>                <brian at Awfulhak.org>
      http://www.freebsd-services.com/        <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour !      <brian@[uk.]OpenBSD.org>






More information about the Ukfreebsd mailing list