Backup of the porta-switch installation using the G4L cloning tool

Emin Gabrielyan

2010-08-29

 

The MR21 porta-switch system requires 4 servers (configurator, master, slave, and sip). After the installation from the DVD, a post-install procedure must be carried out remotely by the support staff of porta-one. The system becomes operational only after such a remote configuration by porta-one. This document presents a procedure of saving/restoring disk to/from a compressed image files.

 

Table of Contents:

Backup of the porta-switch installation using the G4L cloning tool 1

1........ Booting with porta-switch CD into the rescue mode.. 2

2........ How to zero the unused space of the partition. 3

3........ Zeroing the free space of partitions of the porta-switch installation. 4

4........ Zero the space occupied by the swap partition. 5

5........ Installing an FTP server with Fedora 13 live CD.. 5

6........ Configuring the network when booted from G4L Live-CD.. 6

7........ Uploading the hard disk image to the FTP server 7

8........ Restoring the disk using G4L image.. 7

9........ Configuring the network after restoring the G4L image on a different machine   8

10...... Files. 8

11...... References. 9

 

 

Currently, a test system is installed and configured successfully on 4 following machines (on 2010-08-20 20:52).

 

·         billing1.switzernet.com represents the configurator

·         billing2.switzernet.com represents the portabilling master

·         billing3.switzernet.com represents the portabilling slave

·         billing2.switzernet.com represents the portasip

 

As the installation package alone is not sufficient to setup a working system, it became important to backup the system after the remote setup is over. The G4L cloning tool was suggested by the porta-one staff.

 

The G4L saves the entire image of the hard disk and can compress with Bzip2 algorithm. As the freshly installed porta-switch system occupies only a 5GB space and the disks used are of 500GB, it became highly efficient to zero the free space on the disk before creating its image. The following sections of this document explain this procedure. First, according to the section 1, you must boot from the porta-switch install CD and enter into the rescue mode [1]. In the rescue mode you can access the 5 partitions of the porta-switch installation. Section 3 shows how to fill the free space of each of these partitions by zeroes [3]. As described in section 4, you also need to fill with zeroes the swap space [4]. After zeroing the unused space of the disk, the hard drive is now optimized for the backup with the G4L cloning tool. Section 5 shows how to setup an FTP server on any PC by booting from a Live CD [5]. Section 6 shows how to configure the network when booting from the G4L CD and the section 7 shows how to backup the disk image to the FTP server [6], [7]. Section 10 contains links to the compressed disk images. Their sizes are of about 2GB only [10].

 

When the backups are made, you can follow the instructions of the section 8 to restore the image on a new or the same computer [8]. Section 9 shows that a reconfiguration of the network settings in the restored system could be required after re-imaging onto a new computer [9].

 

Note that all printouts provided in this document are based on handwritten notes and may contain misspellings.

 

To understand the notes better, note that in our examples, the installation, cloning, and restoration are carried out on servers connected to the subnet 212.147.8.104/29, with a gateway 212.147.8.105 and a DNS 192.168.1.2, where the IP addresses were assigned as follows:

 

·         212.147.8.105: the default gateway

·         212.147.8.106: billing1.switzernet.com (configurator)

·         212.147.8.107: the FTP server (Fedora 13 Live CD with an USB disk)

·         212.147.8.108: billing2.switzernet.com (master)

·         212.147.8.109: billing3.switzernet.com (slave)

·         212.147.8.110: billing4.switzernet.com (SIP)

·         212.147.8.106: the broadcast address

 

Section 10 contains the links to the images files of G4L backups and of the installation ISO files [10].

 

1.   Booting with porta-switch CD into the rescue mode

 

Boot from the porta-switch DVD. The ISO file of the image is available on the web:

http://unappel.ch/2/company/100811-portabilling-mr21-iso/

 

At the boot prompt, specify the rescue mode:

 

boot: linix rescue

 

Follow the indications below:

 

Language: English

Keyboard: fr_CH

Network: yes

Configure eth0: yes

Enable IPv4: yes

Manual address: yes

IP Address: 212.147.8.106

Netmask: 255.255.255.248

Gateway: 212.147.8.105

Primary DNS: 192.168.1.2

Secondary DNS: 208.67.222.222

 

The pinging the server from the outside will become possible.

 

You will see the following message:

 

The rescue environment will now … mount [your Linux installation] under the directory /mnt/sysimage

 

Select continue:

 

Continue: yes

Read-only:

Skip:

 

Answer to the next question as follows:

 

What partition holds the root?

/dev/VolGroup01/LogVol00

/dev/VolGroup01/LogVol01 [yes]

 

At last, you will get the bash prompt:

 

sh-3.2#

 

 

2.   How to zero the unused space of the partition

 

After booting into rescue mode, check the free space:

 

sh-3.2# df | egrep "(boot|Use)"

          1K-blocks   Used  Available  Use%  Mounted on

/dev/sda1    101086  12457      83410   13%  /mnt/sysimage/boot

 

Change the folder:

 

sh-3.2# /mnt/sysimage/boot

sh-3.2# pwd

/mnt/sysimage/boot

 

Copy continuous zeroes in a file located in the selected partition, until the device is full.

 

sh-3.2# dd if=/dev/zero of=zerofile.0

dd: writing to `zerofile.0' : No space left on device

176413+0 records in

176412+0 records out

90322944 bytes (90 MB) copied, 1.53161 seconds, 59.0 MB/s

 

Check the space again, to see that no space left on the partition:

 

sh-3.2# df | grep boot

/dev/sda1 101086 101011 0 100% /mnt/sysimage/boot

 

Remove the file filled with zeroes:

 

sh-3.2# rm zerofile.0

 

And check the space again. The original usage will be restored:

 

sh-3.2# df | grep boot

/dev/sda1 101086 12457 83410 13% /mnt/sysimage/boot

 

 

3.   Zeroing the free space of partitions of the porta-switch installation

 

Boot with the porta-switch CD into the rescue mode. Five partitions of the porta-switch installation will be mounted at /mnt/sysimage,  /mnt/sysimage/update_root, /mnt/sysimage/porta_var, /mnt/sysimage/boot, and /mnt/sysimage/dev. The previous section showed the details on the example of one partition (see section 3).

 

Follow the procedure below to zero the empty space of each of the concerned 5 partitions of the porta-switch installation.

 

sh-3.2# pwd

/mnt/sysimage

sh-3.2# df | grep sysimage$

  20’642’428  2’316’040  17’277’812  12% /mnt/sysimage/

sh-3.2# dd if=/dev/zero of=zerofile.0

dd: writing to `zerofile.0’: No space left on device

36599025+0 records in

36599024+0 records out

18738700288 bytes (19GB) copied, 194.335 seconds, 96.4 MB/s

sh-3.2# df | grep sysimage$

  20’642’428  20’633’452  0  100% /mnt/sysimage/

sh-3.2#

sh-3.2# df | grep sysimage/update_root

  20’314’748  2’257’748  17’0080424  12%  /mnt/sysimage/update_root

sh-3.2# dd if=/dev/zero of=update_root/zerofile.0

dd: writing to `update_root/zerofile.0’: No space left on device

…

…

… (18GB) copied, 194.086 seconds, 95.1 MB/s

sh-3.2# df | grep sysimage/update_root

  20’314’748  20’301’356  0  100%  /mnt/sysimage/update_root

sh-3.2#

sh-3.2# df | grep sysimage/porta_var

  409’244’584  2’403’904  385’716’792  1%  /mnt/sysimage/porta_var

sh-3.2# dd if=/dev/zero of=porta_var/zerofile.0

dd: writing to `porta_var/zerofile.0’: No space left on device

…

…

416’119’267’328 bytes (416GB) copied, 5347.35 seconds 77.8 MB/s

sh-3.2# df | grep sysimage/porta_var

  409’244’584  409’167’616  0  100%  /mnt/sysimage/porta_var

sh-3.2#

sh-3.2# dd if=/dev/zero of=dev/zerofile.0

…

…

… (981MB) copied …

sh-3.2# df | grep sysimage

… 0 100% /mnt/sysimage

… 0 100% /mnt/sysimage/update_root

… 0 100% /mnt/sysimage/porta_var

… 0 100% /mnt/sysimage/boot

… 0 100% /mnt/sysimage/dev

sh-3.2#

sh-3.2# rm */zerofile.0

sh-3.2# rm zerofile.0

sh-3.2#

 

 

4.   Zero the space occupied by the swap partition

 

Boot from the porta-switch CD in rescue mode, or from the Fedora live CD. Find out the partition reserved for the swap.

# cat /proc/swaps

 

Stop the swapping:

# swapoff /dev/mapper/VolGroup01-LogVol03

 

Fill with zeroes the swap partition (this will take time):

# dd if=/dev/zero of=/dev/mapper/VolGroup01-LogVol03

 

Create the swap space and activate it:

# mkswap /dev/mapper/VolGroup01-LogVol03

# swapon /dev/mapper/VolGroup01-LogVol03

 

5.   Installing an FTP server with Fedora 13 live CD

 

Download and burn on a CD the Fedora Live CD image [iso] (657MB). Boot from this Live CD. The system on the hard drive of the computer will not be affected. For a storage space, use a USB hard disk formatted by default in NTFS.  The Linux will recognize this file system.

 

When booted, open a terminal from the desktop menu [Applicatins] [System Tools] [Terminal] and configure the network as follows:

 

$ su

# ifconfig eth0 down

# ifconfig eth0 212.147.8.107 netmask 255.255.255.248

# route add default gw 212.147.8.105

# echo nameserver 192.168.1.2 >> /etc/resolv.conf

# echo nameserver 208.67.220.220 >> /etc/resolv.conf

# echo nameserver 208.67.222.222 >> /etc/resolv.conf

# ping google.com

 

For disabling the firewall on FTP, use the firewall configuration panel:

 

# system-config-firewall

 

Install pure-ftpd and add a user with its root directory on the USB drive:

 

# yum install pure-ftpd

# vi /etc/pure-ftpd/pure-ftpd.conf #uncomment PureDB

PureDB /etc/pure-ftpd/pureftpd.pdb

# /etc/init.d/pure-ftpd start

# pure-pw useradd toto -u liveuser -d /media/Elements/ftproot/ -m

Password:

Enter it again:

#

 

Alternatively you can install an FTP server on your windows machine using native IIS services of Windows XP:

 

·         Install IIS [go]

·         Configure users [go]

·         Configure permissions [go]

·         Links [txt]

 

6.   Configuring the network when booted from G4L Live-CD

 

You can now boot the porta-switch installation with the G4L live CD and upload its hard drive image on the FTP server.

 

Download and burn the ISO of the G4L live-CD [iso] (98.7 MB)

 

Accessing other consoles when booted from G4L live-CD

Alt-F2

Login: g4l

Password:

(Empty)

 

Configure the network from another console, or before launching g4l.

 

# ifconfig eth0 down

# ifconfig eth0 212.147.8.110 netmask 255.255.255.248

# route add default gw 212.147.8.105

# echo nameserver 192.168.1.2 >> /etc/resolv.conf

# echo nameserver 208.67.220.220 >> /etc/resolv.conf

# echo nameserver 208.67.222.222 >> /etc/resolv.conf

# ping google.com

 

Your server will now reply to pings from the outside.

 

7.   Uploading the hard disk image to the FTP server

 

At the boot, select the default built:

bz34.1 386 build 2.6.34.1 Released 07-05-2010

Accept the conditions: <yes>

 

Proceed until the bash prompt and configure the network (as described in section 6):

-bash-3.2#

 

Launch G4L:

-bash-3.2# g4l

 

Choose: the raw mode

[*] RAW Mode: ANY file system, every bit, local+ftp+cifs(smb)+sshfs+nfs

[ ] File Mode: Some filesystems only, only files, local+special server

 

Choose the network use:

Network use; backup/restore to/from network (FTP, UDPCAST)

 

The IP Address must be already ok (e.g. 212.147.8.110), as the network was configured before launching G4L. Configure the FTP: FTP server IP (212.203.66.71). Choose the compression method Bzip2. Enter the login and password for the FTP server. Set the path to Image directory: Default directory (htdocs/2/company/100822-g4l-pb/). Choose the Backup to FTP server. Provide a name to the image file on the server.

 

Choose backup to FTP. You will be asked to select a partition, or the entire disk. Choose Disk, and proceed with backup.

[*] sda  488'386'584 DISK

[ ] sda1     104'391 Linux

[ ] sda2 488'279'610 LinuxLVM

[log]

 

8.   Restoring the disk using G4L image

 

Boot from the G4L live CD. Enter into bash and configure the network:

# ifconfig eth0 212.147.8.110 netmask 255.255.255.248

# route add default gw 212.147.8.105

# echo nameserver 192.168.1.2 >> /etc/resolv.conf

# echo nameserver 208.67.220.220 >> /etc/resolv.conf

# echo nameserver 208.67.222.222 >> /etc/resolv.conf

# ping google.com

 

Select restore in RAW mode from the FTP server. Provide the FTP access info and the name of the file on the server containing the disk image.

 

In our case restoring process went beyond 100% but we ignored such a behavior and waited until the completion. The restoring process takes about 2 hours. Upon completion, remove the G4L CD and boot from the hard drive.

 

9.   Configuring the network after restoring the G4L image on a different machine

 

You may need to edit the network interface settings, if the destination computer is not the same as the source.

 

Wait until the system boots and login as root. Edit the ifcfg-eth0 network interface configuration file:

 

# cd /etc/sysconfig/network-scripts/

# vi ifcfg-eth0

:r ifcfg-eth0.bak

 

Keep all parameters as in the previous file (ifcfg-eth0.bak) except the hardware specific information, such as HWADDR parameter representing the MAC address and the first commented line showing the manufacturer and the type of the hardware. Reboot again from the hard disk.

 

10.                     Files

 

Below are the ISO files of the live CD images:

 

·         Fedora-13-i686-Live.iso [iso] (675MB)

·         g4l-v0.34.iso [iso] (98.7MB)

·         MD5 file [txt]

·         PortaSwitch-MR21.0-asm-12-20100809.iso [iso]

 

MD5 checksums:

$ ls -l | cut -d\  -f5-100

707788800 Aug 24 17:33 Fedora-13-i686-Live.iso

103495680 Aug 22 19:37 g4l-v0.34.iso

 

$ md5sum *

c550804ef156a2c1b36b915bcf9f69b6 *Fedora-13-i686-Live.iso

bf6b1b2269c67e1e129b5c59ee235b59 *g4l-v0.34.iso

 

Below are the G4L images of the computers of the porta-switch installation:

 

·         G4L of a 500G disk of the configurator at 212.147.8.106 / billing1.switzernet.com [bzip2]

·         G4L of a 500G disk of the master at 212.147.8.108 / billing2.switzernet.com [bzip2]

·         G4L of a 500G disk of the slave at 212.147.8.109 / billing3.switzernet.com [bzip2]

·         G4L of a 500G disk of the SIP at 212.147.8.110 / billing4.switzernet.com [bzip2]

·         MD5 file [txt]

 

MD5 checksums:

-rwxrwxrwx. 1 liveuser liveuser 1221619199 Aug 24 19:01 100824,1804,billing4.bzip2

-rwxrwxrwx. 1 liveuser liveuser 2801477424 Aug 25 06:42 100824,2157,billing1.bzip2

-rwxrwxrwx. 1 liveuser liveuser 1929253632 Aug 28 13:53 100828,1114,billing3.bzip2

-rwxrwxrwx. 1 liveuser liveuser 2080031693 Aug 30 18:37 100830,1200,billing2.bzip2

-rwxrwxrwx. 1 liveuser liveuser 1866263742 Aug 30 15:09 100830,1235,billing3.bzip2

 

bafac431e42541c41a601b9560346750  100824,1804,billing4.bzip2

8a0336b68b9be370f9f8eaf292e98df1  100824,2157,billing1.bzip2

610ef5d2662225a5af2ccbac5187ee4f  100828,1114,billing3.bzip2

cc1bfd62e87f76788452bb174522c4d8  100830,1200,billing2.bzip2

b0ee04189e788f7cb3ed1491dc670dc1  100830,1235,billing3.bzip2

 

11.                     References

 

Backup of the porta-switch installation using the G4L cloning tool [this document]

http://unappel.ch/2/company/100822-g4l-pb/

 

The public version without the access to images [this document]:

http://www.unappel.ch/2/public/100822-g4l-pb/

http://switzernet.com/2/public/100822-g4l-pb/

 

Fedora 13 Live CD:

http://fedoraproject.org/get-fedora

 

G4L cloning tool:

http://sourceforge.net/projects/g4l/

 

Installation disk of MR21:

http://unappel.ch/2/company/100811-portabilling-mr21-iso/

 

G4L images of MR21 installation:

http://unappel.ch/2/company/100822-g4l-pb/

 

Static routing for the 212.147.8.104/29 subnet:

http://switzernet.com/public/090717-vtx-pse-lan/

http://switzernet.com/2/public/100730-vtx-pse-lan/

 

 

 

*   *   *

Copyright © 2010 by Switzernet