A file system needs to be mounted on a directory before it can be used. The root file system is mounted on the / directory. Other file systems are mounted on a directory created on the root file system or on a directory in another mounted file system. The directory on which a file system is mounted is called a mount point. The mount command is used for this purpose. To mount a JFS file system /dev/vg03/lvol4 on the /mnt directory, you can use the mount command as follows .
mount -F vxfs /dev/vg03/lvol04 /mnt
When a file system is mounted, it is recorded in the mount table. Now, when you access the directory that is used as a mount point, you are actually accessing the file system that is mounted on that directory. If the directory contains some files before mounting the file system, these will not be visible. Instead, when you list the directory, files on the mounted file system will be listed. You can't use a directory as a mount point if some of the files in that directory are in use at the time. All mounted file systems can be displayed using the mount -v command as shown below.
$ mount -v /dev/vg00/lvol3 on / type vxfs log on Tue Oct 19 15:15:04 1999 /dev/vg00/lvol1 on /stand type hfs on Tue Oct 19 15:15:05 1999 /dev/vg00/lvol8 on /var type vxfs on Tue Oct 19 15:15:30 1999 /dev/vg00/lvol7 on /usr type vxfs on Tue Oct 19 15:15:30 1999 /dev/vg00/lvol6 on /tmp type vxfs on Tue Oct 19 15:15:31 1999 /dev/vg00/lvol5 on /opt type vxfs on Tue Oct 19 15:15:31 1999 /dev/vg00/lvol4 on /home type vxfs on Tue Oct 19 15:15:31 1999 $
You can also use the bdf command to list mounted volumes . To unmount a mounted file system, you use the umount command. The file system mounted on /home can be unmounted using the following command.
umount /home
A file system can't be unmounted if it is currently in use. To see if a file system is in use, you can use the fuser command. To see if /home is used by some users, use:
fuser /home
To terminate processes that are using file system /home , use the following command.
fuser -ku -c /home
After this, you can unmount the file system. You can use the -a option with the umount command to unmount all file systems currently mounted. The -F option can be used to unmount file systems of a specific type. For example, the following command will unmount all JFS file systems.
umount -aF vxfs
To automatically mount a file system at boot time, you need to put an entry for the file system in the /etc/fstab file. This file devotes one data line to each file system's information. This line contains the file system name , its mount point, the file system type, and other options related to the file system. A typical entry for a file system may be as follows.
/dev/vg00/lvol4 /home vxfs delaylog 0 2
The first column in the file is the block device file used for the file system. The second column represents the mount point that is /home in this example. The third column is used for the type of file system. A file system type may be one of the types supported by HP-UX. The supported file system types are shown in Table 18-4.
Type | Explanation |
---|---|
cdfs | File system used for CD-ROM |
hfs | High-Performance File System |
vxfs | Journaled File System |
swap | Device swap file system |
swapfs | File system directory used as swap |
lofs | Loopback file system |
The options are listed in the fourth column and may be used to enable/disable read and write permissions and the quota. The defaults keyword shows that the file system is mounted in read/write mode, SUID is allowed, and no quota restrictions are imposed. The fifth column is reserved for future use, and the sixth column shows the order that the fsck command will use when checking the file systems.
During the boot process, the /sbin/init.d/localmount script is executed, which executes the mount -a command to mount all file systems listed in the /etc/fstab file.
/dev/vg00/lvol3 / vxfs delaylog 0 1 /dev/vg00/lvol1 /stand hfs defaults 0 1 /dev/vg00/lvol4 /home vxfs delaylog 0 2 /dev/vg00/lvol5 /opt vxfs delaylog 0 2 /dev/vg00/lvol6 /tmp vxfs delaylog 0 2 /dev/vg00/lvol7 /usr vxfs delaylog 0 2 /dev/vg00/lvol8 /var vxfs delaylog 0 2
Study BreakCreating and Mounting New File Systems
|
Top |