moving a filesystem to another partition

moving a filesystem to another partition

Post by Wong Pui Mi » Fri, 21 Jun 1996 04:00:00



I was trying to copy the entire filesystem (mounted on /userhome)
to another larger filesystem (/dev/rz3c) since the old one is running
out of space. What i did are:
mount /dev/rz3c  /mnt
tar cf - . | (cd /mnt && tar xpf - )
umount /mnt
umount /userhome
mount /dev/rz3c /userhome
BUT after i did the tar, I found that the ownerships of the subdirectories
under /mnt are wrong (being owner root, group system), yet those of the
files are correct. What have I done wrong ?
Any suggestion for an alternative way  to move the partition ?
(P.S. the unix conerned is Digital Unix 3.0)
--
        __

  /      ( -------------  }  System Support Programmer
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University
   \_/ \__)                  224 Warerloo Road, Hong Kong (Tel:23397425)

 
 
 

moving a filesystem to another partition

Post by Wong Pui Mi » Fri, 21 Jun 1996 04:00:00



: I was trying to copy the entire filesystem (mounted on /userhome)
: to another larger filesystem (/dev/rz3c) since the old one is running
: out of space. What i did are:
: mount /dev/rz3c  /mnt
: tar cf - . | (cd /mnt && tar xpf - )
: umount /mnt
: umount /userhome
: mount /dev/rz3c /userhome
: BUT after i did the tar, I found that the ownerships of the subdirectories
: under /mnt are wrong (being owner root, group system), yet those of the
: files are correct. What have I done wrong ?
: Any suggestion for an alternative way  to move the partition ?
: (P.S. the unix conerned is Digital Unix 3.0)
Sorry one typo mistake on my original posting, I did the
cd /userhome
before doing the tar command
--
        __

  /      ( -------------  }  System Support Programmer
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University
   \_/ \__)                  224 Warerloo Road, Hong Kong (Tel:23397425)

 
 
 

moving a filesystem to another partition

Post by Wuxu Pe » Fri, 21 Jun 1996 04:00:00



: I was trying to copy the entire filesystem (mounted on /userhome)
: to another larger filesystem (/dev/rz3c) since the old one is running
: out of space. What i did are:
: mount /dev/rz3c  /mnt
: tar cf - . | (cd /mnt && tar xpf - )
: umount /mnt
: umount /userhome
: mount /dev/rz3c /userhome
: BUT after i did the tar, I found that the ownerships of the subdirectories
: under /mnt are wrong (being owner root, group system), yet those of the
: files are correct. What have I done wrong ?
: Any suggestion for an alternative way  to move the partition ?
: (P.S. the unix conerned is Digital Unix 3.0)

My guess:  you should do a

        tar cpf - . | ...

The "p" flag preserves the onwer and group information.

--


 
 
 

moving a filesystem to another partition

Post by Michelle Murill » Fri, 21 Jun 1996 04:00:00




> : I was trying to copy the entire filesystem (mounted on /userhome)
> : to another larger filesystem (/dev/rz3c) since the old one is running
> : out of space. What i did are:
> : mount /dev/rz3c  /mnt
> : tar cf - . | (cd /mnt && tar xpf - )
> : umount /mnt
> : umount /userhome
> : mount /dev/rz3c /userhome
> : BUT after i did the tar, I found that the ownerships of the subdirectories
> : under /mnt are wrong (being owner root, group system), yet those of the
> : files are correct. What have I done wrong ?
> : Any suggestion for an alternative way  to move the partition ?
> : (P.S. the unix conerned is Digital Unix 3.0)
> Sorry one typo mistake on my original posting, I did the
> cd /userhome
> before doing the tar command
> --
>         __

>   /      ( -------------  }  System Support Programmer
>  (  =l=ll===============__}  Computing & Telecomm. Services Centre
>   \   _  (                   Hong Kong Baptist University
>    \_/ \__)                  224 Warerloo Road, Hong Kong (Tel:23397425)

When I move entire filesystems on SunOS4.1.x or Solaris 2.x I
use the following tar command.

cd /dir-to-tar; tar cf - . | ( cd /dir-to-tar-to; tar xfBp - )

Works great for me everytime!

mitch

 
 
 

moving a filesystem to another partition

Post by Wong Pui Mi » Sat, 22 Jun 1996 04:00:00


: My guess:  you should do a

:         tar cpf - . | ...

: The "p" flag preserves the onwer and group information.
Don't think so. p flag is only meaningful for x (not c) and it is
to preserve the permission bits , not the ownerships (ownerships
should be preserved by default)
It might be the problem specific to Digital Unix 3.0 (could someone
clarify this for me !) as i did the same thing on AIX 3.2.x and they
are okay(i mean the ownerships were preserved)
--
        __

  /      ( -------------  }  System Support Programmer
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University
   \_/ \__)                  224 Warerloo Road, Hong Kong (Tel:23397425)

 
 
 

moving a filesystem to another partition

Post by Mark Barte » Sat, 22 Jun 1996 04:00:00


[ Wong Pui Ming ]

Quote:>>  BUT after i did the tar, I found that the ownerships of the subdirectories
>>  under /mnt are wrong (being owner root, group system), yet those of the
>>  files are correct. What have I done wrong ?

You haven't done anything wrong.  The v3.0 tar (which, along with cpio, is just
a link to "pax") is a major disaster.  The fix is to rename both copies of tar
(one each in /sbin and /usr/bin) to something else, install OSFOBSOLETE300, and
copy /usr/opt/sterling/sbin/tar to /sbin/tar, and /usr/opt/sterling/usr/bin/tar
to /usr/bin/tar.

I don't know whether the version of the tar-linked-to-pax is fixed in any of the
3.2 variants; my experience with 3.0 was such a disaster that I've been grabbing
the /usr/opt/sterling versions ever since!

And you're lucky that only the top-level subdirectories were wrong; it could have
been a lot worse.  For your possible amu*t, I'm appending something I sent to
the alpha-osf-managers list back in December 1994.  (And this was only one of two
postings; there were other problems with the v3.0 {tar,pax,cpio} as well!)

Mark Bartelt                                                         416/978-5619


"Sheep not busy being shorn are busy frying"    -    Dylan, at a NZ lamb barbecue
               [ singing "It's all right, ma (I'm only bleating)" ]

---------------

| After upgrading all our AXPs from V2.0 to V3.0 of OSF/1, I discovered that
| there are some really fundamental problems with tar (or actually, with the
| new "pax" command, which "tar" is just a link to).  Here's just one example
| (others are documented in separate messages) ...
|
| When, running as root, one copies a hierarchy from one directory to another,
| the file ownerships on the target side get botched.  For example:
|
| WALRUS> mkdir /willow/sys/tmp_home
| WALRUS> ( cd /home; tar cf - . ) | ( cd /willow/sys/tmp_home; tar xpf - )
| WALRUS>
| WALRUS> cd /home; ls -ld s*
| drwxr-xr-x   2 shepherd system       512 Dec  5 12:55 shepherd
| drwxr-xr-x   6 shuang   system       512 Dec  2 15:15 shuang
| drwxr-xr-x   4 squires  system       512 Nov 16 22:41 squires
| drwxr-xr-x   2 sridhar  system       512 Aug 12 07:26 sridhar
| drwxr-xr-x   2 stadel   system       512 Sep 12 07:38 stadel
| drwxr-xr-x   2 starkman system       512 Aug 12 07:26 starkman
| drwxr-xr-x   5 syer     system      1024 Aug 29 17:33 syer
| drwxr-xr-x   3 sysmark  system       512 Nov  4 08:58 sys
| drwxr-xr-x   4 sysmark  system       512 Nov 14 07:46 sysmark
| WALRUS>
| WALRUS> cd /willow/sys/tmp_home; ls -ld s*
| drwxr-xr-x   2 shepherd system       512 Dec  5 12:55 shepherd
| drwxr-xr-x   6 shepherd system       512 Dec  2 15:15 shuang
| drwxr-xr-x   4 squires  system       512 Nov 16 22:41 squires
| drwxr-xr-x   2 squires  system       512 Aug 12 07:26 sridhar
| drwxr-xr-x   2 shepherd system       512 Sep 12 07:38 stadel
| drwxr-xr-x   2 squires  system       512 Aug 12 07:26 starkman
| drwxr-xr-x   5 squires  system      1024 Aug 29 17:33 syer
| drwxr-xr-x   3 sysmark  system       512 Nov  4 08:58 sys
| drwxr-xr-x   4 syer     system       512 Nov 14 07:46 sysmark
|
| It isn't just the top-level directories which are affected; other files
| further down also have the file ownership set wrong.
|
| The *really* bizarre thing about this is that whenever a file gets the
| wrong uid assigned to it, the user name (from /etc/passwd) of the "bad"
| uid starts with the same letter of the alphabet as the user name which
| matches the correct uid.  Weird ...
|
| By the way, using the "pax" command which (according to the man page) is
| allegedly equivalent is even worse:  All the files end up owned by root,
| even if "-pe" is used.
|
| Oh yeah, it's worth pointing out that the man page example is wrong.  It
| says that to do
|                 ( cd /fromdir; tar cf - . ) | ( cd /todir; tar xf - )
| one can do
|                 pax -rw /fromdir /todir
|
| Wrong.  That "pax" command actually does the equivalent of
|
|                 ( cd /; tar cf - fromdir ) | ( cd /todir; tar xf - )
|
| One should actually do
|
|                 cd /fromdir; pax -rw . /todir

 
 
 

moving a filesystem to another partition

Post by Ralph Segu » Sat, 22 Jun 1996 04:00:00


: I was trying to copy the entire filesystem (mounted on /userhome)
: to another larger filesystem (/dev/rz3c) since the old one is running
: out of space. What i did are:
: mount /dev/rz3c  /mnt

I would try using a dump restore pair instead.

-Ralph

 
 
 

moving a filesystem to another partition

Post by Dave Mille » Tue, 25 Jun 1996 04:00:00


You could also use find and cpio:

cd /source-dir/..
find source-dir -print | cpio -pdm /dest-dir-partition-root

--  
D.M.Miller, Computer Services Group
Dynamics Division, GEC-Marconi Radar & Defence Systems Ltd
The Grove, Warren Lane, Stanmore, Middlesex, HA7 4LY, UK

I'm speaking for myself - not my employer