Difference between revisions of "NFS image creation"

 
(3 intermediate revisions by the same user not shown)
Line 45: Line 45:
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
## Debian 7
 
debootstrap wheezy /nfs/qa
 
 
 
## Ubuntu 14.04
 
## Ubuntu 14.04
 
debootstrap trusty /nfs/qa
 
debootstrap trusty /nfs/qa
Line 73: Line 70:
  
  
=Clean the default DNS settings=
+
=Clean the default settings=
 +
 
 +
 
 +
==DNS cleanup==
  
When you use ''deboostrap'' the current DNS settings are set as "default".
+
When you use ''debootstrap'' the current DNS settings are set as "default".
  
 
You should clean that !!!
 
You should clean that !!!
Line 83: Line 83:
 
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/base
 
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/base
 
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/head
 
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/head
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/orginal
+
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/original
 
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/tail
 
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/tail
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 90: Line 90:
 
You don't need to clean the "/etc/resolv.conf" file, since that one will be re-generate on runtime.  
 
You don't need to clean the "/etc/resolv.conf" file, since that one will be re-generate on runtime.  
  
By keeping the current one you'll be able to get Internet connection when you'll be inside the NFS image as "chroot".
+
Even better! By keeping the current ''/etc/resolv.conf'' you'll be able to get Internet connection when you'll be inside the NFS image as "chroot".
 +
 
 +
 
 +
==Hostname cleanup==
 +
 
 +
By default your client will have the same hostname as the server due to the "debootstrap" installation. :(
 +
 
 +
You MUST clean that in order to retrieve the name from your DNS.
 +
 
 +
<syntaxhighlight lang="bash">
 +
echo "" >  /nfs/qa/etc/hostname
 +
</syntaxhighlight>
 +
 
 +
 
 +
 
 +
Regarding "hosts", you should only keep the loopback settings.
 +
 
 +
<syntaxhighlight lang="bash">
 +
vim /nfs/qa/etc/hosts
 +
</syntaxhighlight>
 +
 
 +
 
 +
It should look like this:
 +
 
 +
<syntaxhighlight lang="bash">
 +
127.0.0.1 localhost
 +
::1 localhost ip6-localhost ip6-loopback
 +
ff02::1 ip6-allnodes
 +
ff02::2 ip6-allrouters
 +
</syntaxhighlight>

Latest revision as of 16:49, 23 June 2015


This article explains how to initialize a new NFS image.


Requirements

NetBoot kernel

By now you should already know and have a NetBoot kernel.

!! Don't forget to backup the kernel's libraries and modules !!

>> See TFTP server manage netboot kernels


NFS image folder

You should create a folder to host the new NFS image, for instance QA:

mkdir -p /nfs/qa
chmod -R 777 /nfs/qa

This folder must be registered in NFS server configuration (/etc/exports).

>> See NFS server



Get a minimal Operating System

Go to your NFS image folder (it should be empty):

cd /nfs/qa


Thank to Deboostrap you can initialize a lot of *Nix versions!

You need to adjust the following command to the distribution you'd like to run:

## Ubuntu 14.04
debootstrap trusty /nfs/qa


!! This step is quite long... Depending on your network and CPU it can take up to 10 or 15 minutes !!


Copy kernel's libraries and modules

First thing to do is to copy your kernel's libraries and modules into your new NFS image.

cp -r /tftpboot/sources-images/trusty/lib/modules /nfs/qa/lib/
cp -r /tftpboot/sources-images/trusty/usr/src/ /nfs/qa/usr/src/


Where:

  • /tftpboot/sources-images/trusty is your TFTP kernel name
  • /nfs/qa/ is your new NFS image


Clean the default settings

DNS cleanup

When you use debootstrap the current DNS settings are set as "default".

You should clean that !!!


echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/base
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/head
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/original
echo "" > /nfs/qa/etc/resolvconf/resolv.conf.d/tail


You don't need to clean the "/etc/resolv.conf" file, since that one will be re-generate on runtime.

Even better! By keeping the current /etc/resolv.conf you'll be able to get Internet connection when you'll be inside the NFS image as "chroot".


Hostname cleanup

By default your client will have the same hostname as the server due to the "debootstrap" installation. :(

You MUST clean that in order to retrieve the name from your DNS.

echo "" >  /nfs/qa/etc/hostname


Regarding "hosts", you should only keep the loopback settings.

vim /nfs/qa/etc/hosts


It should look like this:

127.0.0.1	localhost
::1		localhost ip6-localhost ip6-loopback
ff02::1		ip6-allnodes
ff02::2		ip6-allrouters