|
Exploring Linux Part 6
by Alan German
While
Windows won't even acknowledge the presence of a Linux
partition on a hard drive, Linux does not exhibit any
such mean-spiritedness. Linux is quite willing to report
the existence of Windows partitions and in fact, with the
right sequence of commands, will happily let you access
the files that they contain. This can be very handy on a
machine running in dual-boot mode where the same files
can be shared by both operating systems. For example,
since the Open Office suite of applications is
more-or-less compatible with Microsoft Office, we can
maintain one set of data files (Word documents, Excel
spreadsheets, etc.) on a Windows partition and access the
same files using Open Office in Linux or Microsoft Office
running under Windows.
We first need to find out what partitions Linux has at
its disposal. Let's fire up a Terminal window and type
the command: sudo fdisk -l. This will produce a
table something like the following:
Disk /dev/hda: 30.0 GB,
30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot
|
Start
|
End
|
Blocks
|
Id
|
System
|
face="Courier New" size="-1">/dev/hda1 *
1
|
765
|
6144831
|
b
|
W95 FAT32
|
/dev/hda2
|
1250
|
3648
|
19269967+
|
f
|
W95 Ext'd (LBA)
|
/dev/hda3
|
766
|
1249
|
3887730
|
83
|
Linux
|
/dev/hda5
|
1276
|
3648
|
19061091
|
b
|
W95 FAT32
|
/dev/hda6
| 1250
|
1275
|
208782
|
82
|
Linux swap / Solaris
|
It
should be obvious that hda indicates a hard disk
partition, hda1 being the Windows c: drive, while hda3 is
a 4 GB Linux partition, and hda6 is the Linux swap space.
It's also obvious to me (since this is my machine) that
hda5 is my Windows data drive.
It's this partition that we want to make accessible to
Linux which we do by mounting the volume. However, first
we must create a mount point which we do in the Terminal
window by issuing the command: sudo mkdir
/mnt/windows_data, As the command name suggests,
this makes a new sub-directory named windows_data
under the mnt directory in the Linux
file structure. Now we need to tell Linux about the
details of the data partition such as the format type
(FAT32 or NTFS). In my case, the partition is formatted
as FAT32, so the command to be entered into the Terminal
window is:
sudo mount /dev/hda5 /mnt/windows_data -t vfat -o
iocharset=utf8,umask=000
If your partition is NTFS, then the appropriate command
is of the form:
sudo mount /dev/hda5 /mnt/windows_data -t ntfs -o
nls=utf8,umask=0222
Note that we are specifying the particular device (in my
case /dev/hda5) that is to be mounted, giving it the name
of a pre-defined mount point (/mnt/windows_data), and
setting parameters appropriate to the disk format.
If we now run Nautilus, the Linux file manager (using the
menu sequence Places Computer), we will
find that we have an 18GB volume named /mnt/windows_data
available. And, if we run OpenOffice.org Writer, we will
find that we can load the file linux_06.doc
(this newsletter article on my machine) from this
partition, edit the file in Writer, and then save the
modified version back to the Windows data partition where
it will be available for subsequent processing in Word
next time we boot into Windows.
But, the mount command is rather long and complex to have
to issue every time we log on to Linux. And, knowing the
power of Linux, we can guess that there must be an easier
way. Actually, one way that will work right now, is to
open Terminal and press the up arrow, at which point the
mount command in all its glory appears as if by magic. Of
course, it does so because Linux maintains a command
history and we are merely selecting the last command used
from the buffer. The permanent fix is to edit the /etc/fstab
file and insert an entry for our Windows data partition.
So, in Terminal, let's enter: sudo gedit /etc/fstab
to produce the following listing in the editor's window:
# /etc/fstab:
static file system information.
#
#<file system>
|
<mount point>
|
<type>
|
<options>
|
<dump>
|
<pass>
|
proc
|
/proc
|
proc
|
defaults
|
0
|
0
|
/dev/hda3
|
/
|
ext3
|
defaults,errors=remount-ro
|
0
|
1
|
/dev/hda6
|
none
|
swap
|
sw
|
0
|
0
|
/dev/hdc
|
/media/cdrom0
|
udf,iso9660
|
user,noauto
|
0
|
0
|
And,
let's add the following new line to the end of this file
to specify a permanent entry for the Windows data
partition:
/dev/hda5
/mnt/windows_data
vfat iocharset=utf8,umask=000
0 0
Save the
file and reboot the computer. If you now check Places
Computer, you will now find that your Windows data
partition has been mounted automatically and is ready for
immediate use.
So, now we have the best of both worlds access to
our working office files from both Windows and
Linux. What more could you want?
Bottom Line:
Ubuntu 6.06 LTS (Open Source)
http://www.ubuntu.com/
Mounting Windows Partitions in Ubuntu
http://www.psychocats.net/ubuntu
Originally published: September, 2007
top of page
|
Archived Reviews
A-J
K-Q
R-Z
The opinions expressed in these reviews
do not necessarily represent the views of the
Ottawa PC Users' Group or its members.
|