Complete Idiot's Guide to Linux:Working with Disks
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Complete Idiot's Guide to Linux
(Publisher: Macmillan Computer Publishing)
Author(s): Manuel Ricart
ISBN: 078971826x
Publication Date: 12/22/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="../../../../../www.itknowledge.com/PSUser/EWBookMarks.html@url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Chapter 7Working with Disks
In This Chapter
Starting a Superuser Session
Configuring Floppy and CD-ROM Drives
Granting Access to Disk Devices
Working with Floppies and CD-ROMs
Working with disks in Linux is a little different than in other operating systems. In Linux and UNIX, disks are mounted into the file system. Mounting a file system incorporates the contents of a disk into the directory tree. When you are done working with the disk, you typically unmount it. Unmounting a file system removes it from the file tree. Mounting goes beyond disks. Volumes (network drives) available over the network can also be mounted and unmounted.
Volumes can be mounted anywhere on the file system. Under Linux, the default place where they are mounted is in /mnt. The /mnt directory will have a directory for at least your floppy disk and your CD-ROM drive; these directories will typically be named floppy and cdrom respectively. The floppy and cdrom directories are empty and only contain files and folders when a disk or volume is mounted to that directory. If you mount a volume on a directory that contains files, the contents of the directory are hidden from view and made inaccessible until the volume is unmounted.
Mounting a disk into the file system is, by default, a restricted action. To enable regular user access to these devices, youll need to tell your system that it is OK for a user to mount the device. Youll learn how to do this next.
Configuring the System to Allow Users to Access the CD-ROM and the Floppy
The system keeps a configuration file for disks and where they are mounted in /etc/fstab. This configuration file is just a regular text file that you can edit using any text editor, including KEdit. However, permissions to modify this file are restricted to root, the superuser; to change and modify this file, you need to have this privilege.
You can obtain this privilege in two ways:
You can exit the system, log in as root, and reenter the system
You can start up a File Manager with superuser (root) privileges
For the sake of learning a new trick, lets walk through the second option.
Starting a Superuser KFM Session
To launch a KFM window as the superuser, you can go to the Application Starter|System and pick the File manager (Superuser Mode) command (see the following figure).
Launch a KFM window with superuser powers from the System submenu.
This will display a window asking you for the root password. After you enter it, a KFM window similar to the ones youve used before will be displayed.
Superuser KFM windows are distinguished from normal KFM windows by a red tab that tells you to exercise care when manipulating files and directories (see the next figure). One wrong manipulation can trash your system.
A superuser KFM window has a red tab on the menu bar pane.
Type /etc/fstab and hit Enter in the location field on the root KFM window. A new KEdit will launch. This instance of KEdit inherits the superuser permissions, allowing you to modify the file.
After you finish editing the file, as explained in the section Creating kdelnk Files for the Floppy and CD, close the KEdit window and the KFM root window to ensure that you dont use these empowered applications by mistake.
Enabling Regular Users to Access Disk Devices
Your /etc/fstab will contain text similar to this:
/dev/hda1 / ext2 defaults 0 1
/proc /proc proc defaults 0 0
/dev/hda5 none swap defaults 0 0
/dev/hdd /mnt/cdrom iso9660 ro,noauto,user 0 0
/dev/fd0 /mnt/floppy ext2 defaults,noauto 0 0
To enable any user to have access to the floppy, youll need to modify the line that starts with /dev/fd. Typically, it will be called /dev/fd0 and is the device that represents the floppy disk. If you have multiple floppy disk drives, /dev/fd0 represents DOS drive A: (the first floppy drive), /dev/fd1 represents DOS drive B: (the second floppy drive), and so on. Floppy drive entries in /etc/fstab need to be modified to look like this:
/dev/fd0 /mnt/floppy auto user,defaults,noauto 0 0
In this entry I changed the ext2 to auto; this will allow the system to detect and read DOS and Windows floppies in addition to native Linux floppies. I also modified the options list by adding the user option before the defaults option. This will enable regular users to mount floppy disks. Note that there are no spaces between the commas and the options.
Techno Talk: Each line in the /etc/fstab file has the following format:
device mountpath fstype options dump_order check_order
device specifies the name of the device file that represents the disk. UNIX devices such as your floppy disk are represented by device files. These are special files, and when accessed, they actually interact with your hardware. Device files reside in the /dev directory. When a program needs to use the device, it reads or writes to it as if it was a regular file. This simplifies the way programs talk to different hardware. For floppy disks, device filenames begin with /dev/fd. A number at the end of the filename allows for multiple devices of the same kind. Your CD-ROM will typically be /dev/cdrom, which is really a link to a more specific file, depending on whether your CD-ROM drive is an IDE drive, a SCSI drive, or some other type of drive.
mountpath specifies where the device is mounted. Typically, this will be /mnt/floppy or /mnt/cdrom for your floppy and CD-ROM drives respectively.
fstype specifies the format of the file system. If you specify auto, the system will attempt to detect the type of disk for you.
options specifies a list of comma-separated options that tell the system how to handle the device. For example, there are options that tell the system the following: whether certain bits on the files should be interpreted, whether users should be able to mount the device, whether the device should be auto mounted at startup, or whether the device should be mounted read-write or read only. To read about all the options, you can use kdehelp (discussed in Chapter 4, Working with Applications) or the man command (Chapter 15, Help Please) and search the UNIX manual pages for fstab and mount.
dump_order specifies the order in which file systems should be dumped by the dump program, a program used for backing up your file system to tape (see Chapter 19, Backups: Safeguarding Your Work).
check_order provides information for fsck (file system check) that specifies the order in which disks are checked. If your system is shut down inappropriately, the next time you boot your system, your disks will be checked for any errors. The number specified by this option tells the system in what order to perform the check. For more information on fsck, use the man command (Chapter 15).
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
069 072Arkusz GM 4 072 (2)Arkusz GM 7 072 (2)069 Czekając na Bestięv 04 072072 073czynnosci IT OUG UGBKUE t uj072009072 075072 074C B 069072 zadaniawięcej podobnych podstron