Re: [ILUG] New Hard Disc

From: Brian Foster (blf at domain utvinternet.ie)
Date: Sat 22 Jun 2002 - 12:11:15 IST


  | Date: Fri, 21 Jun 2002 23:55:57 +0100
  | From: Niall O Broin <niall at domain 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 domain 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...


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:26 GMT