Forum Stats

  • 3,757,128 Users
  • 2,251,200 Discussions
  • 7,869,734 Comments

Discussions

How to move /var to new file system ?

User_OFKA2
User_OFKA2 Member Posts: 2 Green Ribbon

Hi All,

Is it possible to move /var to new file system e.g /dev/dsk/c0t0d0s3 on Solaris 10 ?

If possible, could you please help to share step by step how to do it ? Thank you

Original and New/Expected Result as below":


Answers

  • Anil Sammeta-Oracle
    Anil Sammeta-Oracle Member Posts: 12 Employee

    Hi ,

    Before starting the activity please create flar archive and keep it on another server for backup purposes in case of any issue it will help to recover OS. Please take full backup by using any backup tools ie; EMC networker or Veritas NetBackup.

    Reference flarcreate:

    https://docs.oracle.com/cd/E18752_01/html/821-1912/flashcreate-66.html

    -> Boot in single user from a cdrom or boot with failsafe mode

        Insert cd

     ok> boot cdrom –s

    OR

    ok> boot -F failsafe


    2. Mount your root file system.

       I will assume that is /dev/dsk/c1t1d1s0.

        mount /dev/dsk/c1t1d1s0 /a


    3. Create a new file system for /var

        format

        Select the disk you want to use.

       Create a partition of the size you want.

       I'm going to assume that is /dev/dsk/c1t1d1s3

       Remember to label the disk.


    4. Create a new file system on the /var disk slice.

        newfs /dev/dsk/c1t1d1s3


    5. Mount the new var partition (anywhere will do)

        mount /dev/dsk/c1t1d1s3 /b


    6. Copy the data in the old var directory to the new var file system.

        cd /a/var; tar cf - .| (cd \b; tar xfBp -)


    7. If you are sure everything has copied over to /b, delete your old data.

        /bin/rm –r /a/var/*

        Keep the directory /a/var.

            This is the mount point for the new file system


    7. Edit /etc/vfstab on your root partition.

       This is mounted on /a.

        vi /a/etc/vfstab


       The entries for root and var will look something like this:


    /dev/dsk/c1t1d1s0 /dev/rdsk/c1t1d1s0 /    ufs 1  no -

    /dev/dsk/c1t1d1s3 /dev/rdsk/c1t1d1s3 /var ufs 1  no -


    8. Cross your fingers.


    9. Reboot on the original root file system.


    10. df –k   to check. You should see something like this:


    /dev/dsk/c1t1d1s0 20646121 5524089 14915571    28%    /

    /proc             0       0       0     0%    /proc

    mnttab        0       0       0     0%    /etc/mnttab

    fd              0       0       0     0%    /dev/fd

    /dev/dsk/c1t1d1s3 10332460  651767 9577369     7%    /var

    swap    14901952     192 14901760     1%    /var/run

    swap    14907168    5408 14901760     1%    /tmp



    Thanks

    Anil