OpenWindows Advanced User's Guide

G.3 Copying Files with the tar Command

This is the first of three sections that describe how to format and copy files from a PCMCIA memory card to a hard disk or from a hard disk to a PCMCIA memory card.


Note -

See the man pages for further information on how to use the cpio or the dump/restore commands.


This section describes the following tasks:

G.3.1 Formatting a PCMCIA Memory Card

Before you can use a PCMCIA memory card, you may need to format it. The fdformat utility allows you to format both diskettes and PCMCIA memory cards.


Caution - Caution -

Formatting deletes any data that may already be resident on a PCMCIA memory card.


To format a PCMCIA memory card:

    Type:

    % fdformat option device_name


    Note -

    The format utility cannot be used with PCMCIA memory cards. Only the fdformat utility will work.


Table G-1 lists the available options for the fdformat utility.

Table G-1 fdformat Utility Options

Option 

Description 

-U

Unmounts the PCMCIA memory card 

-d

Installs an MS-DOS file system (UNIX file system is the default) 

-f

Does not display confirmation messages before starting to format 

-q

Disables print status messages 

-x

Installs a Solaris label or an MS-DOS file system; it does not format the PCMCIA memory card 

-blabel

Specifies a UNIX or MS-DOS label on a PCMCIA memory card 

-t dos

Installs an MS-DOS file system (UNIX file system is the default) 

-B filename

Installs a special boot loader 


Note -

There is no option in the fdformat utility for installing a NEC-DOS file system on a PCMCIA memory card.


If you want to format a PCMCIA memory card, you must specify a device name for the PCMCIA memory card. Otherwise, the fdformat utility automatically specifies the diskette drive as the default device.

The format for a device name of a PCMCIA memory card is

/dev/rdsk/cntndnsn

or

/dev/dsk/cntndnsn.

For example, the device name /dev/dsk/c1t6d0s2 represents a PCMCIA SRAM memory card with a logical socket controller number 1, a technology number 6, and a slice number 2.

Table G-2 list the available device name options for the fdformat utility.

Table G-2 fdformat Utility Device Name Options

Device Name Option 

Description  

-n

Represents a decimal number 

-cn

Represents controller n

-tn

Represents technology region n

0x1 ROM, 0x2 OTPROM, 0x3 EPROM, 

0x4 EEPROM, 0x5 FLASH, 0x6 SRAM, 0x7 DRAM 

-dn

Represents technology region in type n

-sn

Represents slice n (This release supports only one partition on the PCMCIA memory card. Therefore, the partition number sn for the device name must be s2.)

G.3.2 Displaying File Names with the tar Command

You may want to display the file names that are resident on a PCMCIA memory card.

    Type:

    % tar tvf device_name
    

Table G-3 tar Command Options to Display Filenames

Option 

Description 

-t

lists or displays files that are resident on the PCMCIA memory card 

-v

specifies a verbose listing 

-f

specifies an input device name

G.3.3 Copying Files

To copy a file or directory from a PCMCIA memory card to a hard disk or from a hard disk to a PCMCIA memory card, you must have already formatted the PCMCIA memory card (see "G.3.1 Formatting a PCMCIA Memory Card"). In addition, you must have write permission for the destination directory on the hard disk.

If you use the following procedure to copy a file or directory, you preserve the owner, permissions, group, and modification time of the file or directory.


Note -

If you use the tar command to copy files to a PCMCIA memory card, you must use the tar command to extract or copy files from the PCMCIA memory card.


G.3.3.1 Copying Files from a Hard Disk to a PCMCIA Memory Card

  1. Type:

    % cd directory
    

    where directory is the name of the directory in which the files that you want to copy are located.

    For example, to copy the file /home/samples/design, type:

    % cd /home/samples
    

  2. Type:

    % tar cvf device_name filename

    Table G-4 tar Command Options to Copy Files to a PCMCIA Memory Card

    Option 

    Description 

    -c

    creates a backup archive 

    -v

    displays a verbose listing 

    -f

    specifies an input device name 

    For example, to copy the file ./design located on your hard disk to a PCMCIA memory card that has the device name /dev/rdsk/c1t6d0s2, type:

    % tar cvf /dev/rdsk/c1t6d0s2 ./design
    

G.3.3.2 Copying Files from a PCMCIA Memory Card to a Hard Disk

  1. Type:

    % cd directory
    

    where directory is the name of the directory in which the files that you want to copy are located. In this case, the directory is located on the PCMCIA memory card.

    For example, to copy the file /home/samples/design, type:

    % cd /home/samples
    

  2. Type:

    % tar xvfp device_name filename

    Table G-5 tar Command Options to Copy Files from a PCMCIA Memory Card

    Option 

    Description 

    -x

    extracts a backup archive 

    -v

    displays a verbose listing 

    -f

    specifies an input device name 

    -p

    preserves the original modes of the file 


    Caution - Caution -

    If a file or directory with the same name as the one being copied already exists in the working directory, it is automatically overwritten.


    For example, to copy the file ./design from a PCMCIA memory card with an address /dev/rdsk/c1t6d0s2 to the working directory on your hard disk, type:

    % 	
    tar xvfp /dev/rdsk/c1t6d0s2 ./design