Lamer Newbie Filesystem Question

Lamer Newbie Filesystem Question

Post by Gregg » Sun, 17 Jun 2001 23:47:30



I have a solaris 2.8 system, the / partition is too small, and I would
like to put /usr and /var their own partitions (its all one big
partition now). I've added a 2nd disk, made partitions/filesystems, and
everything is good so far. But now I'm not sure how to actually move the
files to the new partitions. I tried cp -Rp, but it ran into problems
with fifo's, /var/run and /usr/lib/32..... mv had the same problems. I
didn't find much info in the FAQ, sunhelp.org, google or the answerbook.

One thing I did find suggested using ufsdump to copy the files to a
tape, then restore them to the new partition. I don't have a tapedrive,
but I could borrow one. However, will ufsdump really work on just a
subdirectory on a partition? I thought it only worked on whole
filesystems.

Thanks for any pointers.

Ted

 
 
 

Lamer Newbie Filesystem Question

Post by JJM » Mon, 18 Jun 2001 02:20:58


Use the f option to ufsdump and just give it the name of a file on a
filesystem with enough free space. It woll create a dump archive on the hard
disk. When doing the restore do the same thing i.e give th ef option to
ufsrestore with the name of the dump archive. Something like this:-

cd /usr
ufsdump 0f /bigfilesystem/usr.dump ./*

cd /bigfilesystem
ufsrestore rvf ./usr.dump
rm restoresymtable
rm usr.dump

This would restore the /usr directory completely to the filesystem mounted
at /bigfilesystem. When done unmount /bigfilesystem and remount it as /usr.
Once you're happy that it's all working then and only then think about
removing the usr directory from the root filesystem (this will have to be
done in single user mode whilst booted from cdrom).

The same process will work for other filesystems.

JJ


Quote:

> I have a solaris 2.8 system, the / partition is too small, and I would
> like to put /usr and /var their own partitions (its all one big
> partition now). I've added a 2nd disk, made partitions/filesystems, and
> everything is good so far. But now I'm not sure how to actually move the
> files to the new partitions. I tried cp -Rp, but it ran into problems
> with fifo's, /var/run and /usr/lib/32..... mv had the same problems. I
> didn't find much info in the FAQ, sunhelp.org, google or the answerbook.

> One thing I did find suggested using ufsdump to copy the files to a
> tape, then restore them to the new partition. I don't have a tapedrive,
> but I could borrow one. However, will ufsdump really work on just a
> subdirectory on a partition? I thought it only worked on whole
> filesystems.

> Thanks for any pointers.

> Ted


 
 
 

Lamer Newbie Filesystem Question

Post by Oscar del Ri » Mon, 18 Jun 2001 07:11:33


Quote:> > One thing I did find suggested using ufsdump to copy the files to
a
> > tape, then restore them to the new partition. I don't have a
tapedrive,
> > but I could borrow one. However, will ufsdump really work on just
a
> > subdirectory on a partition? I thought it only worked on whole
> > filesystems.

> Use the f option to ufsdump and just give it the name of a file on a
> filesystem with enough free space. It woll create a dump archive on
the hard
> disk. When doing the restore do the same thing i.e give th ef option
to
> ufsrestore with the name of the dump archive.

No need to use temp files. You can use ufsdump and ufsrestore in a
pipe.
From "man ufsrestore":

    f dump_file
          If dump_file  is  specified  as `-',
          ufsrestore   reads  from the standard input.
          This allows ufsdump(1M) and ufsrestore  to be used
          in a pipeline to copy a file system:

     example# ufsdump 0f - /dev/rdsk/c0t0d0s7 \
        | (cd /home; ufsrestore xf -)

In you case, you could use something like

ufsdump 0f - /var | (cd /disk2/var; ufsrestore xf -)
ufsdump 0f - /usr | (cd /disk2/usr; ufsrestore xf -)

assuming you partitioned and mounted the second disk
in /disk2/var and /disk2/usr

Then you can unmount the second disk and edit vfstab
to mount /var and /usr from the new partitions on the
next reboot, e.g.

/dev/dsk/c?t?d?s? /dev/rdsk/c?t?d?s? /usr ufs 1 no -
/dev/dsk/c?t?d?s? /dev/rdsk/c?t?d?s? /var ufs 1 no -

Have the Solaris CD handy in case you have to boot
from CD to undo changes  :-)