Using the Mount Command

To mount devices by hand, you have to use the mount command. The structure of this command is easy to understand: mount /what /where. For the what part of the option, you must specify a device name, and for the where part, you use a directory. Basically, you can use any directory, but it doesn't make sense to mount a device, for example, on /usr; it can even be dangerous because it will temporarily make all the other files in that directory unavailable. Therefore, on SUSE Linux Enterprise Server 10, two directories are created as default mount points. The first of these directories is the directory /mnt. This is typically the directory you would use for a mount that happens only occasionally. The second is the directory /media. In there, you would mount devices that are connected on a more regular basis. You would, for example, mount a CD, DVD, or USB stick in that directory with the command mount /dev/cdrom /media/cdrom.

The mount command makes it possible not only to mount devices such as CDs and DVDs but also network shares. If you want to do that, you must be a little bit more specific, however. For example, if you want to mount a share with the name myshare on your Windows computer that has the name mira, you would use the following command:

mount -t smbfs -o username=yourname //mira/myshare /mnt

This command has some extra information. First, it mentions the file system that needs to be used. The mount command is perfectly capable of determining the file system for local devices; however, if you are using a network device, you need to specify it. In this case, since you want to make a mount to a Windows file system, you use the smbfs file system type. (Table 7-1 later in this chapter lists other commonly used file system types.) Next, you specify the name of the user who performs the mount. This must be the name of a valid user account on the other system. Then you specify the name of the share. The previous example used a computer name (mira); if your system has problems resolving that, you can use an IP address. Follow the computer name with the name of the share. As the final part, you specify the name of the directory where the mount has to be created. In this example, I've mounted it on /mnt, since this typically is a mount that you would make only occasionally (consider working with subdirectories if you plan on having simultaneous mounts in this directory). If it would be a mount you were using on a regular basis, you would create a subdirectory under /media (/media/mira would make sense here) and create the mount in that subdirectory.

Was this article helpful?

0 0

Post a comment