Extending the / file system (SVM)

Hi,

I currently have a Solaris 10 server with the / root file system using SVM. Here is the information of the current setup.

Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/d0         3.0G   635M   2.3G    22%    /
 
bash-3.2# metastat d0
d0: Mirror
    Submirror 0: d10
      State: Okay         
    Submirror 1: d20
      State: Okay         
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 6309120 blocks (3.0 GB)
d10: Submirror of d0
    State: Okay         
    Size: 6309120 blocks (3.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t0d0s0          0     No            Okay   Yes 
 
d20: Submirror of d0
    State: Okay         
    Size: 6309120 blocks (3.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t1d0s0          0     No            Okay   Yes 
 
Device Relocation Information:
Device   Reloc  Device ID
c0t0d0   Yes    id1,sd@n5000c50012e2ffef
c0t1d0   Yes    id1,sd@n5000c50012e304df

In order to expand the / root file system, I think I'll have to create another mirror set (d7) using another pair of slices (c0t0d0s7, c0t01d0s7). I have read several cases that growfs cannot grow the mounted / file system??

metainit d71 1 1 c0t0d0s7
metainit d72 1 1 c0t1d0s7
metainit d7 -m d71
metattach d7 d72
newfs /dev/md/rdsk/d7

Mount and copy contents

mount /dev/md/dsk/d7 /mnt
ufsdump -0uf - / | (cd /mnt/ && ufsrestore -f - )
umount /mnt

Install bootblock

installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/md/rdsk/d7

Update the vfstab and system

cp /etc/vfstab /etc/vfstab.bak
cp /etc/system /etc/system.bak
 
metaroot /dev/md/rdsk/d7
 
mount /dev/md/dsk/d7 /mnt
# copy the new vfstab and system
cp /etc/system /mnt/etc/system
cp /etc/vfstab /mnt/etc/vfstab
umount /mnt
 
# restore the original vfstab and system
mv /etc/system.bak /etc/system; mv /etc/vfstab.bak /etc/vfstab
 

Since the boot disk is located on the same disk but different slices (s0 before, s7 now), do i have to make any changes to the boot-device from OBP? (setenv boot-device {dev})

And I have installed the boot block to slice s7 (d7). Slice s0 (d0) should also have a boot block and this would confuse the boot process the slice to boot from. How do overcome this issue?

Thanks,

I think for only expanding the existing / (without freeing the s0 slices) you can just add the two new slices:

metattach d10 c0t0d0s7
metattach d20 c0t1d0s7
metastat
growfs /dev/md/rdsk/d0

All online (growfs should be run during low traffic hours).
Because it is appended to the existing slices, you do not need to install another boot block.

Thanks. I wish that method worked, but executing your first step metattach d10 c0t0d0s7 gave me an error saying cannot expand root file system.

I ended up installing virtualbox and tried my method I posted, and with a bit of adjustment (installgrub instead of installboot, update boot archive), it worked out. Below in red is the adjustment I've made.

metainit d71 1 1 c0t0d0s7
metainit d72 1 1 c0t1d0s7
metainit d7 -m d71
metattach d7 d72
newfs /dev/md/rdsk/d7

Mount and copy contents

mount /dev/md/dsk/d7 /mnt
ufsdump -0uf - /dev/md/rdsk/d0 | (cd /mnt/ && ufsrestore -xf - )
umount /mnt

Install Grub, update boot archive, etc

installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t0d0s7
installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t1d0s7
 
bootadm update-archive -f -R /mnt
 
 
mount /dev/md/dsk/d7 /mnt
 
# modify /mnt/boot/grub/menu.lst and change it to the new root volume
title active
root (hd0,0,a) <- change a (s0) to h (s7)
 
# modify /mnt/boot/solaris/bootenv.rc and change it to the new root volume
# before bootpath=/pci@7b,0/pci1022,7458@11/pci1000,3060@2/sd@0,0:a
# after bootpath=/pci@7b,0/pci1022,7458@11/pci1000,3060@2/sd@0,0:h
 
metaroot -R /mnt /dev/md/rdsk/d7
umount /mnt
 

You just duplicated what live upgrade can do. Look at the man pages for live_upgrade, lucreate and luactivate.