Unixification 2002 Bulletin

[Dec 30, 2002] Slashdot Microsoft Next Generation Shell

An anonymous reader writes "I found this while searching for Perl Jobs in India: "The Microsoft Next Generation Shell Team is designing and developing a new command line scripting environment from the ground up. The new shell and utilities, based on the .NET Frameworks, will provide a very rich object-based mechanism for managing system properties. To be delivered in the next release of Windows, it will include the attributes of competitorsí shells (e.g. aliases, job control, command substitution, pipelines, regular expressions, transparent remote execution) plus rich features based on Windows and .NET (e.g. command discovery via .NET reflection APIís, object-based properties/methods, 1:many server scripting, pervasive auto-complete)."

Re:Cygwin (Score:5, Informative)
by Anonymous Coward on Sunday December 29, @09:14AM (#4976257) I liked this the first time... when it was called Cygwin.

For those whou don't know, Cygwin [cygwin.com] is a UNIX environment, developed by Red Hat, for Windows. It consists of two parts: (1) A DLL (cygwin1.dll) which acts as a UNIX emulation layer providing substantial UNIX API functionality. (2) A collection of tools, ported from UNIX, which provide UNIX/Linux look and feel. The Cygwin DLL works with all non-beta, non "release candidate", ix86 versions of Windows since Windows 95, with the exception of Windows CE.

Other thing which I'd suggest for anyone who is unfortunate enough to work under Microsoft Windows is Perl Power Tools [perl.com]: The Unix Reconstruction Project. The goal is quite simply to reimplement the classic Unix command set in pure Perl, and to have as much fun as we can doing so. See the command list [perl.com].
& Re:Cygwin (Score:4, Informative)
by jonathanclark (29656) on Sunday December 29, @05:01PM (#4978297)
(http://jonathanclark.com) I also built a single-EXE version of cygwin that has many of the utilities that fits on a floppy. It doesn't require any installation, or rely on external DLLs, and always stays as a single EXE file (nothing extract to disk). So it's a nice little file to have sitting around.

http://thinstall.com/docs/index.php?sp=unix_tools. html [thinstall.com] Re:wonder what this means (Score:5, Interesting)
by IamTheRealMike (537420) on Sunday December 29, @12:23PM (#4977085)
(http://theoretic.com/) Though I can't say I'm surprised, I think this is one of the first times where Microsoft seems to have stated that they are persuing similar technologies.

Actually, the next version of IIS has dropped the binary metabase and has replaced it with XML config files, so IIS can be administered by hand, just like Apache (but with a pretty GUI if you want one). Maybe as part of this next-gen shell they'll introduce a good command line text editor.

This sounds to me very much like Microsoft is having a good hard look at what Linux/open source does well, and copying it. Fair game - we've copied them plenty, and are continuing to do so. We could well find that Windows moves on a lot thanks to the competition offered by Linux: will we be able to keep up, and keep pushing things forward to? I think so. I hope so. But the era of kicking Windows for being unstable is already over, insecure looks on its way out (I read coders can get fired now for writing insecure code at redmond), and soon traditional UNIX strongholds like good remote administration may no longer be unique either.

We have our own stupid problems to fix too of course. Lack of a decent object model? Lack of binary portability? That one is killing us at the moment, and there is no good solution (as I'm finding out as part of my project). We really really don't want to have to setup build farms (a binary for every distro version), that'd suck. But it seems the very nature of Linux itself dictates it. Now Windows is moving to .NET they are tidying up a lot of these problems, while we're still playing catchup.

It's certainly going to get interesting soon. Microsoft have sort of woken up.

[Oct 24, 2002] XML-Journal - Co-Inventor of XML Says Office 11 is A Huge Step Forward for Microsoft

Now that the newly XML-enabled version of Microsoft Office, code-named "Office 11," is in its first official beta release, XML-J Industry Newsletter went straight to Tim Bray, co-inventor of eXtensible Markup Language, and asked for his exclusive views on this improvement in what Microsoft routinely-if immodestly-characterizes as "the world's leading suite of productivity software."

Asked if he'd been involved at all in the XML-enabling of Office 11, Bray replies that he hadn't: "No, not in the slightest," he assures us. However, he did receive extended hands-on demos of the alpha and beta software, he says, which gave him the opportunity to test-drive and evaluate the suite.

Word Files Are Now Also XML Files

When asked how XML-enabling will make a difference in MS Office, Bray quickly zeroes in on what in his view is the key differentiator in an XML-enabled Office suite vs the current one. "The important thing," he explains, "is that Word and Excel (and of course the new XDocs thing) can export their data as XML without information loss. It seems Word can also edit arbitrary XML languages under the control of an XML Schema, but I'm actually more excited by the notion of Word files also being XML files."

So it's a breakthrough? Bray has no doubts whatsoever: "The XML-enabling of Office was obviously a major investment and is a major achievement," he declares, without hesitation.

"Built around an open, internationalized file format," he continues, warming to his theme, "Office 11 is going to be a huge step forward for management, independent software developers, and Microsoft."

What is the precise significance of the internationalized file format? Bray, who is also CTO and founder of Antarctica Systems Inc, clarifies as follows: "When I say 'open and internationalized' I'm just saying that these are the two most important benefits that occur when you make information available in XML." In other words, he is saying, XML enables the exchange of any form of data across heterogeneous systems, platforms, and applications.

"So it seems to me," he concludes, in delightfully prophetic mode, "that when the huge universe of MS Office documents becomes available for processing by any programmer with a Perl script and a bit of intelligence, all sorts of wonderful new things can be invented that you and I can't imagine."

That's praise indeed, from the man behind XML itself!

Office 11 is expected to ship in mid-2003 after user testing. Geared toward enterprise users, it will contain components compatible with the .NET initiative. The XML technology incorporated in this beta version supposedly allows data to be more easily exchanged and shared between different programs.

If it all works according to plan, this would obviously increase productivity and interconnectivity. How so? Well, organizations of all sizes often store their data without a common format and in a variety of places (for example, CRM databases and accounting systems). As a result, information workers within those organizations have difficulty accessing the data they need, or, if they can locate it, find that the data is in an unsuitable format.

Microsoft's aim with Office 11 is to make connecting and using data simpler and its path to success in this respect is a function of its broad support for standards-based XML.

XML-J Industry Newsletter applauds the initiative and will be continuing to follow this development from a variety of angles in future issues, including bringing you inside insights from within the heart of the Microsoft XML design team itself in Redmond, WA.

WGET for Windows

WinDump tcpdump for Windows

Mail on Windows NT and 95

SecurityFocus HOME Infocus Remote Management of Win2K Servers Three Secure

 Sept 25, 2002 Remote Management of Win2K Servers: Three Secure Solutions by Mark Burnett

It's a common scenario: your company has an IIS Web server sitting 300 miles away at a high-bandwith, air-conditioned and power-regulated co-location center. The network is stable and the price is right, but you must completely manage the server remotely; you can't just go sit down at the console whenever you want. Remote management presents several problems, the most obvious being that the traffic between you and the server is travelling across the public Internet, available for others to sniff. Another problem is that remote administration normally involves installing software and opening ports, both of which increase the attack surface of your server. The goal when selecting a remote administration solution is to make sure that you (and only you) can do your job without exposing the server to additional risk.

In particular, the concerns when administering a remote server are:

Access Control

Access control is making sure that only you can remotely administer the server. This means that the remote administration software should only accept connections from a small range of IP addresses and should prompt for a username and password. Access control can be further strengthened through the use of smart cards and client certificates. There are also obscurity techniques that may provide additional layers of protection such as using non-standard TCP ports or suppressing service banners.

Integrity

Integrity ensures that the data received by the server is the same data that you sent. You also want to be sure that a packet is authentic and cannot be replayed at a later time.

Confidentiality

Perhaps the greatest concern with remote administration is that sensitive data is travelling across a public network. Confidentiality ensures that this traffic cannot be intercepted and viewed by others. Confidentiality means using strong, accepted encryption algorithms with a sufficiently large encryption key.

Auditing

Auditing is the ability to log all access to a server for later analysis. It is important to remember that a server could very well become a crime scene and it is essential that your remote access solution keep sufficient information about every connection to the server. Furthermore, the logs should be moved off the server itself to ensure their integrity.

Remote Management Methods

Although there are a variety of ways to remotely manage a Win2K server, not all products provide the security requirements listed above. But that doesn't mean we cannot use them. By combining different products we can come up with some very secure solutions that provide features we need to administer remotely.

Below are some examples of what can be done using built-in or third-party open source solutions. While there is no one best way to remotely administer a server, these are good examples of what can be done when combining solutions.

Option 1: Terminal Services Through Zebedee

Terminal Services is a built-in service in Windows 2000 that provides admins with a remote desktop for managing a server. Terminal Services is the most obvious way to remotely manage a server because it is built-in, easy to get running, uses built-in Windows accounts for authentication, and allows for strong encryption. But there are some limitations: there is no mechanism to limit access by IP address, it is not obvious how to change the default listening port, and it has no logging facility. Based on the list of requirements at the beginning of this article, Terminal Services alone does not score well on security.

But Terminal Services can be made more secure by tunneling the traffic through another tool called Zebedee. Zebedee is an open source program that allows you to redirect TCP or UDP traffic over encrypted, compressed tunnels. Zebedee has a small footprint and offers encryption, authentication, IP address filtering, tunneling, and logging. Zebedee can give Terminal Services the boost it needs to make it a very secure remote administration solution.

Zebedee works by listening on a local port and then encrypting and compressing that traffic by sending it to another copy of Zebedee running on the server. The result is a tunnel that can handle multiple TCP or UDP connections over a single TCP port.

To begin, you must configure Zebedee to listen for new connections on a non-standard port (note that your firewall should not allow outside connections to port 3389). This can be done with the following command:

c:\>zebedee -s -o server.log

Next, you run Zebedee on your client and have it listen on port 3389 and redirect that traffic to the server port you selected.

C:\>zebedee 3389:serverhost:3389

This causes Zebedee to listen to port 3389 on the local system and forward that traffic to the remote system (in this case named serverhost), which will forward the traffic on to the local port 3389, where Terminal Services is listening (see Figure 1 Below). Note that by default the communication between the server and client will be through TCP port 11965, but this should be changed when you put it into production.

Figure 1: Terminal Services on Zebedee

At this point, you can open your Terminal Services client and enter localhost as the server. The client will connect to the local Zebedee client which will forward it to the Zebedee server, which will in turn then forward to the remote Terminal Services port. Terminal Service just thinks it is connecting locally, but in fact all traffic is being tunneled through a secure channel.

Zebedee has many options in its configuration file for authentication, encryption, IP address filtering, and logging. Be sure to explore these options and implement as many as possible to ensure your configuration is secure.

Since Terminal Services does not have any option for transferring files, you will need to consider other options. One option is to use an FTP server. Although FTP is normally not secure, you can also tunnel this through the same Zebedee connection. Doing so is a bit tricky but the Zebedee documents have detailed instructions on how to do so.

There are also two other third party solutions for transferring files directly over Terminal Services. One is a free tool called TSDropCopy from Analogx and the other is a shareware tool called WTS-FTP from Ibexsoftware.com.

Overall, Terminal Services is a convenient way to manage a server but in itself is not secure enough to be used remotely. But if it is tunnelled through Zebedee, it can be a very secure solution.

Option 2: VNC On SSH

VNC is a remote desktop tool very similar to Terminal Services, providing remote desktop access to the server. There are, however, some key differences, such as:

While VNC does have some benefits, it is not secure enough to use by itself. The most significant problem is the lack of encryption. But VNC traffic, like Terminal Services, can be tunnelled to make up for its shortcomings. In this case, we will match it up with SSH (a Windows installation of OpenSSH is available at http://www.networksimplicity.com/openssh). OpenSSH is in concept similar to Zebedee but it is a much broader application that also allows for a remote command prompt, secure file copy (SCP), and secure FTP (SFTP). Like Zebedee, it can tunnel traffic over a single port; however, it is limited to TCP traffic. SSH supports strong public key encryption and is a widely-used protocol with strong user support.

The concept of forwarding traffic over SSH is very similar to using Zebedee. You configure the server to listen on a single port (TCP port 22 by default), then connect to that port using an SSH client. An SSH client is essentially an encrypted telnet client that gives you command prompt access to the server. But SSH also allows you to use port forwarding to allow other protocols to work over the same encrypted connection. To instruct your SSH client to forward the VNC ports through the connection, use the following command:

C:>ssh ?L 5901:serverhost:5900 serverhost

This will create a local that appears to be a VNC listener on the local system that forwards to the traffic to serverhost. To connect, point your VNC viewer to localhost:1 as follows:

C:\>vncviewer:1

O'Reilly Network GoLive 6 Adobe's Open Source Embrace [May. 31, 2002] by Glenn Fleishman

Author's Note -- Before GoLive 6 shipped, I would have tried to dissuade anyone but an already experienced Unix administrator or someone who needed to become one as part of a job from trying to self-install all the components needed to run MySQL, PHP, Apache, and JSP on a Mac OS X machine or under Windows XP or 2000. If you're already serving pages that need these elements and want to migrate them to a desktop server, or want to start serving content that requires these elements, the GoLive Preconfigured Servers substantially lower the bar.

In this article I'll show you where these components are located in the GoLive 6 shrink-wrap, and then once you have a handle on these tools, I'll show you how to upgrade them the good, old-fashioned, open source way.

GoLive 6 Breaks From Tradition

Adobe has never expressed close feelings for either open-source software or the Unix and Linux platforms. As Linux has risen in popularity and open source has increased in quality and availability, Adobe provided only sporadic and incomplete support. Photoshop under Red Hat? Nope. But Acrobat Reader for certain Unix flavors? Sure.

GoLive 6 marks a decided change in attitude from Adobe. In the interests of a competitive product and a complete server feature set, the company leapt into bed with Apache, Tomcat (a JSP server), MySQL, and PHP under both the Darwin environment of Mac OS X and the modern NT-style architecture of Windows XP and 2000.

As Derrick Story noted in the first article of this series, GoLive emerged from the graphic design world in which the program started as a WYSIWYG page layout tool. Over time, it evolved into a full-featured editor with support for JavaScript, Cascading Style Sheets, and Dynamic HTML, working alongside a drag-and-drop site management system.

At the same time as GoLive, Inc. (and later Adobe-developed GoLive), Macromedia pushed and pulled its own page and site tool, Dreamweaver. As GoLive became more graphically intense and expanded its reach into directly editing different kinds of media (QuickTime, images, vector art) and integrating with other Adobe graphic tools (Photoshop, Illustrator, ImageReady, LiveMotion), Dreamweaver kept climbing up the code ladder, including more and more built-in or add-on support for code development that worked alongside page and site creation.

Dreamweaver UltraDev, for instance, was a powerful package that supports authoring ASP, JSP, and ColdFusion. It integrates many kinds of databases and database conduits with page layout tools, and provides end-to-end support in the case of JSP (with their JRun server) and ColdFusion (part of their Allaire merger) for design to code to database to server testing and development. (Dreamweaver MX expands this to incorporate UltraDev, and to work with and create Web services and Web applications using JavaServer Pages, ColdFusion, SOAP, and .Net.)

GoLive lagged on the code side, and its initial foray into database integration, called Dynamic Link, only worked with ASP servers running ADO DB conduits or Microsoft Access databases. It was frustrating to configure and use, and I only know a handful of users who had the right combination of server and savvy to build a functioning system.

Adobe wisely jettisoned Dynamic Link, replacing it with Dynamic Content. The change wasn't cosmetic, but reflects instead a significant improvement in features, flexibility, and troubleshooting. GoLive 6 supports ASP, JSP, and the Internet favorite PHP for database integration of content. It also ships with a full set of preconfigured servers for both Mac OS X and the Windows XP/2000 environments. The preconfigured servers include Apache 1.3.22 with PHP 4.1.2 precompiled in; Tomcat 3.2.2, a JSP server; and MySQL 3.23.47.

For many users, the preconfigured servers allow them to suddenly tap the potential of database integration with a Web site without the vast ramp up in knowledge typically required to compile and configure server software. This package is simple to get started with, but, as with any commercial release, hard-won tips help smooth the process.

Installing GoLive 6 Preconfigured Servers

The preconfigured servers ship on a disk bound into the Adobe Web Workgroup Server manual. (More on AWWS later: it's a JSP-based WebDAV server that supports versioning via a GoLive interface.) Once installed, a set of test scripts allows some configuration and displays example results and projects.

Installing it is typically a snap. The installation system is slightly different under Windows 2000/XP and Mac OS X, but both involve a package-style graphical installer, which includes screens of instructions. The Apache/PHP and JSP servers are in the Dynamic Content folder. This single installer puts all of the software in the right place.


Related Reading

Web Database Applications with PHP & MySQL
By Hugh E. Williams, David Lane

Table of Contents
Index
Sample Chapter
Read Online--Safari


The installer allows you to set non-default ports for any of the associated applications. PHP is compiled as part of Apache, so Apache calls it internally. Tomcat is a JSP server that Apache connects to. MySQL is a server that any scripting language can interact with through the appropriate conduit or interface.

MySQL's installer is found in the Extras folder, which also has the JDBC driver (the Java Database Connectivity or database conduit) for MySQL.

To install MySQL, you need to follow the instructions in the Readme file, which include copying the install script to the local hard drive, launching Terminal, and creating a new user account. The instructions are actually quite clear and more than adequate.

MySQL, as installed, still requires a command-line entry to set the root password for the server. The install script offers up a reminder to run these two commands:

./bin/mysqladmin -u root -p password 'new-password'
./bin/mysqladmin -u root -h localhost -p password 'new-password'

The "localhost" item is literally "localhost": if your system identifies itself by a host name, "localhost" isn't the right value. MySQL is very particular.

When you're choosing MySQL passwords, keep in mind a later issue we'll cover: MySQL passwords are stored in the clear in well-known locations as part of the GoLive Dynamic Content system. The passwords are enveloped in a script file that prohibits access. But nonetheless, they're in the clear on your server. In my case, I opted to create a special, limited permission account that wouldn't wreak havoc if my server were compromised. Adobe should take note: this is a giant, gaping security error.

The iconv library is also in the Extras folder; it must be installed into your PHP directory following the instructions in the same folder for PHP to work. This appears to be a licensing issue.

The installation process also creates server start, stop, and restart scripts for all servers and individual servers in the package.

Both the Apache/PHP and JSP servers can be used as actual production systems by editing the configuration file. The installer creates shortcuts for opening and editing the configuration files associated with the two servers, or you can just use Terminal to edit the files with vi or another text editor.

Many GoLive users, even sophisticated ones, may balk at the command-line SQL sequences that MySQL (and other databases) require. A colleague pointed me to the superb phpMyAdmin set of scripts that put a Web front-end onto MySQL administration. Download the source code from phpmyadmin.sourceforge.com.

Why and How I Installed PHP4, MySQL, and Apache on Windows 98
Sep 27, 2000, 18 :29 UTC (1 Talkback[s]) (1052 reads) (Other stories by Edward Tanguay)

Originally appearing in The Web Developer's Journal.

By Edward Tanguay

Four months ago I was selected as Web developer for a large Web site project for six hospitals here in Berlin. It was going to be an exciting project in which I would work together with a marketing company to realize a network of Web sites. However, when we had the first meeting, the head of the computer department said, "Wait a minute. You program in ASP? We run Linux boxes here and can't justify the cost or security risk of an NT-Server." They were unwilling to budge and I didn't want to force Microsoft on them and then have to work with disgruntled system administrators, so I backed out gently and declined the contract.

Beyond ASP: JSP, ColdFusion or PHP

Since that day I've been looking for ways to extend my server-side programming skills beyond the powerful but environment-limited Active Server Pages. I concluded that I basically had three choices outside ASP for server-side scripting: JSP, ColdFusion and PHP. The first, JSP, is promising but still has a relatively small community and a lack of ISPs which support it. In addition, if you use the JSP server from Allaire it is quite expensive. The second choice, ColdFusion, also from Allaire, provides you with a powerful and robust server-side scripting environment centered around databases and e-commerce, but again, the problem is it simply costs too much. If you don't have access to the multi-thousand dollar Enterprise server, you're out of luck (the free ColdFusion Express server doesn't even support session variables - not very useful).

LAMP is red hot and free

PHP, on the other hand, is free. It is combined with three other technologies to form a powerful Web development solution abbreviated LAMP: Linux (operating system), Apache (Web server), MySQL (database) and PHP (scripting language). Even with MySQL's insistance that businesses pay a nominal fee for its use, Linux, Apache and PHP are absolutely free which make the LAMP solution the most cost-effecive solution for individuals, universities and businesses. Web devlopers wishing to acquire valuable scripting skills can do so for free. On top of that, LAMP is generally known to be more secure and robust than other solutions (less crashing, less rebooting, inherent UNIX security). On top of that, LAMP has one of the largest, most active, most dedicated communities on the Web. PHP and the LAMP solution was clearly the best choice for me and I was excited.

The Linux hurdle

However, if you are a Windows user, learning Linux is like being parachuted into Italy without knowing Italian. You will be hopelessly and thoroughly lost at the UNIX prompt. Although my repeated forays into the Linux world have enabled me to install Suse Linux 6.4, set up the X Window System and even use the vi editor, I still lack so much basic knowledge of Linux that even the simplest things such as unpacking files or installing software bring me to a paralyzing stop. So even if you are the type of Windows user who can buy a $50 computer book on almost any application and become an expert in it by the end of the week, Linux is not something you are going to learn in a week, or a month or even a year without an inordinate investment of time, effort, paradigm shifting and lots of long, frustrating nights. Hence LAMP is not an option for the casual Windows user wanting to learn PHP scripting.

Settling for WAMP

Luckily, PHP, MySQL and Apache can also run on Windows (hence WAMP). Note that this is not the most stabile platform to serve your pages to the world, but it is an adequate solution if you want to learn and begin developing with PHP/MySQL while remaining in your familiar Windows environment. You can install Apache, PHP and MySQL on your Windows 98 machine, then upload your applications via FTP to a more stabile LINUX or UNIX server. WAMP is a good compromise for Windows-based Web developers who want to expand their server-side scripting skills into PHP and MySQL.

WAMP installation cryptic but not impossible

It took me a full seven days until I had Apache, PHP and MySQL on my Windows 98 installed, configured and working. It was not easy. The Web is full of well-meaning but conflicting manuals which give you instructions such as to enter "/php4win/" when it should be "c:/php4win/" - that one took me two days to figure out. Another two days was spent downloading incorrect MySQL packets (the manuals tell you to "download MySQL" but when you get to the page you are faced with a choice of about 30 different download possibilities). Luckily there were some very helpful people on the Web Developer's List who kept helping me until I got it. Thanks again to all of you!

Free workshop on installing PHP4, MySQL, Apache on Windows 95/98

If you want to install PHP4, MySQL and Apache on Windows 95 or 98, take my free online workshop on how to do it. This 14-step workshop has explicit instructions and screen shots which will lead you past all the pitfalls. With this Workshop, you can have PHP4, MySQL and Apache installed, configured and working on your Windows 98 within the hour.

Edward Tanguay is a Web developer and language trainer based in Berlin. For more diaries and tips on development visit Edward's Web Developer Site.

The Core Dump icoutils 0.15.0

About: The icoutils are a set of programs for extracting and converting images in Microsoft Windows icon and cursor files. These files usually have the extension .ico or .cur, but they can also be embedded in executables and libraries (.dll-files). Icoutils can also create icon and cursor files.

Changes: A new option, -t, --alpha-threshold, was implemented, and a bug that was causing icotool to crash when creating icons was fixed.

[June 3, 2002] LinuxPlanet - Tutorials - Tutorial Adding Additional Hard Drives in Linux - The Theory Behind Hard Drive Management

"How can I add one more hard disk?", "What should I do if my colleague brings a new hard disk and I have to copy my files there?", "When I was using Windows, one could see the new disk immediately and Linux is too complex!" These are some of the common questions and concerns of new Linux users, who are facing the problem of adding of a new hard drive. Some of them are so accustomed to Windows that they can not think any other way, so they come up with such statements as "I have used fdisk and format programs, but there are no such ones in Linux!"

In reality, the procedure of adding of new hard drive in Linux is not that hard and sometimes you can spend less time then you would spend to do the same thing in Windows. To illustrate this, I'll start from the very beginning to explain this procedure in detail.

First of all, I need to mention that before a users tries to add any new hard disk, he should learn the basics of what "partitioning" and "file systems" are and what is the difference between Primary, Extended, and logical partitions. You should know how to add a new disk to the computer physically (which is typically covered in the hard drive's documentation). I'm going to assume you know these basics, because the focus of this article will be how to get Linux to behave with your new drive.

I'm going to start from the theory of the process.

There's not much sense in digging into the terminology and principles of adding of a new devices in UNIX systems--there are too many different UNIX versions to try that approach. We'll just go-over Linux-specific issues.

All hard disk drives in the Linux operation system have special names, which consist of three parts, two of which are listed here:

(I have to mention that for different Linux distributions, this range could differ. For example, Red Hat Linux 7.2 uses the range "a" to "l" for the IDE disk drives, and a range from "a" to "az" (two symbol combination!) for the SCSI drives).

This second symbol defines the number of device. SCSI disk drives use sorted numbering, which depends on the ID of device. The IDE scheme differs a bit. Let's
look at the scheme:

...and so on.

When you're connecting a new IDE disk to the motherboard you should always be ready to remember how was it connected: which interface of what controller is being used and how was it assigned: master or slave.

When you don't have a motherboard with four IDE controllers, or your server configuration has no additional IDE controllers, you should not have to use device names starting with "hde."

The third section of the naming scheme is:

All partitions are numbered next way: 1-4 - primary and extended, 5-16 (15) - logical. So, in one system we can have not more than five primary partitions and not more than 11 (10) logical partitions on one physical hard disk.

If this number is absent, this means that this name represents the entire hard drive.

To get list of disk names in a system we need to enter this command as 'root' superuser for IDE drives:

        # ls /dev/hd*

or

        # ls /dev/sd*

for SCSI drives.

If you are very new to all of this, remember that this will not generate a list of connected (attached) disks but a rather a list of disk names. With this list we wil be able to determine when and what were the last disks attached. So, don't be wondering if you get a very long list.

It's time to do some practice now. All actions should be executed with superuser 'root' privileges. Warning: you should be very accurate so as not to damage the data on your hard drives. Backing up everything would not be a bad idea, either.

Let's take a look at some typical and usual situations.

For example, your friend gave you a hard drive which was formatted in MS Windows system or even Linux, and there are some important files on this drive you want to keep.

First of all, obviously, we need to connect the hard drive physically to our PC, which for this example will be Master on Secondary interface. In this case, the disk name in the system will be hdc. After starting Linux, it is necessary to check whether Linux found the new device. For this, you can use the following command:

       # ls /proc/ide

The result will be some string like:

        drivers  hda@ hdc@ ide0/ ide1/  piix    

So, we have found device hdc in our list. Everything seems to be okay. If you did not see the device in this list, you would need to check again all steps of physically connecting the hard drive to the PC.

Let's now take a look at what partitions we have available on the drive:

      # fdisk -l /dev/hdc

        Disk /dev/hdc: 64 heads, 63 sectors, 787 cylinders
        Units = cylinders of 4032 * 512 bytes

           Device Boot    Start       End    Blocks   Id  System
        /dev/hdc1   *         1       610   1229728+  83  Linux
        /dev/hdc2           611       787    356832    5  Extended
        /dev/hdc5           611       787    356800+   c  Win95 FAT32 (LBA)

It's easy to understand that in this example we have three partitions on our hard drive, and two of them (the first and fifth) are filled with some sort of data. Also, the first partition is a primary partition of the Linux system, and the fifth is a logical disk of Windows FAT32. The first partition is a bootable (as shown be the '*' symbol in the Boot column).

Now we need to attach these partitions to our file system. Such an operation of connecting partitions (to be more exact - connecting file systems) in Linux is called mounting and, as such, we use the command 'mount' to handle this. There is also a reverse operation known as unmounting, which we can start with the command 'umount'.

When you mount a partition in Linux, you need to associate it with a directory somethere in the file system. This is called creating a mount point. Usually you will want to create these mount point directories for each partition, such as:

       # mkdir /mnt/hdc1
        # mkdir /mnt/hdc5

Of course, you can use pre-existing directories. We just need to remember a couple of rules:

  • In the Linux system, it is a usual (though not necessary) practice to group all mount points in one place, except in the cases when mounting system partitions (like /usr, /home, /var, etc.);
  • The directory used as the mount point should be empty, or else its contents will be unavailable until the partition is unmounted.

Now, let's use the command 'mount' and attach some partitions:

      # mount /dev/hdc1 /mnt/hdc1
        # mount /dev/hdc5 /mnt/hdc5

Here /dev/hdc1 and /dev/hdc5 are the device names, and /mnt/hdc1 and /mnt/hdc5 are the mount points. (It goes without saying, that the directory names for the mount points don't have to mirror the partition names exactly.

Now, when changing to the directory to either /mnt/hdc1 or /mnt/hdc5, we can see contents of partitions.

If you are mounting a partition that uses a different filesystem than the one you're working in, it's necessary to mention the type of file system using the key -t of the mount command. If you have already mounted the partition, do not forget to unmount the partition with the command 'umount' before using the -t key to establish the type of filesytem used on the "foreign" partition:

       # umount /mnt/hdc5
        # mount -t vfat /dev/hdc5 /mnt/hdc5

The most common values of key -t are:

  • msdos - FAT12 and FAT16
  • vfat - FAT16 with long file name support, FAT32
  • ext2 - primary Linux file system;
  • ext3 - compataible with ext2 file system with log support
  • reiserfs - new Linux file system with log support

A full list of supported file systems (more than 30) can be found in the man pages of the mount command.

Some readers, after following all of the above operations, may note that instead of certain language symbols appearing in the file names of a FAT file-system partition, all they get are question marks. A prime example of this are f.e. Russian symbols within filenames on a FAT file system.

This doesn't mean that Linux won't support the Russian language in file names. Actually, Linux supports a lot of national code pages--we just need to establish exactly which one we want to use. This is done with the key -o.

After unmounting the partition in question, use these commands. For FAT partitions created with Windows 98 and/or Windows NT:

       # mount -t vfat -o iocharset=koi8-r,codepage=866 /dev/hdc5 /mnt/hdc5

For FAT partitions, created with Windows ME and/or Windows 2000/XP:

       # mount -t vfat -o iocharset=koi8-r,codepage=866,uni_xlate=1 /dev/hdc5 /mnt/hdc5

The difference here is in the additional argument uni_xlate. We need that argument because Windows ME/2000/XP uses Unicode in file names.

So, now we have everything set up for Russian file names. You can use the iocharset variable for your own language needs with the preceeding commands.

For FAT partitions it is also nice to use the arguments uid and quiet. This is very important because FAT doesn't have any services to separate or deny access to files.

The argument uid=user defines the owner of a mounted file system (user) who will have all rights to write/create new files on disk. The argument quiet hides all error messages, which will occur because it's impossible to change file owner and file access rights once a file is copied onto a FAT partition.

Let's try to add an absolutely new hard drive in this next example.

The only difference from the previous methodology is that before mounting the new drive, we need to divide that hard drive into partitions first and format them to whatever filesystem we want to use.

To keep things simple, we'll assume that this new hard drive is connected as the Master at the Secondary interface (hdc), just as in the prior example.

Dividing into partitions is done with the help of 'fdisk' utility:

       # fdisk /dev/hdc

        Command (m for help): _

For a short manual we need to enter the 'm' command:

       Command (m for help): m
        Command action
           a   toggle a bootable flag
           b   edit bsd disklabel
           c   toggle the dos compatibility flag
           d   delete a partition
           l   list known partition types
           m   print this menu
           n   add a new partition
           o   create a new empty DOS partition table
           p   print the partition table
           q   quit without saving changes
           s   create a new empty Sun disklabel
           t   change a partition's system id
           u   change display/entry units
           v   verify the partition table
           w   write table to disk and exit
           x   extra functionality (experts only)

        Command (m for help):

We need to know just few necessary commands: d,p,n,q,w. Don't be afraid to use them--all your changes will be done only in memory and will only be written to the hard after the 'w' command is entered. If we have an error, we just need to cancel all changes with the command 'q'.

First of all, let's make ourself sure that disk is empty:

        Command (m for help): p

        Disk /dev/hdc: 64 heads, 63 sectors, 787 cylinders
        Units = cylinders of 4032 * 512 bytes

           Device Boot    Start       End    Blocks   Id  System

        Command (m for help):

Often sellers of PCs and hardware will pre-divide disks into partitions. In such cases we can use command 'd' (described below) to delete everything what we do not need.

So, let's create a new parititon (with command 'n'), answering all the questions as we go:

       Command (m for help): n
        Command action
           e   extended
           p   primary partition (1-4)

Choosing the partition type-- primary or extended--we will enter P for primary.

In choosing number of the partition in this example, we will assign all of the all free space to one partition. Because this will be the first and only existing partition, we will assign the number 1:

        Partition number (1-4): 1

When setting the number of the first cylinder of the partition, we can just use the default value, which is recorded when we just press Enter:

        First cylinder (1-787, default 1):
        Using default value 1

Setting the number of the last cylinder of the partition is easy in this example, since we are filling the entire drive with one partition. Again, just press Enter for the default (instead of the number of the cylinder, we can set size of partition in bytes, kbytes, or megabytes):

        Last cylinder or +size or +sizeM or +sizeK (1-787, default 787):
        Using default value 787

        Command (m for help):

Now, partition is created. We can take a look of new table of partitions with the help of the 'p' command:

        Command (m for help): p

        Disk /dev/hdc: 64 heads, 63 sectors, 787 cylinders
        Units = cylinders of 4032 * 512 bytes

           Device Boot    Start       End    Blocks   Id  System
        /dev/hdc1             1       787   1586560+  83  Linux

        Command (m for help):

If we don't like (for some reason) the location or number of the partition, we can delete it using 'd' command:

        Command (m for help): d
        Partition number (1-4): 1
        Command (m for help):

If you want to divide the disk into a few partitions, you will need to repeat all these operations a few times. One thing that is important to remember is that if the amount of partitions is greater than four, you'll need to create not primary, but an extended partition across the whole available disk space. Inside this partition you can create as many logical parts as needed.

Remember, please, that logical partitions always should be numbered from 5 upwards; it doesn't matter how many primary partitions were created before (one, three, or none at all).

The type of the newly created partition on a new hard drive will always be set to 83 (Linux type). The 'fdisk' utility supports control and creation of numerous partition types, though. We can get a list of them using the command 'l'. We also can change the type of partition using the command 't'. I absolutely do not recommend beginners should use this ability in a Linux system; better they should use only two types -- 83 (Linux) and 82 (Linux swap).

After all manipulations with 'fdisk,' we will get needed configuration. Now we should quit 'fdisk' and save all results using the command 'w'.

We do not need to reboot our PC. Sometimes, to tell the truth, 'fdisk' is unable to update the table of partitions in memory (such as in, for example, the latest versions of Red Hat Linux), but it will report about such problem. If this happens, then you will have to reboot the PC.

Of course, before using a partition, you need to format it. Keep in mind that, since we need to work with partitions on hard disk, we be working with with the device /dev/hdc, but we will format the partition /dev/hdc1.

We can accomplish this formatting with the 'mkfs' utility. Usually for Linux partitions, we will use one of three file systems: ext2, ext3, or reiserfs. We

also have the option to use several others, like ext, XFS, JFS. But ext is too old, and is not in much use anymore, and XFS and JFS installation requires deep knowledge of setup and configuring the Linux operation system.

We can execute the following command to format the partition with the ext2 file system:

        # mkfs -t ext2 /dev/hdc1

(key '-t' points to the type of file system). To format as ext3:

        # mkfs -t ext2 -j /dev/hdc1

This is not a typo, by the way. We are setting the type to ext2. But since ext3 is an updated "child" of ext2, it has forward and backward compatibility with its "parent".

To format a partition with ReiserFS:

        # mkfs -t reiserfs /dev/hdc1

Once 'mkfs' has finished its work, our partition is ready to be mounted.

All of the methods described above have one rather unfortunate drawback: after each reboot of the system, you need manually mount partitions again as root. Ideally, you will want automated mounting on PC startup.

This is easily done. In the system configuration directory /etc there is a file named 'fstab'. Inside this file is a list of connected partitions, which looks something like this:

        # cat /etc/fstab

        /dev/hda1 / reiserfs notail,usrquota,grpquota 1 1
        none /dev/pts devpts mode=0620 0 0
        none /dev/shm tmpfs defaults 0 0
        /dev/hdb /mnt/cdrom auto user,iocharset=koi8-r,umask=0,exec,codepage=866,ro,noauto 0 0
        /dev/fd0 /mnt/floppy auto user,iocharset=koi8-r,umask=0,sync,exec,codepage=866,noauto 0 0
        none /proc proc defaults 0 0
        /dev/hda5 swap swap defaults 0 0

Each string of this file keeps a description of each partition for mounting and has six columns (fields):

  • Name of device
  • Mount point
  • Type of file system
  • Additional arguments of mount. Some of them are common for everything, some of them are specific for this or that file system
  • ID number in query to checkup of integrity of file system on PC startup. Such checking works periodicaly. If this id number is 0, no checking will be done
  • Backup value (0 or 1). This argument is used by some backup software utilities.

Let's come back to our example. Specifically, partition hdc1 was formatted as ext3 and it needs to be mounted on the /mnt/hdc1 mount point during PC startup. To accomplish this, we will add the following string to the end of the file /etc/fstab:

        /dev/hdc1  /mnt/hdc1  ext3  default 2 1

This is very important: do not forget to add a "carrier return" (break line, enter, etc.) at the end of /etc/fstab file. Otherwise, the last string in the file will be ignored! (Actually, this doesn't matter in the latest versions of Linux. But get in the habit anyway, to avoid problems on PCs with other Unix software or older versions of Linux).

Now, we need make sure: did we edit everything right in fstab?

        # mount /mnt/hdc1

If we don't get any error messages that means this partition will be automatically mounted upon every startup.

Notice, by the way, this other (short) syntax of the 'mount' command. When we are using only one argument (mount point) all the needed information for 'mount' was derived from /etc/fstab.

In this article, we examined a few variations and rules for connecting new hard drives in Linux. Note that we did not cover a lot of the specialized fine-tuning that can be done in some of the more advanced operations, such as tuning file systems with log support, defining access rights to mounted partitions, and the like. Hopefully you will take from this article is a clearer understanding of the principles behind adding a hard drive to a Linux system.

[May 25, 2002] Some information about Dual boot was added.

Info-ZIP Home Page was added

Linux Today - The Economist An open and shut case. What is behind Microsoft's attack on open-source software