System Administration Guide, Volume 1

Using PCMCIA Memory Cards Task Map

Table 17-3 Using PCMCIA Memory Cards Task Map

Task 

Description 

For Instructions, Go To 

1. Load the PCMCIA Memory Card 

Insert the PCMCIA memory card into its drive and enter the volcheck command.

"How to Load a PCMCIA Memory Card"

2. Examine the Contents of a PCMCIA Memory Card 

Optional. To examine the contents of the PCMCIA memory card, look in the appropriate directory under /PCMCIAmemorycard.

"How to Examine the Contents of a PCMCIA Memory Card"

3. Exchange Files 

Optional. Copy files or directories between the PCMCIA memory card and your file system.

"How to Copy or Move Information From a PCMCIA Memory Card"

 

"How to Copy or Move Information to a PCMCIA Memory Card"

4. Is PCMCIA Memory Card Still in Use?  

Optional. Before ejecting the PCMCIA memory card, find out if the PCMCIA memory card is still in use.

"How to Find Out If a PCMCIA Memory Card Is Still In Use"

5. Eject the PCMCIA Memory Card 

When you finish, eject the PCMCIA memory card.  

"How to Eject a PCMCIA Memory Card"

How to Load a PCMCIA Memory Card

  1. Make sure the PCMCIA memory card is formatted.

    If you aren't sure, insert it and check the status messages in the Console, as described in "Using PCMCIA Memory Cards Task Map". If you need to format the PCMCIA memory card, go to "How to Format a UFS PCMCIA Memory Card" or "How to Format a DOS PCMCIA Memory Card".

  2. Insert the PCMCIA memory card.

    Make sure the PCMCIA memory card is completely inserted. It must drop down into the drive. If the drive has a door, close it.

  3. Notify Volume Management.


    $ volcheck -v
    media was found

    Two status messages are possible:

    media was found

    Volume Management detected the PCMCIA memory card and will attempt to mount it in the /pcmem directory.

     

    If the PCMCIA memory card is formatted properly, no error messages appear in the Console.  

     

    If the PCMCIA memory card is not formatted, the "media was found" message is still displayed, but the following error messages appear in the Console:

    fd0: unformatted diskette or no diskette in the drive

    fd0: read failed (40 1 0)

    fd0: bad format

    You must format the PCMCIA memory card before Volume Management can mount it. Instructions are provided on "How to Format a UFS PCMCIA Memory Card" (for UFS) and "How to Format a DOS PCMCIA Memory Card" (for DOS).

    no media was found

    Volume Management did not detect a PCMCIA memory card. Make sure the PCMCIA memory card is inserted properly and run volcheck again. If unsuccessful, check the PCMCIA memory card; it could be damaged. You can also try to mount the PCMCIA memory card manually.

  4. Verify that the PCMCIA memory card was mounted by listing its contents.


    $ ls /pcmem/pcmem0
    pcmem0 myfiles

    As described earlier, pcmem0 is a symbolic link to the actual name of the PCMCIA memory card; in this case, myfiles. If the PCMCIA memory card has no name but is formatted correctly, the system will refer to it as unnamed_floppy.

    If nothing appears under the /pcmem directory, the PCMCIA memory card was either not mounted or is not formatted properly. To find out, run the mount command and look for the line that begins with /pcmem (usually at the end of the listing):


    /pcmem/name on /vol/dev/diskette0/name ...

    If the line does not appear, the PCMCIA memory card was not mounted. Check the Console for error messages.

How to Examine the Contents of a PCMCIA Memory Card

Use the ls -L command because some directories under /pcmem are symbolic links:


$ ls -L [-l] pcmem0

-L

Includes symbolic links in the output. 

-l

Long format. Includes permissions and owners in the output. 

Example--Displaying the Contents of a PCMCIA Memory Card

The following example lists the contents of the PCMCIA memory card in the first floppy drive, identified by pcmem0.


$ ls -L -l /pcmem/pcmem0
-rwxrwxrwx  1 smith  staff 362284  Nov 16 20:54  text.doc
-rwxrwxrwx  1 smith  staff  24562  Nov 16 12:20  art.gif

How to Copy or Move Information From a PCMCIA Memory Card

Once you have inserted a PCMCIA memory card, you can access its files and directories just as you would those of any other file system. The only significant restrictions are ownership and permissions. For instance, if you are not the owner of a file on a PCMCIA memory card, you won't be able to overwrite that file on the PCMCIA memory card. Or, if you copy a file into your file system, you'll be the owner, but that file won't have write permissions (because it never had them on the PCMCIA memory card); you'll have to change the permissions yourself.

  1. Make sure the PCMCIA memory card is formatted and mounted.


    $ ls /pcmem
    pcmem0  PCMCIAmemorycard-name
    

    If the PCMCIA memory card is properly formatted and mounted, its name and the symbolic link will appear under /pcmem.

    If nothing appears under the /pcmem directory, the PCMCIA memory card is not mounted. See "How to Load a PCMCIA Memory Card". The PCMCIA memory card might also need to be formatted. See "How to Format a UFS PCMCIA Memory Card" or "How to Format a DOS PCMCIA Memory Card".

  2. Copy the files or directories.

    To Copy ... 

    Use ... 

    A file 

    cp

    A directory 

    cp -r

  3. Verify the copy or move operation by using the ls command.

Examples--Copying or Moving Information From a PCMCIA Memory Card

The first example, below, moves a file (readme.doc) from the PCMCIA memory card to the current directory (indicated by the "." symbol). The second example copies a file (readme2.doc) from the PCMCIA memory card to the current directory. The third example copies a directory (morefiles) and everything below it from the PCMCIA memory card to the current directory.


$ mv /pcmem/pcmem0/readme.doc .
$ cp /pcmem/pcmem0/readme2.doc .
$ cp -r /pcmem/pcmem0/morefiles .

How to Copy or Move Information to a PCMCIA Memory Card

  1. Make sure the PCMCIA memory card is not write-protected.

    Write-protection is controlled by a small slide switch in the end of the PCMCIA memory card.

  2. Make sure the PCMCIA memory card is formatted and mounted.


    $ ls /pcmem
    pcmem0  PCMCIAmemory-card-name
    

    If the PCMCIA memory card is properly formatted and mounted, its name and the symbolic link, pcmem0, will appear under /pcmem.

    If nothing appears under the /pcmem directory, the PCMCIA memory card is not mounted. See "How to Load a PCMCIA Memory Card". The PCMCIA memory card might also need to be formatted. See "How to Format a UFS PCMCIA Memory Card" or "How to Format a DOS PCMCIA Memory Card".

  3. Move or copy the files or directories.

    To ... 

    Use ... 

    Copy a file 

    cp

    Copy a directory 

    cp -r

    Move a file or directory 

    mv

  4. Verify the move or copy operation by using the ls command.

Examples--Copying or Moving Information to a PCMCIA Memory Card

The first example, below, moves a file (readme.doc) from the current directory to the PCMCIA memory card loaded into the first floppy drive (indicated by /pcmem/pcmem0). The second example copies a file (readme2.doc) from the current directory to the PCMCIA memory card loaded into the second floppy drive (indicated by /pcmem/pcmem1). The third example copies a directory (morefiles) and its contents from the /home/smith/directory to the PCMCIA memory card loaded into the first floppy drive.


$ mv readme.doc /pcmem/pcmem0
$ cp readme2.doc /pcmem/pcmem1
$ cp -r /home/smith/morefiles /pcmem/pcmem0

How to Find Out If a PCMCIA Memory Card Is Still In Use

  1. Become superuser.

  2. Invoke the fuser(1M) command.

    The fuser command lists the processes that are currently accessing the CD that you specify.


    # fuser -u [-k] pcmem0
    

    -u

    Displays the user of the PCMCIA memory card. 

    -k

    Kills the process accessing the PCMCIA memory card. 

Example--Finding Out If a PCMCIA Memory Card Is Still in Use

In the following example, the processes 6400c and 6399c are accessing the /pcmem/pcmem0 directory, and the process owners are root and smith, respectively.


# fuser -u /pcmem/pcmem0
/pcmem/pcmem0: 6400c(root)  6399c(smith)

You can kill the processes individually (as superuser), or you can use the fuser command with the -k option, which kills all the processes accessing that file system:


# fuser -u -k /pcmem/pcmem0
/pcmem/pcmem0: 6400c(root)Killed  6399c(smith)Killed

The fuser command might not always identify all the killed processes. To be sure, run it again with the -u option.

How to Eject a PCMCIA Memory Card

  1. Make sure the PCMCIA memory card is not being used.

    Remember, a PCMCIA memory card is "being used" if a shell or an application is accessing any of its files or directories.

    If you are not sure whether you have found all users of a PCMCIA memory card (a renegade shell hidden behind a desktop tool might be accessing it), use the fuser command, as described in "How to Find Out If a PCMCIA Memory Card Is Still In Use".

  2. Eject the PCMCIA memory card.


    # eject pcmem0
    

    You'll have to eject the PCMCIA memory card by hand. If you are running Windows, look for an onscreen message that says you can now eject the PCMCIA memory card.

    If the PCMCIA memory card is still in use, the following message appears:


    /vol/dev/pcmem/noname: Device busy

    In this case, return to Step 1 and make sure no one is using the PCMCIA memory card, then eject it again.

How to Access PCMCIA Memory Cards on Other Systems

You can access a PCMCIA memory card on another system by mounting it manually into your file system--provided the other system has shared its PCMCIA memory card drive according to the instructions in "How to Make Local PCMCIA Memory Cards Available to Other Systems".

  1. Select an existing directory to serve as the mount point or create one.


    $ mkdir directory
    

    directory

    The name of the directory that you create to serve as a mount point for the other system's PCMCIA memory card.  

  2. Find the name of the PCMCIA memory card you want to mount.

    When you manually mount a remote PCMCIA memory card, you cannot use the pcmem0 or floppy1 variables available with your local PCMCIA memory cards. You must use the exact PCMCIA memory card name. To find it, use the ls command on the remote system's /pcmem directory. If the automounter is running, you can simply cd to the system whose PCMCIA memory card you want to mount and then use the ls command. If the automounter is not running, you'll have to use another method, such as logging in remotely.

  3. As superuser, mount the PCMCIA memory card.


    # mount -F nfs system-name:/pcmem/PCMCIAmemory-card-name local-mount-point
    

    system-name

    The name of the system whose PCMCIA memory card you want to mount. 

    PCMCIAmemory-card-name

    The name of the PCMCIA memory card you want to mount. 

    local-mount-point

    The local directory onto which you will mount the remote PCMCIA memory card. 

  4. Log out as superuser.

  5. Verify that the PCMCIA memory card is indeed mounted by using the ls command to list the contents of the mount point.


    $ ls /pcmem
    

Example--Accessing PCMCIA Memory Cards on Other Systems

This example mounts the PCMCIA memory card named myfiles from the remote system mars onto the /pcmem directory of the local system.


$ cd /net/mars
$ ls /pcmem
pcmem0     myfiles
$ su
Password: password
# mount -F nfs mars:/pcmem/myfiles /pcmem
# exit
$ ls /pcmem
myfiles

How to Make Local PCMCIA Memory Cards Available to Other Systems

You can configure your system to share its PCMCIA memory cards; in other words, you can make any PCMCIA memory cards in those drives available to other systems. Once your PCMCIA memory card drives are shared, other systems can access the PCMCIA memory cards they contain simply by mounting them, as described in "How to Access PCMCIA Memory Cards on Other Systems".

  1. Become superuser.

  2. Find out whether the NFS daemon (nfsd) is running.


    # ps -ef | grep nfsd
    root 14533    1 17 10:46:55 ?     0:00 /usr/lib/nfs/nfsd -a 16
    root 14656  289  7 14:06:02 pts/3 0:00 grep nfsd

    If the daemon is running, a line for /usr/lib/nfs/nfsd will appear, as shown above. If the daemon is not running, only the grep nfsd line will appear.

  3. Select an option from the following table.

    If ... 

    Then ... 

    nfsd is running

    Go to Step 8

    nfsd is not running

    Continue with Step 4

  4. Create a dummy directory for nfsd to share.


    # mkdir /dummy-dir
    

    dummy-dir

    Can be any directory name; for example, dummy. This directory will not contain any files. Its only purpose is to "wake up" the NFS daemon so that it notices your shared PCMCIA memory cards.

  5. Add the following entry into the /etc/dfs/dfstab file.


    share -F nfs -o ro [-d comment] /dummy-dir
    

    When you start the NFS daemon, it will see this entry, "wake up," and notice the shared PCMCIA memory card drive. Note that the comment (preceded by -d) is optional.

  6. Start the NFS daemon.


    # /etc/init.d/nfs.server start
    
  7. Verify that the NFS daemon is indeed running.


    # ps -ef | grep nfsd
    root 14533    1 17 10:46:55 ?     0:00 /usr/lib/nfs/nfsd -a 16
    root 14656  289  7 14:06:02 pts/3 0:00 grep nfsd
  8. Eject any PCMCIA memory card currently in the drive.


    # eject pcmem0
    
  9. Assign write permissions to /etc/rmmount.conf.


    # chmod 644 /etc/rmmount.conf
    
  10. Add the following lines to /etc/rmmount.conf.


    # File System Sharing
    share floppy*

    These lines share any PCMCIA memory card loaded into your system's PCMCIA memory card drives.

  11. Remove write permissions from /etc/rmmount.conf.


    # chmod 444 /etc/rmmount.conf
    

    This step returns the file to its default permissions.

  12. Load a PCMCIA memory card.


    --Insert the PCMCIA memory card--
    # volcheck -v
    media was found

    The PCMCIA memory card you now load, and all subsequent PCMCIA memory cards, will be available to other systems. To access the PCMCIA memory card, the remote user must mount it by name, according to the instructions in "How to Access PCMCIA Memory Cards on Other Systems".

  13. Verify that the PCMCIA memory card is indeed available to other systems by using the share command.

    If the PCMCIA memory card is available, its share configuration will be displayed. (The shared dummy directory will also be displayed.)


    # share
    -    /dummy  ro "dummy dir to wake up NFS daemon"
    -    /myfiles rw  ""

Example--Making Local PCMCIA Memory Cards Available to Other Systems

The following example makes any PCMCIA memory card loaded into the local system's PCMCIA memory card drive available to other systems on the network.


# ps -ef | grep nfsd
    root 10127  9986  0 08:25:01 pts/2    0:00 grep nfsd
    root 10118     1  0 08:24:39 ?        0:00 /usr/lib/nfs/nfsd -a
# mkdir /dummy
# vi /etc/dfs/dfstab
(Add the following line:)
share -F nfs -o ro  /dummy
# eject pcmem0
# chmod 644 /etc/rmmount.conf
# vi /etc/rmmount
(Add the following line to the File System Sharing section:)
share floppy*
# chmod 444 /etc/rmmount.conf
(Load a PCMCIA memory card.)
# volcheck -v
media was found
# share
-               /dummy   ro   ""  
-               /pcmem/myfiles   rw   ""