特殊:Badtitle/NS100:DisklessUbuntuHowto:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第5行: | 第5行: | ||
== Why do it? == | == Why do it? == | ||
Imagine my case I admin about 25 public workstations for a local library, if they want something changed across the board I can either go sit at each PC and spend X minutes on it, adding up to who knows how many hours, ''or'' I can simply make the change at any one of the 25 systems and have it effect every system equally. The same goes for updates and many other operations. It really eases support issues. | Imagine my case I admin about 25 public workstations for a local library, if they want something changed across the board I can either go sit at each PC and spend X minutes on it, adding up to who knows how many hours, ''or'' I can simply make the change at any one of the 25 systems and have it effect every system equally. The same goes for updates and many other operations. It really eases support issues. | ||
== How is this different than ThinClientHowto? == | == How is this different than [[UbuntuHelp:ThinClientHowto|ThinClientHowto]]?? == | ||
Thin clients use some of the same principals but they also connect to a remote X session, which means everything runs on the remote server, all applications will consume the servers resources, such as RAM and CPU cycles. | Thin clients use some of the same principals but they also connect to a remote X session, which means everything runs on the remote server, all applications will consume the servers resources, such as RAM and CPU cycles. | ||
Diskless Booting simply uses the remote server for storage and still runs all applications on the local client station. This works better if you have full powered PC's to work with, and are working with a large number of clients that would require too much CPU and RAM to run all their applications on one server. | Diskless Booting simply uses the remote server for storage and still runs all applications on the local client station. This works better if you have full powered PC's to work with, and are working with a large number of clients that would require too much CPU and RAM to run all their applications on one server. | ||
第11行: | 第11行: | ||
Oliver Grawert says :- ''you could have achieved this easier by following the thin client howto, remove the ltsp-client package from the chroot and install ubuntu-desktop (or whatever desktop you want) there, would save you a lot of configuration work ;)'' | Oliver Grawert says :- ''you could have achieved this easier by following the thin client howto, remove the ltsp-client package from the chroot and install ubuntu-desktop (or whatever desktop you want) there, would save you a lot of configuration work ;)'' | ||
== How does it work? == | == How does it work? == | ||
There are a lot of parallels to ThinClientHowto, diskless booting requires a DHCP server which a bootable PXE network card will query to get its configuration and location of the file to tftp from the server, after booting the PXE image the client will tftp and boot the kernel image(with args specified in the pxe config), those args will tell the kernel how to configure itself, and the path to mount the NFS share where it's / directory is located. | There are a lot of parallels to [[UbuntuHelp:ThinClientHowto|ThinClientHowto]], diskless booting requires a DHCP server which a bootable PXE network card will query to get its configuration and location of the file to tftp from the server, after booting the PXE image the client will tftp and boot the kernel image(with args specified in the pxe config), those args will tell the kernel how to configure itself, and the path to mount the NFS share where it's / directory is located. | ||
== Requirements == | == Requirements == | ||
* An Ubuntu system with (preferably) nfs-kernel-server and tftpd server (the server) | * An Ubuntu system with (preferably) nfs-kernel-server and tftpd server (the server) |
2007年12月4日 (二) 10:24的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/DisklessUbuntuHowto }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/af | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Afrikaans| [[::DisklessUbuntuHowto/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ar | • {{#if: UbuntuHelp:DisklessUbuntuHowto|العربية| [[::DisklessUbuntuHowto/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/az | • {{#if: UbuntuHelp:DisklessUbuntuHowto|azərbaycanca| [[::DisklessUbuntuHowto/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/bcc | • {{#if: UbuntuHelp:DisklessUbuntuHowto|جهلسری بلوچی| [[::DisklessUbuntuHowto/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/bg | • {{#if: UbuntuHelp:DisklessUbuntuHowto|български| [[::DisklessUbuntuHowto/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/br | • {{#if: UbuntuHelp:DisklessUbuntuHowto|brezhoneg| [[::DisklessUbuntuHowto/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ca | • {{#if: UbuntuHelp:DisklessUbuntuHowto|català| [[::DisklessUbuntuHowto/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/cs | • {{#if: UbuntuHelp:DisklessUbuntuHowto|čeština| [[::DisklessUbuntuHowto/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/de | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Deutsch| [[::DisklessUbuntuHowto/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/el | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Ελληνικά| [[::DisklessUbuntuHowto/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/es | • {{#if: UbuntuHelp:DisklessUbuntuHowto|español| [[::DisklessUbuntuHowto/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/fa | • {{#if: UbuntuHelp:DisklessUbuntuHowto|فارسی| [[::DisklessUbuntuHowto/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/fi | • {{#if: UbuntuHelp:DisklessUbuntuHowto|suomi| [[::DisklessUbuntuHowto/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/fr | • {{#if: UbuntuHelp:DisklessUbuntuHowto|français| [[::DisklessUbuntuHowto/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/gu | • {{#if: UbuntuHelp:DisklessUbuntuHowto|ગુજરાતી| [[::DisklessUbuntuHowto/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/he | • {{#if: UbuntuHelp:DisklessUbuntuHowto|עברית| [[::DisklessUbuntuHowto/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/hu | • {{#if: UbuntuHelp:DisklessUbuntuHowto|magyar| [[::DisklessUbuntuHowto/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/id | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Bahasa Indonesia| [[::DisklessUbuntuHowto/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/it | • {{#if: UbuntuHelp:DisklessUbuntuHowto|italiano| [[::DisklessUbuntuHowto/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ja | • {{#if: UbuntuHelp:DisklessUbuntuHowto|日本語| [[::DisklessUbuntuHowto/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ko | • {{#if: UbuntuHelp:DisklessUbuntuHowto|한국어| [[::DisklessUbuntuHowto/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ksh | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Ripoarisch| [[::DisklessUbuntuHowto/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/mr | • {{#if: UbuntuHelp:DisklessUbuntuHowto|मराठी| [[::DisklessUbuntuHowto/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ms | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Bahasa Melayu| [[::DisklessUbuntuHowto/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/nl | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Nederlands| [[::DisklessUbuntuHowto/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/no | • {{#if: UbuntuHelp:DisklessUbuntuHowto|norsk| [[::DisklessUbuntuHowto/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/oc | • {{#if: UbuntuHelp:DisklessUbuntuHowto|occitan| [[::DisklessUbuntuHowto/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/pl | • {{#if: UbuntuHelp:DisklessUbuntuHowto|polski| [[::DisklessUbuntuHowto/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/pt | • {{#if: UbuntuHelp:DisklessUbuntuHowto|português| [[::DisklessUbuntuHowto/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ro | • {{#if: UbuntuHelp:DisklessUbuntuHowto|română| [[::DisklessUbuntuHowto/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/ru | • {{#if: UbuntuHelp:DisklessUbuntuHowto|русский| [[::DisklessUbuntuHowto/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/si | • {{#if: UbuntuHelp:DisklessUbuntuHowto|සිංහල| [[::DisklessUbuntuHowto/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/sq | • {{#if: UbuntuHelp:DisklessUbuntuHowto|shqip| [[::DisklessUbuntuHowto/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/sr | • {{#if: UbuntuHelp:DisklessUbuntuHowto|српски / srpski| [[::DisklessUbuntuHowto/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/sv | • {{#if: UbuntuHelp:DisklessUbuntuHowto|svenska| [[::DisklessUbuntuHowto/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/th | • {{#if: UbuntuHelp:DisklessUbuntuHowto|ไทย| [[::DisklessUbuntuHowto/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/tr | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Türkçe| [[::DisklessUbuntuHowto/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/vi | • {{#if: UbuntuHelp:DisklessUbuntuHowto|Tiếng Việt| [[::DisklessUbuntuHowto/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/yue | • {{#if: UbuntuHelp:DisklessUbuntuHowto|粵語| [[::DisklessUbuntuHowto/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/zh | • {{#if: UbuntuHelp:DisklessUbuntuHowto|中文| [[::DisklessUbuntuHowto/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/zh-hans | • {{#if: UbuntuHelp:DisklessUbuntuHowto|中文(简体)| [[::DisklessUbuntuHowto/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:DisklessUbuntuHowto | UbuntuHelp:DisklessUbuntuHowto | {{#if: | :}}DisklessUbuntuHowto}}/zh-hant | • {{#if: UbuntuHelp:DisklessUbuntuHowto|中文(繁體)| [[::DisklessUbuntuHowto/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:DisklessUbuntuHowto|:DisklessUbuntuHowto|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :DisklessUbuntuHowto/zh | | {{#ifexist: DisklessUbuntuHowto/zh | | {{#ifeq: {{#titleparts:DisklessUbuntuHowto|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:DisklessUbuntuHowto|1|-1|}} | zh | | }}
What is diskless booting?
Diskless booting is using a remote system or systems to store the kernel and the filesystem that will be used on other computer(s).
Why do it?
Imagine my case I admin about 25 public workstations for a local library, if they want something changed across the board I can either go sit at each PC and spend X minutes on it, adding up to who knows how many hours, or I can simply make the change at any one of the 25 systems and have it effect every system equally. The same goes for updates and many other operations. It really eases support issues.
How is this different than ThinClientHowto??
Thin clients use some of the same principals but they also connect to a remote X session, which means everything runs on the remote server, all applications will consume the servers resources, such as RAM and CPU cycles. Diskless Booting simply uses the remote server for storage and still runs all applications on the local client station. This works better if you have full powered PC's to work with, and are working with a large number of clients that would require too much CPU and RAM to run all their applications on one server. It is different enough to have multiple machines mounting the same / filesystem as opposed to simply being a remote monitor and keyboard to warrant a separate how-to I think. Oliver Grawert says :- you could have achieved this easier by following the thin client howto, remove the ltsp-client package from the chroot and install ubuntu-desktop (or whatever desktop you want) there, would save you a lot of configuration work ;)
How does it work?
There are a lot of parallels to ThinClientHowto, diskless booting requires a DHCP server which a bootable PXE network card will query to get its configuration and location of the file to tftp from the server, after booting the PXE image the client will tftp and boot the kernel image(with args specified in the pxe config), those args will tell the kernel how to configure itself, and the path to mount the NFS share where it's / directory is located.
Requirements
- An Ubuntu system with (preferably) nfs-kernel-server and tftpd server (the server)
- At least one PXE-bootable system (the client)
- It helps to have the client set up in its final configuration before you start
- Enough disk space on the server to hold the client filesystem
- A fast network connection between the client and the server
- A DHCP server which is capable of supporting PXE clients, or a separate network segment where you can run a dedicated DHCP server
- A good understanding of Linux
Getting Started
Set up your server
Install the following packages: dhcp3-server tftpd-hpa syslinux nfs-kernel-server initramfs-tools
sudo mkdir -p /tftpboot/pxelinux.cfg sudo mkdir /nfsroot sudo cp /usr/lib/syslinux/pxelinux.0 /tftpboot
- Configure your DHCP server to offer /tftpboot/pxelinux.0 as a boot file and assign (possibly) assign a static IP to the machine you want to boot with PXE (the client). Your dhcpd.conf might look like this assuming your subnet is 192.168.2.0
allow booting; allow bootp; subnet 192.168.2.0 netmask 255.255.255.0 { range 192.168.2.xxx 192.168.2.xxx; option broadcast-address 192.168.2.255; option routers 192.168.2.xxx; option domain-name-servers 192.168.2.xxx; filename "/pxelinux.0"; } # force the client to this ip for pxe. # This is only necessary assuming you want to send different images to different computers. host pxe_client { hardware ethernet xx:xx:xx:xx:xx:xx; fixed-address 192.168.2.xxx; }
NOTE: You will need to replace the 'xx:xx:xx:xx:xx:xx' and the '192.168.2.xxx' with your own values
- configure tftp-hpa
Before tftp will run, we need to configure it to run in daemon mode.
sudo vi /etc/default/tftp-hpa
Change
RUN_DAEMON="no"
to
RUN_DAEMON="yes"
and the second line to
OPTIONS="-l -s /tftpboot"
so it should look like this:
#Defaults for tftpd-hpa RUN_DAEMON="yes" OPTIONS="-l -s /tftpboot"
now, start the tftp-hpa service:
sudo /etc/init.d/tftp-hpa start
- create a new config file as /tftpboot/pxelinux.cfg/default
NOTE: There are more options available such as MAC or IP identification for multiple config files see syslinux/pxelinux documentation for help.
LABEL linux KERNEL vmlinuz-2.6.15-23-686 APPEND root=/dev/nfs initrd=initrd.img-2.6.15-23-686 nfsroot=192.168.2.2:/nfsroot ip=dhcp rw
NOTE: your nfs server IP address, kernel name, and initrd name will likely be different. If you have a preconfigured system the names should be the names of the kernel and initrd (see below) on the client system
- configure your /etc/exports to export your /nfsroot
/nfsroot 192.168.2.xxx(rw,no_root_squash,async)
The '192.168.2.xxx' should be replaced with either the client IP or hostname for single installations, or wildcards to match the set of servers you are using.
- sync your exports
exportfs -rv
Creating your NFS installation
There are a few ways you can go about this, debchroot, copying the install from your server, or the easiest is having a / fs with all the right configs, was to install [xk]ubuntu on the workstation from CD, after you've got your system installed and working on the network mount the /nfsroot and copy everything from your working system to it. Plus we get to verify the NFS is working First, we'll copy our current kernel into our home directory and make the initrd.img before we copy everything to the newly created nfs directory on the server.
- Find current kernel version and copy it to your home directory
Lets find which Linux kernel version we have and copy it in. Chances are you will see more than one listed because you're kernel has been upgraded, so just take the more recent version, in this case /boot/vmlinuz-2.6.20-16-generic
ls -ltr /boot/vmlinuz-* -rw-r--r-- 1 root root 1745100 2007-04-15 03:07 /boot/vmlinuz-2.6.20-15-generic -rw-r--r-- 1 root root 1746636 2007-06-07 15:58 /boot/vmlinuz-2.6.20-16-generic sudo cp /boot/vmlinuz-2.6.20-16-generic /home/user
- Create an initrd.img file
Some people prefer to append the kernel version to the end of the initrd.img file just to keep track of things. Since we just found which version our kernel is, run the command
mkinitramfs -o /home/user/initrd.img-2.6.20-16-generic
Now we're going to copy everything over to the nfs directory on the server:
mount -tnfs -onolock 192.168.1.2:/nfsroot /mnt cp -ax /. /mnt/. cp -ax /dev/. /mnt/dev/.
Note: Here is where you will need to copy your kernel and the initrd.img you made earlier from /nfsroot/home/user/ to /tftpboot/ on the server
- Change the BOOT flag to NFS in /nfsroot/etc/initramfs-tools/initramfs.conf
# # BOOT: [ local | nfs ] # # local - Boot off of local media (harddrive, USB stick). # # nfs - Boot using an NFS drive as the root of the drive. # BOOT=nfs
NOTE: You'll want to check resolv.conf and DO NOT allow the system to bring up eth0, it will already have been configured by the kernel and in use for your NFS filesystem, if you do not comment out 'auto eth0' from /etc/network/interfaces your system will try to reconfigure eth0 and sever your NFS connection and you'll lose your root FS. Note: For Ubuntu 7.04 (Feisty Fawn) it seems the /etc/network/interfaces needs a little tweak, in order *not* to have the NetworkManager fiddle with the interface since it's already configured (see also bug #111227 : "NFS-root support indirectly broken in Feisty") so, here's what your interfaces file should look like:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface, commented out for NFS root #auto eth0 #iface eth0 inet dhcp iface eth0 inet manual
- edit /nfsroot/etc/fstab to look something like this ('note no swap')
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/nfs / nfs defaults 1 1 none /tmp tmpfs defaults 0 0 none /var/run tmpfs defaults 0 0 none /var/lock tmpfs defaults 0 0 none /var/tmp tmpfs defaults 0 0 /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
note: if you have entries for other tmpfs that's fine to leave them in there
Setup your client
- Enter your BIOS settings and configure your system to boot from LAN
If you have options for different LAN boot methods choose PXE
Now What?
Reboot your client PC it should get it's net config from the DHCP server, download the pxelinux image, download and boot the kernel, mount your root fs and continue to boot just as if it were using its internal HD, only now you can yank that HD out and use it for something else, that machine doesn't need it any more :)
Adding a swap file
In case you do need or want to set up a swapfile, here's what I did to get one working:
sudo apt-get install dphys-swapfile
this package sets up a swap file at /var/swap that is 2x your current ram. however, it still doesn't setup the swapfile on its own, though it does try. to get the swap file working the rest of the way, do:
sudo losetup /dev/loop0 /var/swap sudo swapon /dev/loop0
then, run top and you will see you have a swap file. however, put in as much ram as you need for what you are going to run, and just look at your swap file as "in case of emergency", because it is not efficient as a ram or a regular swap file, but should keep something from crashing. I'm running mythtv on top of a full feisty desktop, and tried it with 256mb ram, and myth-frontend would crash when i would try to bring it up. with the swap file, it would launch, but would take a while. i added an additional 256mb to bring the total to 512mb and it runs flawless, and i add the swap file just in case. i just make a script for it to set up the swap file at boot.
Gotchas
- Remember to use -o nolock when first mounting your NFS or have portmapper running or you'll end up with a long (nearly 2 min) hang mounting the remote NFS.
- If you are going to have multiple systems share this root you need to make sure some directories like /var/run, /var/lock, /tmp and some others are mounted in tmpfs so different systems won't be conflicting into each other.
- You probably also want to mount /media in tmpfs space if you don't want every workstation having access to every other workstations storage media.
- Think of things in cron like slocate - do you really want 25 computers trying to updatedb at 4AM all on the same HD?
Credits
For the feisty interfaces fix and locating your current kernel: http://developer.novell.com/wiki/index.php/HOWTO:_Convert_Ubuntu_to_Diskless For the tftp-hpa config - dodox in the forums: http://ubuntuforums.org/showthread.php?t=236518