Increase space in /var

Hi

Please can I have some help in increasing

/var

in my

solaris 10

server.
At the moment the size configured is small and I need to expand it:

 df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0      869M   510M   307M    63%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   3.8G   1.6M   3.8G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/dev/dsk/c1t0d0s6      4.7G   3.3G   1.4G    71%    /usr
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1
                       869M   510M   307M    63%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
                       869M   510M   307M    63%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
/dev/dsk/c1t0d0s3      237M    93M   121M    44%    /var
swap                   3.8G    96K   3.8G     1%    /tmp
swap                   3.8G    56K   3.8G     1%    /var/run
/dev/dsk/c3t500A09829DE3E799d0s6
                       197G    75G   120G    39%    /u01
/dev/dsk/c3t500A09829DE3E799d1s6
                       197G    24G   170G    13%    /u02
/dev/dsk/c1t0d0s5      232M   132M    77M    64%    /opt
/dev/dsk/c1t0d0s1      622M   405M   161M    72%    /usr/openwin
/dev/dsk/c1t0d0s7       59G   2.2G    56G     4%    /export/home
bash-3.2#

How is this disk partitioned?

It looks like /dev/dsk/c1t0d0s4 isn't currently mounted. Can you expand slice 3 to add the space currently allocated to the slice 4, or is slice 4 being used but just not currently mounted?

s4 is probably empty (not used).
In order to give a suggestion for expanding partitions, we need your partition map

/usr/sbin/prtvtoc /dev/dsk/c1t0d0s0

Hello!

this is my partition map:

# /usr/sbin/prtvtoc /dev/dsk/c1t0d0s0
* /dev/dsk/c1t0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*     424 sectors/track
*      24 tracks/cylinder
*   10176 sectors/cylinder
*   14089 cylinders
*   14087 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00    4202688   1892736   6095423   /
       1      4    00    6095424   1353408   7448831   /usr/openwin
       2      5    00          0 143349312 143349311
       3      7    00    7448832    518976   7967807   /var
       4      3    01          0   4202688   4202687
       5      0    00    7967808    508800   8476607   /opt
       6      4    00    8476608   9972480  18449087   /usr
       7      8    00   18449088 124900224 143349311   /export/home
#

There are no unused blocks on your disk; all blocks are allocated to existing partitions.

If you want to increase the size of /var and you want to keep it on this disk, you'll have to back up all of the partitions on your disk, reformat it with a larger partition for /var and a smaller partition for one or more of your other filesystems, and then reload the partitions you modified from your backups.

1 Like

Thank you very much, I will do that,

But tell me what about space in slice 4?

Slice 4 isn't being used, but to make it part of /var it would have to contain blocks adjacent to slice 3. You could merge slice 0 and slice 4 to grow / , but you can't use the blocks in slice 4 to grow slice 3.

You could move slices 0 and 1 to use lower numbered blocks (keeping the same sizes) and and expand slice 3 using blocks no longer being used at the end of the current slice 1 to expand the start of slice 3.

1 Like

I dont have much experience in moving slices, or SVM, so I am bit reluctant to do that on a production server....

What is stopping you to create a virtual machine and learn ?

Regards
Peasant.

1 Like

they will give me an old v240 SUN server, and I will try on that

If there is a large directory hierarchy under /var , you could also use the existing slice 4 as /var/subdir (splitting /var into two filesystems). Note that this will only work if there are no hard links between files under /var/subdir and other parts of /var .

Mount slice 4 as /x , copy the current /var/subdir file hierarchy to /x , move /var/subdir to /var/oldsubdir , unmount /x , mount slice 4 as /var/subdir , resolve any differences you find between /var/oldsubdir and /var/subdir (which would only happen if files were being updated in /var/subdir while you were copying the old /var/subdir to the newly mounted partition), and then rm -rf /var/oldsubdir to free up the space that is now duplicated elsewhere.

Attention! s4 is marked with a flag, check with

swap -l

if it's used as a swap area.
If yes, you may not use it!!
Actually I would look if you can sacrifice the /export/home partition, this seems hardly used and over-dimensioned.

Is there more than one disk in that server? If so, you can use "liveupgrade" to create a new disk layout and after one reboot you are done with resizing everything to your needs...

https://docs.oracle.com/cd/E19455-01/806-7933/

for swap:

# swap -l
swapfile             dev  swaplo blocks   free
/dev/dsk/c1t0d0s4   32,28     16 4202672 4202672
/export/home/swapfile  -       16 4194288 4194288
#

two disk on the server

So you cannot use the slice 4; you would need to delete the swapfile on it, before you can use it for another purpose.
To follow up my idea in using the /export/home, could you run a

du -k /export/home

to see if there is any else data, besides the swapfile.

the output is:

# du -k /export/home
8       /export/home/lost+found
1       /export/home/sae/activation
1172    /export/home/sae/INdeleted
279     /export/home/sae/tumrecon
1       /export/home/sae/anni
1       /export/home/sae/Anni
251085  /export/home/sae
2349278 /export/home
#

Well, the most simple plan is to increase /var to 2GB.
With these steps
0. be sure you can login to a ILO, connect to the console, and login as root - you need that only in the case of a system recovery

  1. create another 2 GB swapfile on /export/home, and add it to swap
  2. delete the partition /dev/dsk/c1t0d0s4 from swap
  3. in format -> partition, change the flag from swap to var
  4. create a new file system on /dev/rdsk/c1t0d0s4
  5. mount /dev/dsk/c1t0d0s4 to /mnt
  6. copy over the data from /var to /mnt, using tar or cpio
  7. verify that /mnt looks like /var, then umount the /mnt
  8. in /etc/vfstab, change the /var line from /dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3 to /dev/dsk/c1t0d0s4 /dev/rdsk/c1t0d0s4
    9a. in /etc/vfstab, change the swap line from /dev/dsk/c1t0d0s4 to the new swapfile
  9. reboot with "shutdown -g 0 -i 6 -y", keep fingers crossed that it comes up
    If this is new for you, you should first practice on a non-productive system.