| Date: Fri, 21 Jun 2002 23:55:57 +0100
| From: Niall O Broin <niall at linux.ie>
|
| On Fri, Jun 21, 2002 at 06:50:59PM +0100, Tom Mackey wrote:
| > The disc in my Linux machine is almost full and I would like
| > to replace it with a larger one. [ ... ]
I'm slightly curious, why _replace_ rather than _add_?
(of course, adding assumes you've got the slots/whatever.)
and then, if adding, why move everything from the current
to the new disc?
|[ ... ]
| The following step by step instructions
|[ ... ]
| find .|cpio -pmd /tmp/new [3]
eeek! above works, as long as there's nothing "funny" about
what's being copied. but if there are either:
· strange filenames, esp. ones containing a newline;
or
· read-only directories, i.e. ones with no write
permission at all (may not apply to superuser);
...the above stands a good change of f**king up.
better, when using GNU find(1) and GNU cpio(1), is:
chmod 700 /tmp/new
find . -depth -print0 | cpio -0pmd /tmp/new
this will correctly duplicate all files, regardless of the
names; and all directories, regardless of the permissions.
the `chmod 700' is to close a security hole inadvertently
created by fixing the directory permissions issue.
whilst perhaps un-necessary in this situation, you may also
wish to consider using `cpio's `-a' option in addition to
those shown above.
|[ ... ]
| [3] cp -a . /tmp/new is probably just fine too - I've just been
| using find|cpio since forever and it works on any Unix [ ... ]
yea. what does `cp -a' do w.r.t. special files, FIFOs,
and so forth? for those, the i-node attributes should be
duplicated, but the device/FIFO/whatever _never_ open(2)ed
or read(2) --- which is not exactly `cp's purpose?
cheers!
-blf-
--
Innovative, very experienced, Unix and | Brian Foster Dublin, Ireland
Chorus (embedded RTOS) kernel internals | e-mail: blf at utvinternet.ie
expert looking for a new position ... | mobile: (+353 or 0)86 854 9268
For a résumé, contact me, or see my website http://www.blf.utvinternet.ie
Stop E$$o (ExxonMobile): «Whatever you do, don't buy Esso --- they
don't give a damn about global warming.» http://www.stopesso.com
Supported by Greenpeace, Friends of the Earth, and numerous others...
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!