April 24, 2014
 
 
RSSRSS feed

From the Desktop: Dealing with the Dark Side - page 2

Peace in Our Time

  • August 4, 2000
  • By Brian Proffitt

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

Sitemap | Contact Us