Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (128 KB)
Chapter 3 How to Set Up File Systems On the TargetThis chapter explains how to set up file systems on devices physically attached to the target system, such as Flash memory, IDE disks, RAM disks and SCSI disks. If your target is an NFS client only (all its files are physically located on another system such as the host), you can skip this chapter. Before you can perform the procedures in this chapter, you must first configure the system image. See Chapter 2, How to Configure the System Image for details. You must also boot the new system image on the target, and mount the root file system where many of the useful actors reside. This usually involves mounting a file system located on the host workstation where you built the system image. See "Mounting an NFS File System" for details. Setting up file systems on the target involves:
3.1 How to Format a Flash Memory DeviceYou must format Flash memory before you can label it. If your target does not have Flash memory, you can skip this section. The following procedure initializes the Flash memory device, erasing all existing data. Be sure to back up existing data on the device before proceeding. Formatting a Flash Memory Device
3.2 How to Label a DiskThis section describes how to label a disk using information in /etc/disktab and the disklabel utility. Labelling consists of writing specific information, such as disk geometry in terms of cylinders, heads, sectors per track and partition overlays, at particular locations on the disk. Disk drivers use labelling information to access different areas of the disk, called partitions. 3.2.1 How to Set Up Information About Disk GeometryInformation about disk geometry is found in /etc/disktab, which disklabel reads before writing a label to a drive. ChorusOS 4.0 provides a sample /etc/disktab that contains several useful examples. The following key to the abbreviations used in /etc/disktab is included at the top of the file: # # Disk geometry and partition layout tables. # Key: # # dt controller type # ty type of disk (fixed, removeable, simulated) # d[0-4] drive-type-dependent parameters # ns #sectors/track # nt #tracks/cylinder # nc #cylinders/disk # sc #sectors/cylinder, ns*nt default # su #sectors/unit, sc*nc default # se sector size, DEV_BSIZE default # rm rpm, 3600 default # sf supports bad144-style bad sector forwarding # sk sector skew per track, default 0 # cs sector skew per cylinder, default 0 # hs headswitch time, default 0 # ts one-cylinder seek time, default 0 # il sector interleave (n:1), 1 default # bs boot block size, default BBSIZE # sb superblock size, default SBSIZE # o[a-h] partition offsets in sectors # p[a-h] partition sizes in sectors # b[a-h] partition block sizes in bytes # f[a-h] partition fragment sizes in bytes # t[a-h] partition types (file system, swap, etc) # # All partition sizes reserve space for bad sector tables. # 5 cylinders are needed for maintenance including # replacement sectors. # ... Entries in /etc/disktab consist of fields separated by colons (":") and follow the form: label:option[=value|#value]... Where label is a string identifier up to eight characters long with no whitespace, option is an option from the list of abbreviations above, and value is the value assigned to an option. For detailed examples, see the root/etc/disktab file generated using make root in the build_dir directory where you build system images. Note that build_dir/root is normally the directory exported for use as the target root directory. See "Mounting an NFS File System" for details. If you are unable to complete the disk geometry fields, boot the ChorusOS system image on the target system, and read the output concerning the disk driver displayed on the system console at boot time. 3.2.2 How to Use disklabelOnce you have correctly specified disk information in /etc/disktab, you are ready to use disklabel. Labelling a DiskThe following procedure initializes the local disk, erasing all existing data. Be sure to back up existing data before proceeding.
3.3 How to Create a File SystemThis section explains how to create a file system on a disk. If you plan to use the disk partitions in raw mode and do not need a file system, you can skip the rest of this chapter. Once the disk has been labelled, you can write a UFS or MS-DOS file system structure to any partition you have defined for the disk, except partition c. Creating a UFS File SystemCreate the file system using the newfs command as follows:
where raw_device is a raw mode special file indicating a partition such as /dev/rsd0a. Creating an MS-DOS File SystemCreate the file system using the newfs_dos command as follows:
where raw_device is a raw mode special file indicating a partition such as /dev/rhd0a. Example 3-1 Creating a File System on a RAM DiskYou can pass extra parameters to newfs or newfs_dos when creating a file system on a RAM disk in order to maximize available space. The following command could be used to maximize space available on a 1 MB RAM disk:
Note - See "5.2 How to Activate a Swap Partition" for details on activating a swap partition. 3.4 How to Check File System IntegrityThis section explains how to check existing file systems for errors. Note - Before mounting a local file system with read-write access or as the root file system, and after any system crash, it is strongly recommended that you check the file systems you plan to mount. Checking a UFS File SystemCheck the file system using the fsck command as follows:
where raw_device is a raw mode special file indicating a partition such as /dev/rsd0a. Checking an MS-DOS File SystemCreate the file system using the fsck_dos command as follows:
where raw_device is a raw mode special file indicating a partition such as /dev/rhd0a. If no errors are found, both fsck and fsck_dos display information on the file system in use. In case of errors, both fsck and fsck_dos attempt a recovery procedure, optionally requiring confirmation. If you want to run either command in non-interactive mode, use the -y option. |
|||||||||