Removable Storage Media
Just to keep things really interesting, not all devices on a system are "fixed"that is, some support removable media. So, although the media reader may be permanently mounted in the system chassis, the presence of the media itself is not guaranteed. Some of the most common removable media types include these:
The variable nature of the media introduces a few wrinkles to managing these devices. Removable media devices were designed with an eye to nearreal-time management; in a nutshell, this means that you won't have to reboot every time you want to swap a CD or floppy. By the same token, the system configuration that you have at boot-time might not be the same one that you keep until shutdown.
In a workstation environment, this means that users must have the capability to mount new media on the system (remember that only root has had mount capability until now). Instead of having to indiscriminately hand out the root password, admins can instead run a volume manager daemon to handle these details.
On Red Hat, this daemon is part of the kudzu package. On Solaris, this daemon is called vold. In both operating systems, the volume manager is installed and activated by default.
Under Solaris, once vold is in command of a device, the sysadmin cannot control that device using standard UNIX commands until vold has been disabled.
Adding Swap Files
If you find that you didn't allocate enough swap space during the initial partitioning, or if you neglected the swap partition entirely, don't despair! You can always allocate more swap space in the form of swap files. Red Hat and Solaris handle this task in different ways, however.
Something that they have in common, though, is that swap files are intended to be temporary augmentations and, as such, can't be easily added to the system's boot-time configuration. Also note that swap files are accessed through a filesystem, thus slowing I/O times and performance.33
To add a swap file under Red Hat, follow these steps:34
Use dd to create a file of desired swap size.35 The following command will create a file called swapfile in the local directory with a size of 256MB:
Invoke mkswap with no options to actually set up the swap file:
Call sync with no arguments to flush filesystem buffers.
Invoke swapon to notify the system that the new swap space is available:
dd if=/dev/zero of=swapfile bs=1024000 count=256
As of this writing, Red Hat supports a maximum of 2Gb in a single swap file and a total of eight swap areas. To find active swap partitions and files, examine the contents of /proc/swaps.
To add a swap file under Solaris, follow these steps:
Use mkfile to create a file of desired swap size.36 The following command will create a file called swapfile in the local directory with a size of 256MB:
Invoke swap -a with the full pathname to the swapfile you just created to actually set up the swap file. Let's assume that the swapfile was created in /space:
mkfile -v 256m swapfile
swap -a /space/swapfile
To view active swap partitions and files, call swap with the "-l" option:
[sun:19 ~]swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0t0d0s1 136,1 16 1049312 1003408
/space/swapfile - 16 524272 524272