|
About
My Infrequently Updated Blog. The web-based journal of M. Forde, computer nerd, endurance athlete, and DeLorean owner
contact
Subscribe
Subscribe to a syndicated feed of my weblog,
brought to you by the wonders of RSS.
Flavors
There's more than one way to view this weblog; try these flavors on
for size.
index
circa 1993
Sections
main
musings
running
DeLorean
code
unix
album
TBM
Archives
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011
2010
2009
2008
2007
Disclaimers, Copyrights, Privacy, Etc.
ToS
Copyrights
Links
olix0r.net
netmeister.org
Giraffes
Eat. Run. Sleep.
|
|
|
Excluding directories while using pax(1)
My primary disk is failing. There are large segments that are generating
low level IO errors during read or write operations. Most of the files
written to the bad area were under /usr/ports/ where the FreeBSD Ports
collection is installed. A few files were under the web server's root.
Figuring I'd take care of things prior to the disk actually failing to
the point of it being irrecoverable, I purchased a new disk early. I
installed it, partitioned it, and formatted it.
To copy the data over, ignoring the areas that were causing the IO
errors, I used mv to "move" the files from the web root under /usr/ports
and used the following command as root:
pax -rwvpe -s':/usr/ports/.*::gp' -X / /mnt/newdisk/
The -X prevents pax from traversing into mount points that have a
different device ID than the one on which it was started. This prevents
an infinitely recursive loop from happening when the new disk's mount
point would have been hit. It also prevents data on the non-failing
disks from being copied as well.
the -s option allows for sed search and replace scripts to be run. In
this example, the : is used as the delimiter and any path matching
/usr/ports/* is replaced by a null string. With this replacement all
directories under /usr/ports are excluded from the copy.
[/unix]
[permanent link]
|
|