Weblog Joey Dekker
This weekend I decided to put in place image capture and restore functionality in my network using all the pieces of hardware i already owned. Reason is that I do not like it when re-installing Windows I have to do updates etc nowadays you'll lose an entire day re-installing. For imaging I use ping. Alternatively I will see if I can add unattended in the pxe menu and rollout unattended install's of my OS's. Will blog about that later.
I will write down the steps I have taken to achieve my goal:
1.
Enable the Command Line Interface of your Synology (steps may vary with different DSM Versions)
2.
We need to logon the Synology using ssh or telnet (depens on which you have chosen in the previous step), you can download PuTTY for this task. Login as user "root" and give the password you have setup for the admin user.
3.
Next we need the ipkg package system, the package you need to download is dependent on the processor architecture your Synology is using. You can find out here (German warning). Switch to the ssh or telnet session you have opened in putty. and use the following commands to download and install the ipkg installer:
nas> wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/syno-i686-bootstrap_1.2-7_i686.xsh
nas> chmod +x ./syno-i686-bootstrap_1.2-7_i686.xsh
nas> ./syno-i686-bootstrap_1.2-7_i686.xsh
nas> rm -f syno-i686-bootstrap_1.2-7_i686.xsh
nas> ipkg update
4.
Now we are going to install the necessary tftp server on the Synology nas
nas> ipkg install tftp-hpa
5.
We need to configure the tftp server. First we make the necessary directories:
mkdir /opt/tftpboot
mkdir /opt/tftpboot/pxelinux.cfg (yes this is a directory including a .)
Then we need to check if /opt/etc/xinetd.conf contains the right information you can use the command:
nas> more /opt/etc/xinetd.conf
defaults
{
only_from = localhost 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
instances = 60
log_type = SYSLOG authpriv info
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
You can change the only_from range to tighten security.
If it exists /opt/etc/xinetd.d/tftp check for the following contents:
service tftp
{
flags = REUSE
socket_type = dgram
protocol = udp
instances = 30
wait = yes
user = root
server = /opt/sbin/in.tftpd
server_args = -s /opt/tftpboot
cps = 100 2
log_on_success = HOST PID
log_on_failure = HOST
disable = no
}
6.
Pxe is a small bootloader which is used as secondary bootloader for network boots. You have to place the pxe executable in "/opt/tftpboot". In this case we are configuring ping. You need to download the iso to your PC, extract it and then place it on the nas in one of the shared folders. After you have unpacked the iso and placed it on the nas you can reach it from the commandline. In my case I had to change directory to /volume1/Data/PING-3.01/ You need to move the following 3 files to /opt/tftpboot:
kernel
initrd.gz
pxelinux.0
You can use the cp command to copy the files to the new location:
cp kernel /opt/tftpboot
cp initrd.gz /opt/tftpboot
cp pxelinux.0 /opt/tftpboot
Now you need to create a new file named default in /opt/tftpboot/pxelinux.cfg/default
If you are familiar with vi you can use:
vi /opt/tftpboot/pxelinux.cfg/default
Otherwise it might be wise to first install nano using ipkg: "ipkg install nano" en then use:
nano /opt/tftpboot/pxelinux.cfg/default
copy in the following contents:
DEFAULT rescue
PROMPT 0
LABEL rescue
KERNEL kernel
APPEND vga=normal devfs=nomount pxe ramdisk_size=33000 load_ramdisk=1 init=/linuxrc prompt_ramdisk=0 initrd=initrd.gz root=/dev/ram0 rw noacpi noapm pci=noacpi lba acpi=off apm=off
and save the default file.
That is it for the pxe part.
7.
Now you have to prepare a folder with the partimage structure on the nas.
You can create a newly shared folder with our without password restrictions or use a subdirectory of an existing shared folder.
In my case I used the existing Data share and put in a new folder named LaptopBackup.
You need to download the following zipfile PartImage extract the PartImage folder and its subdirectory's and place it on the newly created shared folder or subdirectory of an existing share on your nas.
8.
One final thing needs to be configured. You need to setup your dhcp server to point to the pxelinux.0 boot file otherwise your computer will not know where to boot from the network. In my case I use a dd-wrt box as my router/ firewall / dhcp server.
Login to your dd-wrt box en in the menu open up the Services. in the submenu open Services again. Do not touch the dhcp options in this screen only alter the DNSMasq option. Fill in:
dhcp-boot=pxelinux.0,nameofyournas,ipofyounas
As an example:

If you are using anything else as your dhcp server you have to consult your manual on how to add the dhcp option. As an alternative you can configure your Synology as a DHCP server
9.
Now you can follow the ping documentation on how to make and restore an image. I have succesfully created an image of all my partitions. I will test the restore functionality asap and report back.
Jun 14th, 2011 @ 8:56 am CEST
Following the Ping documentation I was able to succesfully restore a created image
Write a comment
* = required field