• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 647
  • Last Modified:

How to increase filesystems in Solaris 8

How do I modify partition 7 to be 10Gb instead of 25Gb and mount it as /home and then increase partition 6 to 16Gb without losing anything in /usr

Here is what my layout looks like:

Filesystem            Size  Used Avail Use% Mounted on
/dev/dsk/c0t2d0s0     236M   53M  160M  25% /
/dev/dsk/c0t2d0s6     4.0G  2.4G  1.6G  62% /usr
/dev/dsk/c0t2d0s5     4.0G   18M  3.9G   1% /var
swap                  2.4G   16K  2.4G   1% /var/run
/dev/dsk/c0t2d0s4     2.0G  2.1M  1.9G   1% /opt
swap                  2.4G   16K  2.4G   1% /tmp
/dev/dsk/c0t2d0s7      25G  9.0K   25G   1% /export/spare


Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -   125      251.02MB    (126/0/0)     514080
  1       swap    wu     126 -  1154        2.00GB    (1029/0/0)   4198320
  2     backup    wu       0 - 19155       37.27GB    (19156/0/0) 78156480
  3 unassigned    wu       0                0         (0/0/0)            0
  4 unassigned    wm    1155 -  2183        2.00GB    (1029/0/0)   4198320
  5        var    wm    2184 -  4240        4.00GB    (2057/0/0)   8392560
  6        usr    wm    4241 -  6297        4.00GB    (2057/0/0)   8392560
  7       home    wm    6298 - 19155       25.02GB    (12858/0/0) 52460640

Any help would be GREATLY appreciated.

2 Solutions

First and foremost, make a complete backup of all partitions on the disk, especially /usr using ufsdump.

Now, as you want to change /usr you are going to have to do it after booting from a different device, e.g. CD.

I am assuming that you are booting in single-user mode from CD.

As you are just rearranging the space between two adjacent partitions it's a relatively straightforward process.

Essentially the steps you need to perform are:

1. Backup /usr and /export/spare.  You could back them up to /var if you wanted as there is plenty of space there.

2. Boot in single-user mode from CD.

3. Run 'format' and resize partitions 6 and 7.

4. Label the disk within format.

5. Create new filesystems using newfs.

6. Restore /usr and /export/spare from backup using ufsrestore.

6. Edit /etc/vfstab to reflect new mount point for slice 7.

7. Disable automount from running (this messes with /home).

8. Reboot.

Do you need more details?

Regards, Nisus
you can use Disksuite to configure the growfs to extended  any partition ,you can continus to extend to partition , but you need to backup the system everyday, because if the HDD is error , you can't mount the again , it may be cause the data loss.
you can use ln  for big directory

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!


I would go with Nisus suggestion.

With growfs, I was under the impression that all devices have to be meta devices before you can grow them ? Is this right ?

Also, the `ln` command is a temp fix. A nasty temp fix infact. Using this method will introduce errors / issues with ufsdump and tar archive commands if not thought out properly. Certain archive commands need additional flags to either prevent or make them work over different ufs.

But, like everything in the world of administration, its time, money and whether you have all the orginal installation disks and necessary backups if all goes wrong :-)

couple of nits.

I assume /export/spare is not in use.  You should back up everything, especially /usr, on general principle in case a finger check causes problems, but if nothing is really critical and backups would be difficult, it may not be worth it.

You can remove /export/spare from /etc/vfstab before starting, then you won't have to mess with automounter.

You can grow the filesystem in place with:
/usr/lib/fs/ufs/mkfs -F ufs -M [mount point] /dev/rdsk/c?t?d?s? [new size]
I think new size is # of blocks, which you can get from format or df.  I never did this except from volume manager, so my notes use vxprint to get the new size.  Try setting up a small filesystem somewhere before doing this on your live system.  You may need to have /usr unmounted when you do this, which would mean at least single user mode and maybe booting from CDROM.
zeek_jaAuthor Commented:
I think it necessary to elaborate...

true the /export/spare is not currently used and is 25Gb,
the /usr is 4Gb.

I do not have a backup system in place (i.e. tape drive or cd-burner) and i have yet to receive my installation media from Sun.

So i guess by the looks of things my options are limited. As for growfs... i don;t have any such tool on my system. Is this software downloadable from somewhere.. will it cost me anything?

The comment from SqrFolkDnc seems to be the most viable solution but having elaborated somewhat, i feel it's only fair to let you all respond again since ii may not have been clear from the start what my config was.

best regards...
Hi again,

The mkfs command is normally called by newfs and will not grow the filesystem.  It will create a new filesystem.

You can download the Solaris CDs from Sun's site for free.

There is plenty of room on /var to backup /usr so there should be no problems.

Use ufsdump to backup /usr to a file on /var

Veritas Volume Manager can grow filesystems but it cannot shrink them unless you are using the Veritas File System (VxFS).

If you bought both Veritas products you could achieve what you wish even while the system is running.

Be careful, Nisus
Wait a second, why make things hard?

first, you have 29 gb in partitions 6 & 7, but you are only planning for 26 GB, do you intend to leave 3 gb unused?

If this is unclear post a question and I will elaborate.  This can all be done while booted from your normal system (don't need to boot from cdrom), but would probably be better to be in single user mode, or at least shut down as much as possible.  If any applications have log files in /usr, those files could end up in a state like they would be in if the system crashed hard.


method #1 (easier, but leaves /home as slice 6 and /usr as slice 7)
1. take /export/spare out of vfstab and unmount it.
2. go into format and change define a partition of 16 gb at the end of the physical disk.
3. from root directory, "touch reconfigure" and reboot.
4. do a newfs on the new partition 7
5. create a directory /newusr
6. then update vfstab to call partition 7 /newuser
7. mount /newuser
8. copy all files from /usr to /newusr (with preserve and doing all subdirectories
9. update vfstab to call partition 7 /usr and remove the old partition 6 reference.
10. reboot
11. go into format and change partition 6 to be 10 gb
12. touch reconfigure in root directory and reboot
13. newfs partition 6
14. create /home directory
15. update vfstab to make partition 6 /home and 10 gb
16. mount /home

method 2 synopsis only
1. similar, but define /newusr as 4 gb at the end of the disk, and move everything in /usr to it. (simnilar to steps 1-10 above)
2. once partition 7 is /usr at the end of the disk, define a a /newerusr in the old location, but for 16 gb and move everything from /usr to it. (similar to steps 1-10 above, again)
3. once /newerusr has been restored to being called /usr, you can create /home at the end of the physical disk, leaving 3 gb free after /usr and before /home.  (similar to steps 11-16)
4. This would allow later growing /usr to 19 gb as I suggested in my prior append.
Hi zeek.  If you have Sun support for the machine, you can ask them for the format of the special mkfs command.  Don't take "can't do it" for an answer, they gave me that information in the first place (growing a filesystem in place).  They may try to tell you you need veritos volume manager (big $$), but you DO NOT.  I have done it.

Hi Nisus.

The alternate mkfs I pointed to in my previous append WILL grow a filesystem without erasing what is there.  I got that directly from level 2 suport at Sun, when I had to grow some filesystems on a production machine where I worked.  I was migrating a storage array from 4 gb disks to 19 gb disks, swapping a few disks at a time, mirroring to the new larger disks, breaking the mirror to the old disk, then growing the filesystem on the new disk.  That was all in disk suite, so my notes on the command use the number from a disk suite query command, but I do remember it was available from some option of df or from format also, maybe needing some kind of calculation.

I had to push hard to get Sun to tell me about the secret version of mkfs and its special option.

Hmmm, let me think.  Maybe the number is the starting block, i.e. 1 bigger than the last block already formatted.  I will have to play with that when I get my personal system set up.

But anyway, my second append, just above, eliminates the need for the special mkfs command until he wants to grow the /usr again and doesn't have space to do multiple moves.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Points split Nisus &  SqrFolkDnc

Please leave any comments here within the next four days.


EE Cleanup Volunteer

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now