Fixing a partition table
In this example, I have inherited a system with a boot disk that has a
poor layout. Unfortunately, I cannot non-destructively resize these UFS
file systems, even if they are part of an encapsulated Veritas root
disk. Fortunately, I have another disk that I may use as my new boot
disk.
Here is the original layout:
Current partition table
(original):
Total disk cylinders available:
4924 + 2 (reserved cylinders)
Part
Tag Flag
Cylinders
Size
Blocks
0 root
wm 1 -
74 129.75MB
(74/0/0) 265734
1 swap
wu 75 -
1157 1.85GB
(1083/0/0) 3889053
2
backup wu 0 -
4923 8.43GB
(4924/0/0) 17682084
3
unassigned wm
0
0
(0/0/0) 0
4
unassigned wm
0
0
(0/0/0) 0
5 usr
wm 1158 -
1742 1.00GB
(585/0/0) 2100735
6 usr
wm 1743 -
2751 1.73GB
(1009/0/0) 3623319
7 var
wm 2752 -
3336 1.00GB
(585/0/0) 2100735
root is only 130MB, and usr (slice 5) is only 1GB. Both are
smaller than I would like to use on this Solaris 8 system. Also, slice
6 should probably use a unique tag (it is the opt file system), and cylinders
3337
- 4923 are not used.
Here is layout I created on the new disk using format:
Current partition table
(original):
Total disk cylinders available:
4924 + 2 (reserved cylinders)
Part
Tag Flag
Cylinders
Size
Blocks
0 root
wm 0 -
292 513.75MB
(293/0/0) 1052163
1 swap
wu 293 -
1461 2.00GB
(1169/0/0) 4197879
2
backup wu 0 -
4923 8.43GB
(4924/0/0) 17682084
3
unassigned wu
0
0
(0/0/0) 0
4
unassigned wu
0
0
(0/0/0) 0
5 usr
wm 1462 -
2922 2.50GB
(1461/0/0) 5246451
6
alternates wm 2923 -
4383 2.50GB
(1461/0/0) 5246451
7 var
wm 4384 - 4922
945.09MB (539/0/0) 1935549
I left two partitions and one cylinder free so that this disk can be
put under Veritas control. Veritas requires these for its public and
private region of each disk, along with at least 2048 sectors to store
VxVM configuration information on the disk.
After labeling the partition table on the new disk, I created UFS file
systems for root, usr, opt, and var. The new disk is c0t86d0 in
this example.
# for slice in 0 5 6 7
> do
> newfs /dev/rdsk/c0t86d0s${slice}
> done
Create temporary mount points for the file systems:
# mkdir /tmp/root /tmp/usr /tmp/opt
/tmp/var
# mount /dev/dsk/c0t86d0s0 /tmp/root
# mount /dev/dsk/c0t86d0s5 /tmp/usr
# mount /dev/dsk/c0t86d0s6 /tmp/opt
# mount /dev/dsk/c0t86d0s7 /tmp/var
Use ufsdump to copy the file
systems from the old disk (c3t0d0 in this example):
# ufsdump 0f - /dev/rdsk/c3t0d0s0 |
(cd /tmp/root; ufsrestore xf -)
# ufsdump 0f - /dev/rdsk/c3t0d0s5 |
(cd /tmp/usr; ufsrestore xf -)
# ufsdump 0f - /dev/rdsk/c3t0d0s6 |
(cd /tmp/opt; ufsrestore xf -)
# ufsdump 0f - /dev/rdsk/c3t0d0s7 |
(cd /tmp/var; ufsrestore xf -)
Make the new boot disk bootable with installboot:
# installboot /usr/platform/`uname
-i`/lib/fs/ufs/bootblk /dev/rdsk/c0t86d0s0
Create a device alias in nvram for the new boot disk. I call it c0t86d0 in this example:
# ls -l /dev/dsk/c0t86d0s0
lrwxrwxrwx 1
root
root 74 Jul 24
09:09 /dev/dsk/c0t86d0s0 -> ../../devices/sbus@2,0/SUNW,socal@d,10000/sf@1,0/ssd@w2100002037093411,0:a
# eeprom "nvramrc=devalias c0t86d0
/sbus@2,0/SUNW,socal@d,10000/sf@1,0/ssd@w2100002037093411,0:a"
# eeprom "use-nvramrc?=true"
Modify the /etc/vfstab file
on
the new boot disk to use the correct SCSI ID.
# cd
/tmp/root/etc
# cp vfstab vfstab.bak
# sed 's/c3t0d0/c0t86d0/g' vfstab
>
vfstab.new; mv vfstab.new vfstab
Unmount the temporary mount points:
# umount /tmp/root
# umount /tmp/usr
# umount /tmp/opt
# umount /tmp/var
You may test booting off the new boot disk with reboot -- c0t86d0 or boot c0t86d0 at the Open Boot Prompt
(OBP). You may want to change the OBP boot-device
setting to use this disk as your first boot device.
Back to brandonhutchinson.com.
Last modified: 07/29/2003