If this is an external disk, you just need to go to single user mode.
The Sun default is to boot from the disk with SCSI ID 3, so if you are replacing your internal disk, life is simpler if you do this. If you don't, you will have to change the boot PROM parameters to arrange the system to boot from an alternate SCSI device. See "man eeprom" for details.
Assign an appropriate ID, either by switching the thumbwheel on the back of the housing of an external disk, or by changing the jumper blocks to assign the desired SCSI ID on an internal disk.
b sd(0,3,0)vmunix -s (with the old prom monitor)
boot disk vmunix -s (with the old prom monitor)and to boot from the network, say
b le() vmunix -s (with the old prom monitor)
boot net vmunix -s (with the old prom monitor)
To erase and format the disk, you need to know about the device geometry (e.g. how big it is, how many heads it has, how many platters on the spindle, etc.) and get this information into the table of formatting information that format uses. If format doesn't know what the disk is, then interrupt format and add a new entry to the /etc/format.dat file. With your favorite editor, edit /etc/format.dat and include the information in /tmp/disk.dat. There are two parts: 1) the geometry information; 2) a default partition table. These get put into two separate parts of the file (geometry comes first). See the file for information. Then put the partition info towards the end.
After you have /etc/format.dat built right, now format the disk. After the initial device selection (make sure you select the right disk - you will erase whatever you select), type
formatAfter a wait for a variable amount of time, the disk will be formatted.
The next step will be to build up a partition table.
Unix views a disk as having a bunch of individual little disks in it. This partitioning gets defined by the partition table, which is put into the label on a disk. So you must first build a partition table, then write the label (with the partition table) to the disk.
Use the "partition" command in format to define a partition table. Partitions are named a through h, corresponding to the device names sdXa-sdXh. Partitions have special meanings, so certain conventions apply. At Bristol Geology:
a is the root partition b is swap (not used by the file system, but by the Unix kernel) c is the whole disk (only used if the disk isn't a boot disk, and then this is the *only* partition used, otherwise not used by the file system) d-f local storage: /export, /ld0, /ld1, etc. g is the /usr partition h is the /tmp partitionThe partitions you need to define are (a), (b), (g), (h), and possibly (b) and (d)-(f).
Making partitions the right size is something that experience gives. You are trying to make the partition big enough to hold the required information, yet small enough not to waste disk space. The best tactic is to go to a similarly-configured system and copy the partition table from it. Use these general guidelines:
Partitions must begin on cylinder boundaries. Use the syntax 'N//' with format to indicate an integral number of cylinders (in this case N). Round up whenever necessary. Get the number of megabytes per cylinder by dividing the number of (512 byte) blocks per cylinder by 2048 and then figuring out how many cylinders are needed.
Watch out that you don't overlap cylinders. You have to give a starting cylinder and ending cylinder for each partition. The only one that should overlap is the c partition, which describes the whole disk (begins with 0, ends with the number of cylinders on the disk).
After defining your partition table, print it out ("print"), verify it, and then write the label with the "label" command. Then quit format.
newfs -r 4500 sd0a newfs -r 4500 sd0g newfs -r 4500 sd0hNote you don't have to build a file system on the swap partition because the kernel just does low-level disk i/o.
After using newfs, each partition will have a pristine Unix file system on it.
You might need to do this if you are replacing an internal system disk with boot information and system information or data on it. Otherwise, skip it.
If you need to build a new system on the disk, copy a system to it partition-by-partition. Do this by taking one from a similar system, e.g. the one called "apatite." For each partition (a - / - and g - /usr), do the following
mount /dev/sdXa /mnt cd /mnt rsh apatite 'dump 0f - /dev/rsdYa | restore rf - umount /mntwhere "X" and "Y" represent the SCSI disk name you want to reconstruct locally (X) and on the foreign donor system (Y).
You need to do this for each of the partitions you want to copy. Ones like swap (b) skip, and ones like h (/tmp) ignore - you want it blank anyway.
You only need to do this if you are building a disk you will be booting from. Remember, you got here by booting the system over the network, so you need to be able to boot from the new disk under normal circumstances.
First mount the root partition on /mnt and prepare to install the boot program on it:
mount /dev/sdXa /mnt cd /usr/kvm/mdecNote that you are going to put a boot program on the disk mounted on /mnt, but the code you are going to run is on your running system, not the disk. Use installboot to put the boot program on the new disk:
./installboot -vlt /mnt/boot bootsd /dev/rsdXaThe /mnt/boot indicates you're putting the boot program, bootsd, in the file called /mnt/boot on /dev/rsdXa. Don't be puzzled - /mnt/boot will be /boot when that disk is booted from, because when you boot it your boot detice will be known as /. It is only called /mnt/boot here when you're using the system you booted over the network.
You only need to do this if you are building a disk you will be booting from. Remember, you got here by booting the system over the network, so you need to be able to boot from the new disk under normal circumstances. You also copied the root file system from another system, which means that it will wake up with that other system's identity - this will be catastrophic.
First mount the root partition on /mnt:
mount /dev/sdXa /mnt cd /mnt/etcNow edit the file "hostname.le0" which contains the system name, and make this the appropriate new name for the system to be booted. Rewrite this file.
cd / umount /mnt /etc/halt boot disk vmunix -s (new prom monitor) b sd(0,3,0)vmunix -s (old prom monitor)
When you come up in single-user mode, edit /etc/fstab and make sure the disks are mounted like they should be.