UNIX System Administration Handbook - Evi Nemeth [92]
format> label
Ready to label disk, continue? y
format> partition
PARTITION MENU:
...
partition> print
Current partition table (default):
Total cylinders available: 9994+2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 0-28 130.05MB (29/0/0) 266336
1 swap wu 29-57 130.05MB (29/0/0) 266336
2 backup wu 0-9993 43.77GB (9994/0/0) 91784896
...
6 home wm 58-9993 43.51GB (9936/0/0) 91252224
The default label is not very useful for our purposes, so we will increase the size of the backup root partition, increase the size of the swap partition, and decrease the size of the new home partition. The flags for the root and home partitions should be “wm” (writable and mountable), and the flags for the swap partition should be “wu” (writable and not mountable). The following excerpt shows how to do one partition; the others are configured similarly.
partition> 0
Part Tag Flag Cylinders Size Blocks
0 root wm 0-28 130.05MB (29/0/0) 266336
Enter partition id tag[root]: root
Enter partition permission flags[wm]: wm
Enter new starting cyl[0]: 0
Enter partition size[266336b, 29c, 130.05mb, 0.13gb]: 2gb
Once you have sized all the partitions, print out the partition table again to verify that it looks OK. Make sure that no partitions overlap (or at least, no partitions that you plan to use); filesystem corruption will almost certainly result. When you’re sure everything is right, type label again to rewrite the new partition information. In our example:
partition> print
Current partition table (unnamed):
Total cylinders available: 9994 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 0-456 2.00GB (457/0/0) 4197088
1 swap wu 457-2283 8.00GB (1827/0/0) 16779168
2 backup wu 0-9993 43.77GB (9994/0/0) 91784896
6 home wm 2284-9993 33.76GB (7710/0/0) 70808640
partition> label
Ready to label disk, continue? yes
To exit format, enter the quit command twice: once to get out of partition mode, and once to leave format.
partition> quit
format> quit
Now that we’ve labeled the disk, we’re ready to create filesystems for the backup root and user filesystems.
# newfs /dev/rdsk/c0t3d0s0
newfs: construct file system /dev/rdsk/c0t3d0s0: (y/n)? y
/dev/rdsk/c0t3d0s0: 4197088 sectors in 457 cylinders of 28 tracks, 328 sectors
2049.4MB in 42 cyl groups (11 c/g, 49.33MB/g, 8000 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 101392, 202752, 304112, 405472, 506832, 608192, 709552, 810912,
912272, 1013632, 1114992, 1216352, 1317712, 1419072, 1520432, 1621792,
...
We then check our newly created filesystems with fsck.
# fsck /dev/rdsk/c0t3d0s0
** /dev/rdsk/c0t3d0s0
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 9 used, 2055846 free (14 frags, 256979 blocks, 0.0% fragmentation)
We would also run newfs and fsck on partition 6, but that’s not shown here.
Once the filesystems have been created, we can go ahead and mount them. mount uses block device files (in /dev/dsk) rather than character device files (in /dev/rdsk) to access the partition.
Newer versions of Solaris support journaling on UFS filesystems (the default filesystem type). By writing metadata changes to a separate part of the disk known as the log before copying them out to their permanent home, you can guarantee filesystem consistency. This feature is especially handy for large filesystems that take a long time to fsck after a system crash.
To enable journaling (aka logging), pass the -o logging flag to mount (or put it in your /etc/vfstab file). When the system comes back up, fsck will simply roll the log instead of performing a complete check. It’s normally a good idea to use this option; however, we omit it from our testing below in the interest of clarity.
We’re finally ready to mount