Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2007 18:34:22 -0500
From:      Jon Hamilton <hamilton@pobox.com>
To:        Gary Kline <kline@tao.thought.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: What's best way to copy a filesystem? [was: Re: slight emergency here...]
Message-ID:  <20071028233422.GC2196@woodstock.nethamilton.net>
In-Reply-To: <20071028230203.GA13943@thought.org>
References:  <20071028215454.GA52631@thought.org> <20071028230203.GA13943@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Gary Kline <kline@tao.thought.org>, said on Sun Oct 28, 2007 [03:02:03 PM]:

} > 	At any rate, how do i as root, single user, cp -rp all of /var to
} > 	elsewhere (/storage) and rmdir /var, them mkdir /var and copy
} > 	everything back?? I've forgotten the cpio magic command. 
} > 
} 	The nutshelll of this posting could be: What's the best tool 
} 	to copy a /FILESYSTEM to /storage/FILESYSTEM?

The best tool is the one you use successfully.  If you're really talking about
a whole filesystem, dump and restore may contain the least surprises in 
unusual situations:

$ newfs /dev/whatever
$ mount /dev/whatever /mnt
$ cd /dev/whatever
$ dump 0af - /old_filesystem | restore -rf -

Then delete /mnt/restoresymtable when it's all done.

Of course you can use tar, cpio, cpdup if you have it, or even cp.  At 
different points in time historically some of those have had problems with 
some situations like sparse files, "extra" hard links, symlinks, etc. 

-- 

   Jon Hamilton 
   hamilton@pobox.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071028233422.GC2196>