Valjean wrote:

>   I have one 8.5 gig hd and one cdrom.  I want to hook up two more hard
> drives, copy some data from them, and then remove them from the system.
> How do I get Linux to recognize them so I can copy, then remove them from
> the system as easily?
> Valjean

 What type of HDDs do you have, IDE or SCSI?  This is a piece of information
you could have included.

Assuming IDE, max two internal HDDs and not having a means of connecting the
two HDDs externally, the following is one way to do what you want to do.
>From this you should be able to infer what to do under difference
circumstances.

- Install one of the HDDs as the second HDD, which will be seen by Linux as
/dev/hdb (for IDE)


        NOTE:  Refer to your PC system manual for how to install and change
HDDs for
        electrical protection and proper jumper settings.


- Boot up your Linux configuration.

- Mount the hdb filesystem you'll be copying the data from (mount command,
if doing this from the command line).

- Copy the data from the hdb fs to where ever you want it on your hda Linux
configuration.

- Unmount hdb (umount command, if doing this from the command line).

- Shutdown your Linux configuration and power off the PC.

- Remove hdd

            NOTE:  Follow your PC manual for electrical safety, and reset
jumper settings to
            the original settings.

- Repeat for the second HDD you want to copy data from.

This is a grosso-modo guideline.  Make sure to follow your PC  manual for
installing and removing HDDs.  You want to follow this manual to also know
how to install the HDDs as secondary drives.


One way to mount hdb is as follows:

- Create the directory hdb in /mnt, that is, /mnt/hdb.

- Run the mount command to mount the filesystem on hdb.


How to run the mount command:

            % mount -vt {fs-type} /dev/hdb1 /mnt/hdb

This will allow you to access the fs on hdb.  However, this is also assuming
that hdb has  one, single, filesystem on it, or that the filesystem on hdb
you wish to access is hdb1.

If hdb1 is not correct, then you'll need to determine which /dev/hdb{n}
block device file to use, and this can be done using fdisk, running fdisk
with /dev/hdb as an argument:

            % fdisk /dev/hdb

Once in fdisk, type p and press Enter.  This will display the filesystems on
hdb, which shows the associated /dev/hdb{n} files the filesystems are mapped
to.

{fs-type} for the mount command's -t option depends on the type of
filesystem you'll be copying the data from.  If it's a Linux filesystem,
then the value for -t is likely

        ext2

If the filesystem is a MSDOS filesystem, then the -t argument is likely

        vfat

You may want to specify another mount option, to mount read-only; however,
if memory is accurate, then this is the default, that is, filesystems being
mounted read-only (not whether or not my accurate memory should be
read-only, definitely doesn't sound like a good idea, unless born with all
of the knowledge one will ever need - lousy  option for teachers).

You may need to be root to mount the hdb filesystem, depending on the
privileges assigned to the user account you'ld otherwise be using.  If
you're doing this as a user other than root and the mount fails because the
user doesn't have the permissions to mount hdb, then simply switch (su) to
root and then run the mount command.

If you're using SCSI HDDs, instead of IDE, then the /dev file to use is not
/dev/hdb{n}, but instead /dev/sdb{n}.  This should also be shown by fdisk,
and when you'ld run fdisk, the argument for fdisk would be /dev/sdb, instead
of /dev/hdb.

For more information, you can check the man pages for mount and fdisk.

            % man mount
            % man fdisk

Also, if you're running as root and using kde, then I believe that there's a
kde tool or utility for working with filesystems (mounting, unmounting,
adding, removing); however, I'm not sure which tool this is.  I use mount
and umount.

In kde, you can create a destop icon for filesystem device and define it for
mounting and unmounting filesystems.  However, this only mounts and
unmounts; although, might automatically bring up the tool for viewing, etc.

I'm not promoting kde over gnome.  Haven't been using gnome, but definitely
plan to add it and begin using it soon, at least to check out both
environments.  Until, then, though, I'll probably often refer to kde.

The command line umount command works as follows:

        % umount /mnt/hdb


If you wish to take the time to modify the /etc/fstab file, then you could
add the mount information for hdb or sdb, depending on the type of hdd
you're using.  This would permit running mount without needing to specify
the -vt option and argument as well as /dev/[hs]db{n}, as follows:

for IDE

        % mount /mnt/hdb

for SCSI

        % mount /mnt/sdb

This would then be all you'ld need to type when ever wanting to mount an hdb
or sdb (depending on whether you're using ide or scsi) filesystem mapped to
the same /dev/[hs]db{n} device file.

[hs] means either h or s, but never both.

If you're modifying fstab, then use the appropriate first letter for the
/mnt directory you create.  This will make the fstab file more readable or
understanble.

The /mnt/[hs]db directory can be named what ever you want.  Only if you
create an fstab file entry would the name of this directory be important.

For example, if you create the directory /mnt/hd  (assuming IDE), the fstab
file entry maps to /mnt/hdb, and there's no fstab entry for /mnt/hd, then

        % mount /mnt/hd

will not work, because there'ld be no fstab definition for this /mnt point.

You can use linuxconf to add the fstab file entry, instead of editing the
fstab file directly.  In this case, open up a terminal window, opening it to
full screen or considerably large, and

run

        % linuxconf

choose the

            config option

then the

            filesystems option

then the

            access local drive option

followed by the

            add option.

Define the entry or filesystem as not to be mounted automatically at boot
time.  The menus should be straightforward enough for most users to know
what to enter.

However, in case you have problems:

For the Base option:

- partition should be the /dev file
- type should be ext2 for Linux and vfat for MSDOS or Win9x (also NT, I
think)
- mount point is the /mnt point

For the Options option, make sure the following are selected:

1) Readonly (if you want to block write access to the hdb filesystem you'll
be copying from, to help prevent accidentally clobbering files)

2) User mountable (if you want users who are members of group user(s) to be
able to mount the hdb filesystem)

3) Not mount at boot time

4) No setuid allowed

If you're only going to do the mounting and copying as root, then you can
forget about items 2 and 4 in the above list.

For item 3, if you let the filesystem be mounted at boot time and it's not
present, then this should only cause an error message to be generated,
because the fs isn't critical.  However, I haven't tested this; therefore,
because you don't need the fs mounted at boot time, simply make sure item 3
is selected.

Select quit to get out of every screen (doesn't imply cancellation of what
you've defined).

When linuxconf prompts to activate changes, select yes, but you can and
should preview the changes, first; although, if you're certain that all
you've done is to add the filesystem mount entry, then you can say yes to
activating the changes.  If you're new to this kind of task, then you should
preview your changes before activating them,  to become more comfortable
with linuxconf.

Otherwise, you should preview the changes, first.  If linuxconf prompts to
activate the changes, but doesn't allow previewing, first, then say no to
activating and when you get  (back) to a screen which permits activating the
changes, you'll also see a preview option.  Preview, make any necessary
corrections, and then activate.

If you activate the changes before previewing, you'll be able to view errors
if linuxconf encounters any, and you'll be able to go through the steps
again to make corrections, without needing to worry about crashing the
system or any serious effects.

I'm assuming this activation will only create the entry in the fstab file.
If you don't have the hdb installed when running linuxconf (if you choose
this method) and linuxconf complains about the mount failing or device not
being present, then simply quit linuxconf, add the hdd, reboot and then run
linuxconf again, if the fstab file doesn't show the entry; if it does, then
just run mount against /mnt/hdb (you must create /mnt/hdb, first).

When mount is invoked only with the /mnt mount point for an argument, mount
refers to the fstab file to determine what to do.

The fstab file entry should look something as follows for a Linux
filesystem:

        /dev/hdb{n}        /mnt/hdb        ext2        noauto        1 2

To know what the 1 and 2 mean, refer to the man page for mount.  The values
could also both be 0 for the hdd you're referring to, but 1 2 will cause
filesystem checking to be done.  If it's a vfat or not a Linux ext2
filesystem, then make these values both 0.

You could add this manually, to the fstab file, however it's generally
recommended to do this using one of the available tools.  There may be
another tool than linuxconf, however this is the one I'm familiar with.

Between this information and reading the man pages for mount and fdisk, you
shouldn't have any problems.

However, if the HDDs you're referring to are filesystems created with a
newer version of Linux, i.e., newer kernel, then perhaps you won't be able
to mount these filesystems using an older Linux kernel.  I'm not sure if the
ext2 format has changed, though, and only mention this as a remotish
possibility.  If the mount fails, then you should get some error message;
however, the message often isn't clear, only saying that it could one of a
number of reasons that the mount failed.  How, to do testing to determine
exactly what the problem is, is probably a reason to refer to documentation
or man pages for

    fsck, e2fsck, debugfs

There's supposed to be a better tool than debugfs, now, however you also
didn't included any information about the Linux distribution and kernel
you're using.  After all, you could even be using Debian and coming here if
unable to get answers elsewhere.

People who ask questions like you did should provide some information, like:

            - Level or amount of experience with Linux and computers "tout
court"
            - Linux distribution and kernel version
            - Type of hardware (SCSI or IDE, for example)
            - Tools you are familiar with and believe would be suitable for
what you want
                to do
            - Any other potentially useful information

Read a book or two on Linux or Unix and the available documentation for
tasks you want to do.

My $5 worth.

mike




Reply via email to