We help IT Professionals succeed at work.

Extend /var

ardenta
ardenta asked
on
649 Views
Last Modified: 2013-12-27
SunOS xxxsrv01 5.9 Generic_117171-07 sun4u sparc SUNW,UltraAX-i2
I have 2 internal disks identically formatted and mirroed using Sun Volume Manager.

This system has been set up with a ridiculously small /var.  Also the remaining disk after /var has all been used.  But even if I reduce slice 6, which just has a load of soft partitions in it, so that it leaves some free space immediately after the end of slice 1 (/var), how can I safely extend /var into the newly-created free space?

Thanks
Neil

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/md/dsk/d0       2181903 1815591  322674    85%    /
/proc                      0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
fd                         0       0       0     0%    /dev/fd
/dev/md/dsk/d2         67639   44213   16663    73%    /var
swap                  691864      40  691824     1%    /var/run
swap                  691824       0  691824     0%    /tmp
/dev/md/dsk/d104      481135    1041  431981     1%    /usr2
/dev/md/dsk/d103      721711   37376  626599     6%    /cmh
/dev/md/dsk/d102      721711  293503  370472    45%    /opt/informix
/dev/md/dsk/d101     10324172 6265558 3955373    62%    /export/home
/dev/md/dsk/d105     1985327 1096013  829755    57%    /var/informix
# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <ST340824A cyl 19156 alt 2 hd 16 sec 255>
          /pci@1f,0/ide@d/dad@0,0
       1. c0t2d0 <ST340016A cyl 19156 alt 2 hd 16 sec 255>
          /pci@1f,0/ide@d/dad@2,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted, no defect list found]

 Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm     258 -  1349        2.12GB    (1092/0/0)   4455360
  1        var    wm    1350 -  1385       71.72MB    (36/0/0)      146880
  2     backup    wm       0 - 19155       37.27GB    (19156/0/0) 78156480
  3 unassigned    wu       1 -     5        9.96MB    (5/0/0)        20400
  4 unassigned    wm       6 -    10        9.96MB    (5/0/0)        20400
  5       swap    wm      11 -   257      492.07MB    (247/0/0)    1007760
  6 unassigned    wm    1386 - 19155       34.57GB    (17770/0/0) 72501600
  7 unassigned    wm       0                0         (0/0/0)            0
Comment
Watch Question

IT Consultant and Infrastructure Architect
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
# metastat d2
d2: Mirror
    Submirror 0: d23
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 146880 blocks (71 MB)

d23: Submirror of d2
    State: Okay
    Size: 146880 blocks (71 MB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t0d0s1          0     No            Okay   Yes


Device Relocation Information:
Device   Reloc  Device ID
c0t0d0   Yes    id1,dad@AST340824A=3HE0A47P

Commented:
This is me thinking-typing out load.

You can safely extend /var but you'll have to destroy/recreate your software partitions in slice 6.  This is going to have to be a fairly manual process.

1) Backup all your softpartitions and /var using ufsdump storing into files.  Put the files on another system (as there's no space on this system to hold the files)
2) Break SVM mirrors on /var and slice 6.  Revert /etc/vfstab back to physical disk path names rather then SVM names.   You should do this in single user mode.  This will require a reboot.  Destroy SVM metadevice for slice 6 and /var (not absolutely sure this is required - I think growfs understands how to extend SVM devices but better safe then sorry.)
3) Unmount soft partitions and destroy soft partitions
4) Use format and extend slice 1 into the beginning of slice 6.
5) Use growfs to extend the existing /var into it's now larger physical partition (see https://www.experts-exchange.com/Operating_Systems/Solaris/Q_21731182.html as an example)
6) Re-newfs slice 6
7) Recreate soft partitions
8) Remount and restore soft partition contents
9) Recreate SVM metadevices and recreate mirror configuratoin
10) Go back into multi-user mode
Hanno P.S.IT Consultant and Infrastructure Architect
CERTIFIED EXPERT

Commented:
OK, therefore
a) your d2 is a mirror made of the one-way mirror d23. (but, where is the second?)
b) you have to create the same number of new mirrors (let's say d27 and d28)
    which must both have the same size each
    metainit 1 1 d27 c?d?...
    metainit 1 1 d28 c?d?...
c) concat d23 and d27
e) growfs on d2

Make sure you have at least two one-way mirrors for each mirror active.
metastat -p d2 should show something like
  d2 -m d23 d24 1
  d23 1 1 c0t0d0s3
  d24 1 1 c0t1d0s3

Commented:
While JustUnix answer may work, I would advise against it.  You don't want to slice-and-dice your primary root file systems.  You want them contiguous and directly addressable - say from a bootable CDROM or whatever.

Author

Commented:
>> OK, therefore
a) your d2 is a mirror made of the one-way mirror d23. (but, where is the second?)

d24, but I've detached it in readiness!
Hanno P.S.IT Consultant and Infrastructure Architect
CERTIFIED EXPERT

Commented:
>> d24, but I've detached it in readiness!

I see -- that's fine!

If possible, I'd also suggest you'll try to keep at least /, /var in contiguous space. If possible, you could
do this by getting a third disk and copy your existing filesystems onto these "in a clean way"

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.