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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expand an mounted UFS filesystem. 1

Status
Not open for further replies.

cfsalmeida

IS-IT--Management
Feb 8, 2001
338
PT
Certainly many of you guys already know this ..., it's possible to expand a ufs filesystem mounted or unmounted
if disk space is continuous with an undocument flag from mkfs "-G", eg:

imagine you have a disk with the followin layout:
[prtvtoc output]
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 0 2100735 2100734 /
1 3 00 2100735 1052163 3152897 swap
2 5 00 0 17682084 17682083 backup
3 7 00 3152898 1052163 4205060 /var
4 0 00 4205061 8392167 12597227 /usr/local
6 0 00 12597228 5077674 17674901 /export
7 0 00 17674902 7182 17682083

so you have a urgent need for contiguous space in partition 4 "/usr/local", now with 4GB, we have a partition 6 "/export" with 2.42GB, so we can move "/export" to another disk and then with format we change disk layout to join partion 6 blocks to partition 4, and label the disk again to get:
[prtvtoc output]
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 0 2100735 2100734 /
1 3 00 2100735 1052163 3152897 swap
2 5 00 0 17682084 17682083 backup
3 7 00 3152898 1052163 4205060 /var
4 0 00 4205061 13469841 17674901 /usr/local
7 0 00 17674902 7182 17682083

okay now we can expand the partion 4 with mkfs using the undocumented flag -G of "/usr/lib/ufs/mkfs":
/usr/lib/fs/ufs/mkfs -G -M /current/mount /dev/rdsk/cXtYdZsA newsize

specifying the current mount point and raw device as well as the new size in 512 byte blocks

before:
#df -k /usr/local
Filesystem kbytes used avail capacity Mounted on
c0t0d0s4 4131384 9 4090062 1% /usr/local

#/usr/lib/fs/ufs/mkfs -G -M /usr/local /dev/rdsk/c3t9d0s4 13469841

/dev/rdsk/c0t0d0s4: 13469840 sectors in 3751 cylinders of 27 tracks, 133 sectors 6577.1MB in 235 cyl groups (16 c/g, 28.05MB/g, 3392 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 57632, 115232, 172832, 230432, 288032, 345632, 403232, 460832, 518432,
...
...
...
#
now:
#df -k /usr/local
Filesystem kbytes used avail capacity Mounted on
c0t0d0s4 6631500 9 6590178 1% /usr/local

I already use this even on root filesystem of a Solaris 8 Intel machine with sucess...

Regards,

Carlos Almeida,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top