Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to proper extentd /opt partition solaris

Status
Not open for further replies.

bojus

IS-IT--Management
Jul 27, 2010
7
PL
Hi,

I have one disk and want to extend space on opt parition:

/dev/dsk/c2t0d0s4 14G 11G 3.7G 74% /opt

and format command shows below:

ev/dsk/c2t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c2t0d0s1 is currently used by swap. Please see swap(1M).
/dev/dsk/c2t0d0s3 is currently mounted on /var. Please see umount(1M).
/dev/dsk/c2t0d0s4 is currently mounted on /opt. Please see umount(1M).
/dev/dsk/c2t0d0s5 is currently mounted on /export/home. Please see umount(1M).


Part Tag Flag Cylinders Size Blocks
0 root wm 3771 - 5045 9.77GB (1275/0/0) 20482875
1 swap wu 1 - 523 4.01GB (523/0/0) 8401995
2 backup wm 0 - 8871 67.96GB (8872/0/0) 142528680
3 var wm 6959 - 8871 14.65GB (1913/0/0) 30732345
4 unassigned wm 5046 - 6958 14.65GB (1913/0/0) 30732345
5 home wm 2496 - 3770 9.77GB (1275/0/0) 20482875
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0

Coukld you gve me a hint how to proper do the extension of opt partition?

thx for any advice
 
need a bit more information on this.

1) what Os version are you running?
2) provide more /etc/vfstab
3) what model system is it.
4) df -k or df -h depending on OS

most likely you are up the creek on this but will tell you when you provide the info requested.
 
Hi,

iostat shown me the disk size 73GB and it is ufs, and df -h below:

Filesystem size used avail capacity Mounted on

/dev/dsk/c2t0d0s0 9.6G 7.9G 1.6G 84% /

/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 5.6G 968K 5.5G 1% /etc/svc/volatile

objfs 0K 0K 0K 0% /system/object

sharefs 0K 0K 0K 0% /etc/dfs/sharetab

/usr/lib/libc/libc_hwcap1.so.1

9.6G 7.9G 1.6G 84% /lib/libc.so.1

fd 0K 0K 0K 0% /dev/fd

/dev/dsk/c2t0d0s3 14G 6.1G 8.2G 43% /var

swap 7.0G 1.4G 5.5G 21% /tmp

swap 5.5G 40K 5.5G 1% /var/run

/dev/dsk/c2t0d0s4 14G 11G 3.7G 75% /opt

/dev/dsk/c2t0d0s5 9.6G 6.0G 3.5G 64% /export/home


it is Solaris 10 an from prtdiag:

Sun Microsystems SUN FIRE X4150


cat /etc/vfstab

#device device mount FS fsck mount mount

#to mount to fsck point type pass at boot options

#

fd - /dev/fd fd - no -

/proc - /proc proc - no -

/dev/dsk/c2t0d0s1 - - swap - no -

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

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

/dev/dsk/c2t0d0s5 /dev/rdsk/c2t0d0s5 /export/home ufs 2 yes -

/dev/dsk/c2t0d0s4 /dev/rdsk/c2t0d0s4 /opt ufs 2 yes -

/devices - /devices devfs - no -

ctfs - /system/contract ctfs - no -

objfs - /system/object objfs - no -

swap - /tmp tmpfs - yes -

sharefs - /etc/dfs/sharetab sharefs - no -



I affraid, it can be difficult...

 
bummin!!!

you said you want to expand /opt but notice your root file system is at 84% capacity so you would also really want to expand that.

Best bet is to get a 146gb drive put it into open slot and partition the drive the way you want (but make the ufs filesystem sizes larger.. ex / is 9.6gb make it 15gb atleast, etc etc.)

Then you can ufsdump from c2t0d0s# to the new drive partitions
install a new boot block on the new drive
power down, move new drive into original drive slot
and boot back up..very simple

I will update the ufsdump stuff with instructions later. It is very simple.

chris
 
Hi thanks for the help,

but when we count the cylinders we can see there is space on the disk and we can use it for expanding the partition.


And what is the procedure are you talking about?

BR
TOmek
 
I see what you are talking about. Basically you did not assign cylinder 524 through 2495. Your problem however is the available cylinders are not contiguous cylinders to /opt cylinders and if you tried to add the space it would destroy other partitions.

You need to have contiguous cylinders available.

this link will give you the jist of using ufsdump drive to drive. Of course some of it is not relevant to you. I have to say that I have done this multiple times on Sparc based units and not on the x86 systems(this is something I will need to try myself).

you would not want to use prtvtoc to create the partitions on the new drive because you want to change that.

for the bootblk it is different in x86 than solaris sparc see below.

Example - SPARC(R) Platform:

[ root ] # /usr/sbin/installboot/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0
NOTE: The previous examples are based on the assumption that the boot disk is c0t0d0 and the root partition is s0; modify your commands as appropriate for your configuration.

Example - Sun x86 Platform:

[ root ] # /usr/sbin/installboot/usr/platform/`uname -i`/lib/fs/ufs/pboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk
/dev/rdsk/c1t0d0s2




The most appropriate commands to create a copy of a non encapsulated boot disk are ufsdump and ufsrestore.

As described, the operation will be made booted from another Solaris Image (CDROM/Net) to fulfill the ufsdump requirements to be run on unmounted/read-only file systems. This document gives details of the procedure to perform this operation.
Solution
This procedure assumes the following:

*

The boot disk to be backed up is c0t0d0 and partitioned as follows:
o

s0 is tagged root and mounted on /
o

s1 is tagged swap and is a swap device
o

s2 is the backup (the whole disk)
o

s4 is tagged var and mounted on /var
o

s5 is tagged unassigned and mounted on /opt
o

s6 is tagged usr and mounted on /usr
*

The boot disk copy is c1t0d0
*

PATH=/usr/sbin:/usr/bin

1. Bring the system down to the ok prompt.

# init 0

2. Either boot from a Solaris CDROM or from the net if a Boot Server is installed on the subnet.

ok boot cdrom -s # Boot from a Solaris CDROM

ok boot net -s # Boot from a Solaris Image on the net

3. Ensure that the original filesystems on the boot disk are consistent.

# fsck /dev/rdsk/c0t0d0s0

# fsck /dev/rdsk/c0t0d0s4

# fsck /dev/rdsk/c0t0d0s5

# fsck /dev/rdsk/c0t0d0s6

Do not fsck slice 1 (swap, a raw device without a filesystem on it) or slice 2 (backup).

4. Partition the intended boot device.

If you want an exact copy of c0t0d0, assuming that c1t0d0 is of the same capacity and similar in type, simply copy the VTOC (Volume Table of Contents) from c0t0d0 to c1t0d0 using the following command:

# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c1t0d0s2

If c1t0d0 is a different hard drive and/or you want to get a different slice configuration with greater slices, use the format command. Enter the partition menu and for each slices (0, 1, 4, 5 and 6 in our example) set up as required. Type print to check then label to save the partition table on to the disk.

5. Run newfs to create a Unix File System on each created partition (except 1 and 2).

# newfs /dev/rdsk/c1t0d0s0

# newfs /dev/rdsk/c1t0d0s4

# newfs /dev/rdsk/c1t0d0s5

# newfs /dev/rdsk/c1t0d0s6

6. Mount the newly created root partition and perform backup and restore from slice 0 on the source disk (c0t0d0s0) to slice 0 on the target disk (c1t0d0s0)

# mount /dev/dsk/c1t0d0s0 /a

# ufsdump 0f - /dev/rdsk/c0t0d0s0 | (cd /a ; ufsrestore xf -)

7. Mount the other partitions and perform their backup/restore in the same way.

# mount /dev/dsk/c1t0d0s4 /a/var

# mount /dev/dsk/c1t0d0s5 /a/opt

# mount /dev/dsk/c1t0d0s6 /a/usr

Note: The var, opt and usr mount points do no need to be created because they are directories from slice 0 created by the backup/restore process in in step 6.

# ufsdump 0f - /dev/rdsk/c0t0d0s4 | (cd /a/var ; ufsrestore xf -)

# ufsdump 0f - /dev/rdsk/c0t0d0s5 | (cd /a/opt ; ufsrestore xf -)

# ufsdump 0f - /dev/rdsk/c0t0d0s6 | (cd /a/usr ; ufsrestore xf -)

8. Modify the /etc/vfstab file in the root partition on the new disk to change the device names to reflect the new disk (for instance: c0t0d0 to c1t0d0). You can use the vi editor for this or sed as follows:

# cd /a/etc

# mv vfstab vfstab.old

# sed '1,$ s/c0t0d0/c1t0d0/g' vfstab.old > vfstab

9. Unmount all the partitions attached to /a.

# cd / ; umountall

10. Run the installboot command to install a new boot block on that disk. Not loading a boot block will leave this disk in an unbootable state as the boot strap program is contained within the boot block.

# cd /usr/platform/`uname -i`/lib/fs/ufs

# installboot bootblk /dev/rdsk/c1t0d0s0

NOTE: for SunOS 5.4 and earlier, the boot block is in /usr/lib/fs/ufs.

11. At this step, the new boot device is ready to be used. Just need to go back to the ok prompt (init 0) and update some OpenBoot PROM variables if necessary.

1.

Check and if necessary create an alias for this disk using devalias.
2.

Use this alias to update the boot-device variable if required.
3.

Boot from this alias to confirm the whole operation:

ok boot disk1
 
Hi,

sorry, that I didn't write any words till now.

Thanks a lot for the procedure :)

but I'm inclined to utilize these unused cylinders. This host is production server and it could be problematic to switch it off. And I need only some space to redirect statistics. Additionally I'm thinking about obtaining space after removing staroffice(somebody installed it during installation solaris and I took the machine over..with all stuff).

You think adopting the space between these cylinder while server is working could be dangerous?

thanks
BR
bojus
 
Hi,

There is another option to extend, as previously told by cndcadams that cylinders are not contiguous to extend the slice 4.

So you can create another slice on cylinders range 524-2495 and you can make a RAID 0 level volume of both slices using SVM. then use growfs command to expand the Filesystem Size.

You can do this process without loosing any data but its always good to create backup first.


Regards
usman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top