Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

April 13, 2006

A NFS Story on Gentoo

Filed under: GNU/Linux, Gentoo — tabrez @ 9:09 am

I still carry the habit of storing all the large files in my Windows partitions from my bad old Windows days. That allows me to plug any kind of device into the computer and copy the files to/from it. Gnu/Linux supports all kinds of DVD writers and Pen drives too, but my friends sometimes carry such wierd devices(and mp3 players) that they can be connected only to a computer using the Windows operating system. Accessing files in the Windows OS from a GNU/Linux partition is a time consuming and inefficient process - I do it using the excellent tool called Explore2FS, but its not an ideal tool for copying large amounts of files and directories. So it suits me well: store the files on the Windows partitions and access them easily from both Windows and GNU/Linux(by using a simple mount command).

When I discovered that my old Debian Sarge installation was not detecting the USB port for some reason and that its DVD-ROM has also died upon me, my only way to transfer some files to it was through the LAN. The files were contained in an ISO file on a Windows NTFS partition on a different machine. Below is the description of what I had to do to make the ISO file contents available to my USB-less, DVD-less Debian system.

I use Gentoo as my primary operating system on my personal desktop. The first job for me was to mount the local Windows partition(hda7) that contained the needed ISO file in the Gentoo filesystem.

sh# mkdir /mnt/win_d
sh# mount /dev/hda7 /mnt/win_d
sh# ls /mnt/win_d/*.iso

The ISO file was visible. I tried to export the /mnt/win_d directory using NFS and then tried to mount the ISO file on the Debian system, but it didn’t work out that way for me. Not in a mood to loose too much time over it, I mounted the ISO file on my Gentoo System itself and then exported this mounted directory:

sh# mkdir /mnt/myiso
sh# mount -o loop /mnt/win_d/myiso.iso /mnt/myiso
sh# ls /mnt/myiso

All the files contained in the ISO file were visible. The next job is to install the NFS server and the related tools if they are already not available, and then export the /mnt/myiso directory using it.

sh# emerge nfs-utils

Put the following line /etc/exports:

/mnt/myiso 192.168.0.0/255.255.255.0(async, no_subtree_check, ro, no_squash_root)

I have specified a range of IP addresses to export the directory to all the machines within the subnet. Only one IP address or a different IP address range can also specified there. Note that there should be NO space between the IP address/IP address range and the opening paranthesis that follows it. To learn more about the different options and their meanings that can be specified in the line, head on to this.

Start the nfs and portmap daemons and add them to the default runlevel(so that they start automatically at the boot time).

sh# /etc/init.d/nfs start
sh# rc-update add nfs default
sh# /etc/init.d/portmap start
sh# rc-update add portmap default

If you ever make changes to the /etc/exportfs file, then export all your changes using:

sh# exportfs -ra
sh# /etc/init.d/nfs reload
sh# exportfs

The last command shows you all the directories that are currently exported.

Now go to the other machine(Debian in my case) and use a simple mount command to access the exported directory.

sh# mkdir /mnt/remote
sh# mount 192.168.0.7:/mnt/myiso /mnt/remote
sh# ls /mnt/remote

You should see all the files from the exported directory. The IP address above is of the host system(Gentoo in my case) which is running the nfs daemon. Now you can use the /mnt/remote directory as any other directory on the local gnu/linux system. If the exported directory were a linux partition or a Windows FAT partition, then the write options could also have been ebabled by using the “rw” option in the /etc/exportfs file in place of the “ro” option. The following line can be added to the /etc/fstab file to mount this directory automatically at the boot time:

192.168.0.7:/mnt/myiso /mnt/remote nfs ro 0 0

The IP address, as above, is of the host system. You may be interested in this: NFS in Gentoo


If you want to receive future posts by email, enter your email address here:

Related Posts:

  • Linux Bible 2007 Edition: Install/Run 10+ GNU/Linux Distributions(Ubuntu, Fedora, Gentoo etc)
  • Another system rescue story, using Ubuntu LiveCD
  • How to Speed up Booting Into GNOME - A Gentoo Wiki Tip
  • Java on Gentoo
  • Two Applications For Easy Management Of ‘USE’ Flags In Gentoo
  • Moving A GNU/Linux Installation To A Different Partition
  • C# & MonoDevelop (.NET) on Gentoo and Ubuntu

  • Readers who viewed this page, also viewed:


    No Comments »

    No comments yet.

    RSS feed for comments on this post. TrackBack URI

    Leave a comment

    Subscribe without commenting


    Copyright (c) 2006, 2007 Tabrez Iqbal.
    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


    Powered by WordPress
    This website is hosted by Dreamhost