Thursday, December 10, 2009

mounting windows drives on linux

We can mount windows drives on linux by using NTFS-3g(Linux -NTFS).
The goals of the Linux-NTFS project are to develop reliable and full feature access to NTFS by the Linux kernel driver, and by a user space filesystem (ntfsmount), and to provide a wide collection of NTFS utilities (ntfsprogs) and a developer's library (libntfs) for other GPLed programs. We have achieved already a lot, with high quality results.

How to access NTFS from Linux
Choose one of the following three options:

1) Linux has an integrated kernel driver. It allows reading of files, and rewriting existing files. It does not support creation of new files or deletion of existing files. .

2) ntfsprogs includes an improved driver, ntfsmount, which provides the same functionality as the kernel driver. Additionally it also supports basic cases of directory, symlink, device and FIFO file creation, deletion and renaming. Note: That doesn't mean it always succeeds, it is still experimental and might just as well refuse to complete an operation in order to prevent corruption. See the ntfsmount page for more details.

The beta version of the ntfs-3g driver can be downloaded from http://www.ntfs-3g.org

partitioning hardisk

As outlined in the General Information section, the most common way to install Linux is to allocate a part of your hard disk for Linux. Most computers come with one hard disk, and that hard disk is usually setup to have just one partition which uses all of the space on the hard disk. If this is the case with your computer, then you will need to either add a new hard disk for Linux, or shrink your existing partition to make space for Linux.

Each partition not only creates a separate independent space on the hard disk but it also associates a method of reading and writing information to the drive, the format of the drive. Linux has a number of different formats it can use for sections of the hard disk, the most popular being ext2 and ext3 (others include reiserfs, xfs and jfs). Normally you will not have to worry much about the formats of Linux partitions, the installation program will make appropriate suggestions. One other type of partition format for Linux which is worthy of mention is swap. A swap partition is used to effectively extend your memory onto the hard disk, so if your computer wants to use more memory then it has, it will "swap" information in memory which it doesn't need at the time onto the hard disk. It is possible to use a large file on a normal partition for swap however this is much slower. Unless you measure your memory in Gigabytes, you should probably use a swap partition at least the size of your memory, and if you have less then 256Megabytes of ram then you may want a partition 2 or 3 times it.

If you are in the common situation of having to shrink the only Windows partition on your hard disk, the first thing to be aware of is that your access to the information on the Windows partition will depend on its format. There are two main types of partition formats for Windows, FAT and NTFS. Generally computers with the Windows 95/98/ME systems will have FAT partitions and Windows NT/2000/XP will have NTFS partitions, though the NT/2000/XP family can also use FAT.

The critical difference between FAT and NTFS as far as Linux is concerned, is that while reading information from either system is perfectly safe under Linux, writing information to an NTFS partition is currently regarded as potentially unsafe so you wouldn't be able to edit these files from Linux and access the changes directly under Windows. Linux is perfectly reliable sharing FAT partitions with other operating systems (if your feeling lost, perhaps telling you that when you format a floppy you are actually making a FAT filesystem on it will help put things in perspective). Windows has no native method of reading Linux formatted partitions, but the Free explore2fs program allows you to read and copy information from ext2 and ext3 Linux partitions while you are running Windows. There is now also a file-system driver from the same source called ext2ifs which allows your ext2 and ext3 partitions to appear as extra drives in Windows NT4/2000/XP (still read only).

There are numerous methods for shrinking Windows partitions to make space for Linux (and I would recommend simply making the space and using the installer to create the partitions and format them). No matter what method you use to do this, you should backup all your data before you begin, in fact you should always keep backups of all your important information as a hard disk could fail at any time. Another tip is to defragment your drive in windows before you begin which makes it much easier for the software which has to do the shrinking. The tried and true method for shrinking a partition is a commercial program called Partition Magic ($69.95 as of Sept 2004). You can also do this with Free software such as parted (or the graphical front-end QTparted) or often as part of the installer itself. Check the installation documentation for the system you plan on installing to see if it's now supports resizing/shrinking ntfs partitions.

Whatever scenario you start in, when you begin to install Linux you need to know where you have space to put it. It may be a new hard disk or free space on an existing hard disk. For a modern desktop Linux system you would want to allocate an absolute minimum of 2GB of hard disk space, 5GB would be far better and if you have plenty of space (or if you plan to install lots of large pieces of software, perhaps games) 10GB+ is perfectly reasonable. If you have enough free space the installation program may suggest creating more than one Linux partition, if so it is well worthwhile creating a separate partition for your files, the /home partition. Amongst other things you can reinstall your system or install a new system without having to make an additional backup of your files (remember again you do always keep backups of everything important).

hierarchy of file system

< / >

The root directory. The starting point of your directory structure. This is where the Linux system begins. Every other file and directory on your system is under the root directory. Usually the root directory contains only subdirectories, so it's a bad idea to store single files directly under root.

Don't confuse the root directory with the root user account, root password (which obviously is the root user's password) or root user's home directory.

< /boot >

As the name suggests, this is the place where Linux keeps information that it needs when booting up. For example, this is where the Linux kernel is kept. If you list the contents of /boot, you'll see a file called vmlinuz - that's the kernel.

< /etc >

The configuration files for the Linux system. Most of these files are text files and can be edited by hand. Some interesting stuff in this directory:

/etc/inittab

A text file that describes what processes are started at system bootup and during normal operation. For example, here you can determine if you want the X Window System to start automatically at bootup, and configure what happens when a user presses Ctrl+Alt+Del.

/etc/fstab

This file contains descriptive information about the various file systems and their mount points, like floppies, cdroms, and so on.

/etc/passwd

A file that contains various pieces of information for each user account. This is where the users are defined.

< /bin, /usr/bin >

These two directories contain a lot of programs (binaries, hence the directory's name) for the system. The /bin directory contains the most important programs that the system needs to operate, such as the shells, ls, grep, and other essential things. /usr/bin in turn contains applications for the system's users. However, in some cases it really doesn't make much difference if you put the program in /bin or /usr/bin.

< /sbin, /usr/sbin >

Most system administration programs are stored in these directories. In many cases you must run these programs as the root user.

< /usr >

This directory contains user applications and a variety of other things for them, like their source codes, and pictures, docs, or config files they use. /usr is the largest directory on a Linux system, and some people like to have it on a separate partition. Some interesting stuff in /usr:

/usr/doc

Documentation for the user apps, in many file formats.

/usr/share

Config files and graphics for many user apps.

/usr/src

Source code files for the system's software, including the Linux kernel.

/usr/include

Header files for the C compiler. The header files define structures and constants that are needed for building most standard programs. A subdirectory under /usr/include contains headers for the C++ compiler.

/usr/X11R6

The X Window System and things for it. The subdirectories under /usr/X11R6 may contain some X binaries themselves, as well as documentation, header files, config files, icons, sounds, and other things related to the graphical programs.

< /usr/local >

This is where you install apps and other files for use on the local machine. If your machine is a part of a network, the /usr directory may physically be on another machine and can be shared by many networked Linux workstations. On this kind of a network, the /usr/local directory contains only stuff that is not supposed to be used on many machines and is intended for use at the local machine only.

Most likely your machine isn't a part of a network like this, but it doesn't mean that /usr/local is useless. If you find interesting apps that aren't officially a part of your distro, you should install them in /usr/local. For example, if the app would normally go to /usr/bin but it isn't a part of your distro, you should install it in /usr/local/bin instead. When you keep your own programs away from the programs that are included in your distro, you'll avoid confusion and keep things nice and clean.

< /lib >

The shared libraries for programs that are dynamically linked. The shared libraries are similar to DLL's on Winblows.

< /home >

This is where users keep their personal files. Every user has their own directory under /home, and usually it's the only place where normal users are allowed to write files. You can configure a Linux system so that normal users can't even list the contents of other users' home directories. This means that if your family members have their own user accounts on your Linux system, they won't see all the w4r3z you keep in your home directory. ;-)

< /root >

The superuser's (root's) home directory. Don't confuse this with the root directory (/) of a Linux system.

< /var >

This directory contains variable data that changes constantly when the system is running. Some interesting subdirectories:

/var/log

A directory that contains system log files. They're updated when the system runs, and checking them out can give you valuable info about the health of your system. If something in your system suddenly goes wrong, the log files may contain some info about the situation.

/var/mail

Incoming and outgoing mail is stored in this directory.

/var/spool

This directory holds files that are queued for some process, like printing.

< /tmp >

Programs can write their temporary files here.

< /dev >

The devices that are available to a Linux system. Remember that in Linux, devices are treated like files and you can read and write devices like they were files. For example, /dev/fd0 is your first floppy drive, /dev/cdrom is your CD drive, /dev/hda is the first IDE hard drive, and so on. All the devices that a Linux kernel can understand are located under /dev, and that's why it contains hundreds of entries.

< /mnt >

This directory is used for mount points. The different physical storage devices (like the hard disk drives, floppies, CD-ROM's) must be attached to some directory in the file system tree before they can be accessed. This attaching is called mounting, and the directory where the device is attached is called the mount point.

The /mnt directory contains mount points for different devices, like /mnt/floppy for the floppy drive, /mnt/cdrom for the CD-ROM, and so on. However, you're not forced to use the /mnt directory for this purpose, you can use whatever directory you wish. Actually in some distros, like Debian and SuSE, the default is to use /floppy and /cdrom as mount points instead of directories under /mnt.

< /proc >

This is a special directory. Well, actually /proc is just a virtual directory, because it doesn't exist at all! It contains some info about the kernel itself. There's a bunch of numbered entries that correspond to all processes running on the system, and there are also named entries that permit access to the current configuration of the system. Many of these entries can be viewed.

< /lost+found >

Here Linux keeps the files that it restores after a system crash or when a partition hasn't been unmounted before a system shutdown. This way you can recover files that would otherwise have been lost.

dual booting linux and windows on same machine

Windows and Linux can live comfortably on the same the same machine, even the same harddrive. The choice of operating systems can be made at the boot-up sequence when you thro the power switch. This configuration is known as the "dual-boot" configuration. This is how most linux users start off. Unless you're a BOFH of course *grin*.
FAT32 Support Requirements
To have access to your Win partition from Linux (file sharing between Linux and Win), which is useful, think of all those MP3s... you will also need a version 2.0.34 of the Linux kernel or higher. Below is a list of recent Linux distros and the kernel build versions (2.0.34 or higher!) that support FAT32.


If your kernel version doesn't support Fat32 you will have to upgrade the kernel. I'm not too hot on kernel upgrades, so I'm not going to say too much on that. As ever RTFM!


Distributions with FAT32 support (kernel 2.0.34 or higher) Distribution:
        Earliest Version with FAT32 Support
Red Hat
        Version 5.1 (with kernel 2.0.34)

Red Hat
        Version 6.0 (with kernel 2.0.36)

SuSE
        Version 5.3 (with kernel 2.0.35)

SuSE
        Version 6.0 (with kernel 2.0.36)

Debian GNU/Linux
        Version 2.0 (with kernel 2.0.34)