From the Desktop: Dealing with the Dark Side

By: Brian Proffitt
Friday, August 4, 2000 10:25:21 AM EST
URL: http://www.linuxplanet.com/linuxplanet/reports/2150/1/

Peace in Our Time

Just got back from a week-long trip to the South, and I must say there's some beautiful country down there, particularly in South Carolina. Charleston was a fascinating city to visit--old and balmy, and still referring to the American Civil War as "the Unfortunate Misunderstanding." Having lived next door to Illinois all of my life, I discovered there are whole new ways of people remembering Abraham Lincoln, and not with a great deal of fondness.

What's going on in the operating system theater is certainly not a civil war by any means, but it is regarded in the media as a war nonetheless. Windows vs. Linux: the battle royale between the super heavyweight and the scrappy underdog, er, penguin. It's a good thing Microsoft has no logo that can be anthropomorphized, otherwise we'd be seeing splash art with a penguin in boxing gloves squaring off against whatever cutesy representative Microsoft had.

Having been a newspaper editor once upon a time, I'll let you in on a little secret: the press loves a good fight, and they will do almost anything to egg contenders on. Conflict, they will teach you in Journalism 101, is news.

I am not a big fan of this idea, though I certainly understand it. People in general like a good scrap, which is why Jerry Springer is still on the air. (Those of you outside North America, be glad if you don't know who I'm talking about.)

But I am here to preach another line of thought: why does there have to be a war at all?

This concept is not so radical: if you like Linux, use Linux. If you need Windows, use Windows. Even the most hardcore Linux users usually grudgingly admit that they keep a Windows partition or PC around their house. "It's for the wife," they mutter, "or the kid's education games."

Don't be afraid, speak up! You're a bi-OS user! Be proud of your choice!

And, in the spirit of utter moral corruption, I'm going to tell hetero-OS users how to be bi-OS, too!

Knocking Down the Partition Wall

If you have set up your PC for dual-booting Linux and Windows, then you have the ability to access Windows' directories with ease. All you need to do is mount the drive, just like a floppy or CD-ROM drive.

The first thing to do is to find out what your Windows hard drive is named. In your Linux system, open the file /var/log/dmesg, which is a log of the messages sent to the Linux kernel at boot-time. I like to use the emacs editor, so I just type:

emacs /var/log/dmesg

In the file, look for a set of lines that list your system's drives.

hda: WDC AC36400L, ATA DISK drive
hdc: ATAPI CDROM, ATAPI CDROM drive

From this set of values, you can see that your hard drive is named hda (most hard drives are, but you should check anyway). Go ahead and exit emacs.

Now you know the name of your hard drive. But what is the name of your Windows partition? Remember, Linux does not use such silly notations as C:\ or D:\ drive. Luckily, there's an easy answer to this question.

In your terminal window, type:

fdisk /dev/hda

This will start the fdisk application and bring up this prompt:

Command (m for help):

Type p at this prompt to see a list of the partitions located on your hard drive, like this example:

/dev/hda1   *       1    827  6642846   c Win95 FAT32 (LBA)
/dev/hda2         828    830    24097+ 83 Linux
/dev/hda3         831   1655  6626812+  5 Extended
/dev/hda5         831   1646  6554488+ 83 Linux
/dev/hda6        1647   1655    77261  82 Linux swap

And right there, in black and white, is the specific name of the Windows partition: hda1.

You're almost there. The first thing you need to do is make a directory on your Linux file system to mount the Windows partition. I usually do something like

mkdir /mnt/win

Now, if you are the root user, you could enter the mount command to access the Windows partition. The syntax of this command is always

mount device name   mount directory

So, in this instance, you might type

mount /dev/hda1 /mnt/win

But this would not quite be right. After all, the filesystem format on your Linux partition is ext2, while Windows uses FAT32. So to get these two systems to work together, we just need to add the –t parameter and specify the filesystem of the Windows partition, so Linux knows how to work with it. The filesystem notation for FAT32 is vfat, so the complete command line would be:

mount –t vfat /dev/hda1 /mnt/win

Now you can access the files on the Windows partition to your heart's content. Unless you want to use the partition as a regular user, because then this command won't fly. And, even if you were logged in as root, why retype the mount command every time? What you need to do is edit the /etc/fstab file so the partition is called up automatically.

When you open the /etc/fstab file, you might see something along these lines:

LABEL=/             /                       ext2    defaults        1 1
LABEL=/boot         /boot                   ext2    defaults        1 2
/dev/cdrom          /mnt/cdrom              iso9660 noauto,owner,ro 0 0
/dev/cdrom1         /mnt/cdrom1             iso9660 noauto,owner,ro 0 0
/dev/fd0            /mnt/floppy             auto    noauto,owner    0 0
none                /proc                   proc    defaults        0 0
none                /dev/pts                devpts  gid=5,mode=620  0 0
/dev/hda6           swap                    swap    defaults        0 0

So, if you add a line for your Windows partition, you'll be all set. The format of the line is similar to the mount command. When you are finished, your file should look something like this:

LABEL=/             /                       ext2    defaults        1 1
LABEL=/boot         /boot                   ext2    defaults        1 2
/dev/cdrom          /mnt/cdrom              iso9660 noauto,owner,ro 0 0
/dev/cdrom1         /mnt/cdrom1             iso9660 noauto,owner,ro 0 0
/dev/fd0            /mnt/floppy             auto    noauto,owner    0 0
/dev/hda1           /mnt/win                vfat    defaults        1 3
none                /proc                   proc    defaults        0 0
none                /dev/pts                devpts  gid=5,mode=620  0 0
/dev/hda6           swap                    swap    defaults        0 0

If you want to mount other types of partitions, you are certainly able to do so with the mount command or the /etc/fstab file. All you need to know is the partition name and the filesystem type. Several filesystem type names are listed in the following table:

Partition type

File system type

Extended

n/a

FAT12

msdos

FAT16

msdos, vfat

FAT16 <32M

msdos, vfat

GNU HURD or SysV

ufs

HPFS, NTFS

hpfs, ntfs

Linux

ext2

Linux swap

n/a

Minix

ext

QNX 4.x

qnx4

Win95 Extended (LBA)

msdos, vfat

Win95 FAT16 (LBA)

msdos, vfat

Win95 FAT32

msdos, vfat

Win95 FAT32 (LBA)

msdos, vfat

XENIX root/usr

sysv

Let's All Do the Samba!

Using the Samba sever is another excellent way of connecting to Windows PCs that you might be networked to. I could go on and on explaining how to set this up, but someone else has already done so--in a very concise way. I strongly recommend you go out and read the Samba series of help files written by Ying Zhang. They are well written and easy to follow.

After you get done setting up Samba using these articles (or any other method you choose), I have one further suggestion: make a copy of these six files in the /etc directory:

  • inetd.conf
  • hosts
  • lmhosts
  • host.deny
  • host.allow
  • smb.conf

Save these files on a floppy, or on another partition or machine. That way, if you every reinstall another version of Linux on your machine, all you need to do is reinstall the Samba server, create the smb group, the smbuser, and the public and data directories. The you can just copy over these six files to your /etc directory and you're all set. Trust me, it saves quite a bit of typing, especially in the smb.conf file.

Now go in peace, and work together with your fellow operating systems and make the world a nicer place.

Copyright Jupitermedia Corp. All Rights Reserved.