[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problem moving /usr to new partition



On Mon, May 08, 2000 at 05:03:16PM +0800, Lindsay Allen wrote:
> 
> 
> No.  If I make a file ee and eee is a hardlink to it, I get this:
> 
> elm:$ cp -la ee* /tmp
> cp: cannot create link `/tmp/ee': Invalid cross-device link
> cp: cannot create link `/tmp/eee': Invalid cross-device link
> elm:$ ll ee*
> -rw-rw-r--    2 allen    allen         902 Mar 23 19:49 ee
> -rw-rw-r-
> 
> If I use "cp -a ee* /tmp" it creates two separate files.

So don't use cp.  Instead, do it the UNIX way (use a few small tools
...)

create a filesystem on target partition

mount target partition somewhere (/mnt is a good choice :)

cd to dir to move (eg cd /usr)

run this command (as root):

  find . -print | cpio -padm /mnt

/mnt now contains an exact copy of /usr

umount /mnt

go to single user mode (init 1), cd /, rm -r usr/*, mount targetdev
/usr, edit /etc/fstab to taste, go multiuser (init 2).

Works every time.  cpio does hard links, soft links, device files ...

Cheers,

-- 
Nathan Norman         "Eschew Obfuscation"          Network Engineer
GPG Key ID 1024D/51F98BB7            http://home.midco.net/~nnorman/
Key fingerprint = C5F4 A147 416C E0BF AB73  8BEF F0C8 255C 51F9 8BB7

Attachment: pgpU4aZ0Y8OOO.pgp
Description: PGP signature


Reply to: