From: Neil Truby on
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(a)1f,0/ide@d/dad@0,0
1. c0t2d0 <ST340016A cyl 19156 alt 2 hd 16 sec 255>
/pci(a)1f,0/ide@d/dad@2,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted, no defect list found]

FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
show - translate a disk address
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> ver
Primary label contents:
Volume name = < >
ascii name = <ST340824A cyl 19156 alt 2 hd 16 sec 255>
pcyl = 19158
ncyl = 19156
acyl = 2
nhead = 16
nsect = 255
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


From: Ian Collins on
Neil Truby wrote:
> 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?
>
Why not just merge it with /? You could then create an new partition
and copy.

--
Ian Collins.
From: Neil Truby on
"Ian Collins" <ian-news(a)hotmail.com> wrote in message
news:1140316836.999088(a)drone2-svc-skyt.qsi.net.nz...
> Neil Truby wrote:
>> 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?
>>
> Why not just merge it with /? You could then create an new partition
> and copy.


How?

Also, / is quite small too.

cheers

Neil


From: Richard B. Gilbert on
Neil Truby wrote:
> 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(a)1f,0/ide@d/dad@0,0
> 1. c0t2d0 <ST340016A cyl 19156 alt 2 hd 16 sec 255>
> /pci(a)1f,0/ide@d/dad@2,0
> Specify disk (enter its number): 0
> selecting c0t0d0
> [disk formatted, no defect list found]
>
> FORMAT MENU:
> disk - select a disk
> type - select (define) a disk type
> partition - select (define) a partition table
> current - describe the current disk
> format - format and analyze the disk
> repair - repair a defective sector
> show - translate a disk address
> label - write label to the disk
> analyze - surface analysis
> defect - defect list management
> backup - search for backup labels
> verify - read and display labels
> save - save new disk/partition definitions
> volname - set 8-character volume name
> !<cmd> - execute <cmd>, then return
> quit
> format> ver
> Primary label contents:
> Volume name = < >
> ascii name = <ST340824A cyl 19156 alt 2 hd 16 sec 255>
> pcyl = 19158
> ncyl = 19156
> acyl = 2
> nhead = 16
> nsect = 255
> 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
>
>

Alas, there is no "Partition Magic" program for any Unix that I know of.
If somebody botches the initial partioning of the disk, the only thing
to do is back up everything on the disk, repartition it and restore.

For minor misfits, it's possible to use links to make files appear to be
where they ought to be and actually store them in another partition.
Yours does not appear to be such a case.

Current thought is that it's best to use the smallest possible number of
partitions; say, /, /var, and /export. Make each partition larger than
it needs to be; enough larger to last until you will be willing to back
up and repartion again. Every patch you apply will take a piece of /
and a piece of /var. You want /var in a separate partition because log
files, crash dumps, mail, print spooling, and other such stuff live
there and you don't want them crowding /.

If you are going to go to all that trouble, you might want to get a
bigger disk at the same time.
From: Andreas Buschmann on
Richard B. Gilbert <rgilbert88(a)comcast.net> wrote:
> Neil Truby wrote:
> > 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?
> >
> > # 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
> > format> ver
> > Primary label contents:
> > Volume name = < >
> > ascii name = <ST340824A cyl 19156 alt 2 hd 16 sec 255>
> > pcyl = 19158
> > ncyl = 19156
> > acyl = 2
> > nhead = 16
> > nsect = 255
> > 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


> Alas, there is no "Partition Magic" program for any Unix that I know of.
> If somebody botches the initial partioning of the disk, the only thing
> to do is back up everything on the disk, repartition it and restore.

That is, where software RAID 1 is really helpfull.

The following works, if you use mirrored disks:

You can unmirror the disks, repartition disk2, remirror the disks,
and some hours later, when everything is stable unmirror the disks
again, repartition disk0, grow the filesystem on /var and /.

Note that you either have to have unused space, or have to be able to
unmount the filesystem which has to shrink, or habe to replace the disks
with bigger disks. SCA disks are hot plugable, IDE disks are not!

1) do a full backup to a tape or another computer.

2) you did that full backup?

repartition disk 2:

3) metadb -d <device 2>
remove the meta information from the second device.

4) for each slice in d0 d2 d104 d103 d102 d101 d105
metadetach $slice <slice on disk 2>
metaclear <slice on disk 2>

you need some extra commands to get rid of the soft partitions on <disk 2>

5) repartition <disk 2> as you need it.

6) If you have to shrink one filesystem /foobar do the following:

newfs /dev/dsk/c0t2d0sX
mount -F ufs /dev/dsk/c0t2d0sX /mnt
stop all the applications on the filesystem /foobar.
copy everythig from the old filesystem /foobar to /mnt using either
dump/undump or cpio or rsync .
umount /foobar
umount /mnt

metaclear <device of /foobar>
metaclear <submirror of /foobar on disk 0>

metainit <submirror of /foobar on disk 2> 1 1 c0t2d0sX
metainit <device of /foobar> -m <submirror of /foobar on disk 2>

mount /foobar

7) metainit the rest of the partitions on <disk 2>
metattach this partitions to the devices d0 d2 d104 d103 d102 d101 d105

8) metadb -a -c 3 <device 2>

9) if you have replaced the disk, and cylinder 0 is not part of a mirror,
you need to add the bootblock:

installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk ...

10) wait until all the mirrors are synced.
(can be 4 hours)

repartition disk 0:

11) metadb -d <device 0>

12) for each slice in d0 d2 d104 d103 d102 d101 d105
metadetach $slice <slice on disk 0>
metaclear <slice on disk 1>

you need some extra commands to get rid of the soft partitions on <disk 0>

13) repartition <disk 0> to thes same as <disk 2>.

14) metainit the partitions on <disk 0>
metattach this partitions to the devices d0 d2 d104 d103 d102 d101 d105

15) metadb -a -c 3 <device 0>

16) if you have replaced the disk, and cylinder 0 is not part of a mirror,
you need to add the bootblock:

installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk ...

grow the filesystem(s) to the new size of the partition(s):

17) growfs -M /var /dev/md/rdsk/d2

18) wait until all the mirrors are synced.


Now you are through.

I have left out how to handle the soft partitions, as I havn't used them yet.


Regards
Andreas

p.s. I have done this on a live system, but mostly to replace the disks
with bigger disks. (This was with a SunFire V210 and SCA disks.)
p.s. This is without guarantees.
I would recommend to try this on a test system, and write down all
the necessary commands exactly before doing it to your running system.

--
* Andreas Buschmann Internet PoP Hannover GmbH
 |  Next  |  Last
Pages: 1 2 3 4
Prev: T1000 vs. T2000
Next: Roles in Solaris10