Contributions Thread

Installation issues, feature requests, help, etc.

Moderators: Curtis8, A_Null

User avatar
Curtis8
Site Janitor
Posts: 985
Joined: Thu Mar 01, 2007 3:22 pm
Location: Canada
Contact:

Contributions Thread

Postby Curtis8 » Fri Mar 23, 2007 4:01 pm

The object of this thread is to allow people to help the PING project by offering something more than money, and that is knowledge. Any code that you can make that makes the PING project even better should be posted here, and Natan will test and review the code then add it to the next PING release.
This should help get you started:

Code: Select all

- After the kernel has booted, type 'x' and [enter] to get a shell;
- Log in as root (no password);

at that point I would copy the current script to your network share:

Code: Select all

- dhcpcd (to get an IP)
- mount.smbfs //192.168.0.101/PartImage /mnt/smbfs -o username=xxx (xxx should be domain\\user or user)
- df (to check the network share mounting)
- mkdir /mnt/smbfs/TEST
- cp /etc/rc.d/rc.ping /mnt/smbfs/TEST
- umount /mnt/smbfs


To test do the same as above, but copy the rc.ping file back

Code: Select all

- cp /mnt/smbfs/TEST/rc.ping /etc/rc.d


Then run the script to see if your changes worked or not:

Code: Select all

- /etc/rc.d/rc.ping


If everything works well after a few different tests (backup AND restore) post the changed code here.

Thank you for all your help making PING the world's best hard drive imaging utility.

On a side note, if anyone wishes to play with the partimage code, there are some changes that need to be done to make it work better with PING. Please talk to Natan about those.
Curtis

If you can read this, help me by going to the following link (can only go once per day)
http://s13.bitefight.org/c.php?uid=32058

Thank you

Codd
Posts: 7
Joined: Sun Mar 18, 2007 2:14 pm
Location: Canada

Contributions Thread

Postby Codd » Tue Apr 03, 2007 3:14 pm

Slightly tested code to make cciss devices work with PING

Remember SLIGHTLY tested.

It does backup and restore, but has not been tested in all situations.

This is a diff file to convert the last available version of rc.ping to one that supports cciss devices

Code: Select all

--- rc.ping   2007-03-22 20:14:39.000000000 -0300
+++ rc.ping.smbfs   2007-03-25 14:09:31.000000000 -0300
@@ -199,18 +199,35 @@
 LOG("* Exploring local disk drives\n");
 
 my @Dev = ();
-foreach my $d ('hda', 'hdb', 'sda', 'sdb',
-          'hdc', 'hdd', 'sdc', 'sdd',)
+
+# Initialize array for all possible disk devices
+my @AllDevices = ();
+
+# Push the standard linux hard disk device names into the AllDevices array
+foreach my $stdlinuxdevices ('hda', 'hdb', 'sda', 'sdb', 'hdc', 'hdd', 'sdc', 'sdd')
 {
-    LOG("  - Checking [/dev/$d]...\n");
-    my $out = `echo |fdisk /dev/$d 2>&1`;
+        push (@AllDevices, $stdlinuxdevices);
+}
+       
+# Generate all possible cciss hard disk device names and push them into AllDevices
+for (my $i = 0; $i <= 7; $i++) {
+   for (my $j = 0; $j <= 15; $j++) {
+      push (@AllDevices, "cciss/c".$i."d".$j);
+   }
+}
+                         
+# Loop through AllDevices testing for a valid device                         
+foreach (@AllDevices)
+{
+    LOG("  - Checking [/dev/$_]...\n");
+    my $out = `echo |fdisk /dev/$_ 2>&1`;
     $out =~s/^\s*//;
     $out =~s/\s*$//;
     LOG("    [$out]\n");
     # Either not a partition at all, either is a CDRom = bad cases
     if($out !~/^unable to open/i && $out !~/you will not be able to write/i)
     {
-   push(@Dev, $d);
+   push(@Dev, $_);
     }
 }
 foreach(@Dev)
@@ -468,7 +485,7 @@
    LOG("* Unmounting /mnt/smbfs\n");
    system("umount /mnt/smbfs >/dev/null 2>&1");
    LOG("* Trying to mount //$P{Server}/$P{Share}\n");
-   system("smbmount //$P{Server}/$P{Share} /mnt/smbfs -o"
+   system("smbmount  //$P{Server}/$P{Share} /mnt/smbfs -o"
           ." username=$P{User},password=\"$P{Passwd}\" >/tmp/out 2>&1");
 
    my $out = "";
@@ -1303,6 +1320,12 @@
    }
    LOG("* Creating dir [$SRC/$New_Image]\n");
    mkdir("$SRC/$New_Image", 0755);
+   # Additions for cciss compatability
+   # If the device is cciss, create a cciss subdirectory
+   if ($Dev=~ m/cciss/) {
+   mkdir("$SRC/$New_Image/cciss", 0755);
+   }
+        # End additions for cciss compatability
    LOG("* Backuping bios\n");
    system("cmospwd -w $SRC/$New_Image/bios");
    LOG("* Backuping first sectors of $Dev\n");
@@ -1316,10 +1339,19 @@
    {
        if(m/^\/dev\/$Dev/i && ! m/Extended/i)
        {
-      my $tmp = (split(/\//, $_))[2];
-      $tmp = (split(/ /, $tmp))[0];
-      $tmp =~s/\s//g;
-      push(@P, $tmp);
+      # This section modified to parse the output of fdisk -l using the string /dev/
+      # to ensure the proper detection of cciss devices
+      #      my $tmp = (split(/\//, $_))[2];
+                #      $tmp = (split(/ /, $tmp))[0];
+                #      $tmp =~s/\s//g;
+      if ($_ =~ m/\/dev\//) {
+      $_ =~ m/\/dev\/(.*?) /;
+      my $tmp=$1;
+                $tmp =~s/\/dev\///g;
+                $tmp =~s/\s//g;
+                push(@P, $tmp);
+      }
+      # End section modifications
        }
    }
    close(DB);
@@ -1648,7 +1680,19 @@
                 next;
             }
         } else {
+        # Added for cciss compatabililty
+            if ($F =~ m/cciss/) {
+      opendir(DIR, "$SRC/$Entity/$F");
+         my @FilesInCCISS = grep { !/^\./ } readdir(DIR);
+      closedir(DIR);
+      foreach(@FilesInCCISS)
+                {
+               push(@FF, "$SRC/$Entity/$F/$_");
+                }
+               } else {                                                   
             push(@FF, "$SRC/$Entity/$F");
+            }
+        # End additions for cciss compatability
         }
     }
     LOG("  * After:\n");
@@ -1656,7 +1700,7 @@
     {
         LOG("    * [$_]\n");
     }
-
+   
     # Several possible scenarii to tackle.
     #
     my $Action = "Ghost";
@@ -1670,7 +1714,6 @@
             last;
         }
     }
-
     if($Action eq "Ghost")
     {
         LOG("* Classical Ghost-like image!\n");
@@ -1686,7 +1729,15 @@
    {
             my @fields = split(/\//, $FF);
             my $F = $fields[-1];
-            if($F =~/^.da$/)
+       # Section added for cciss compatability
+            if ($fields[-2]=~ m/cciss/) {
+              $F = $fields[-2]."/".$fields[-1];
+              chomp($F);
+            }
+       # End section add for cciss compatability
+                                                                       
+       # Search for both standard linux devices and cciss devices to restore
+            if($F =~/^.da$/ || $F=~/^cciss\/c\d{1}d\d{1,2}$/ )
        {
                 LOG("  * Restore /dev/$F\n");
                 my $cmd = "dd if=$FF of=/dev/$F";
@@ -1786,6 +1837,12 @@
         {
             my @fields = split(/\//, $FF);
             my $F = $fields[-1];
+            # Added for cciss compatability
+       if ($fields[-2]=~ m/cciss/) {
+         $F = $fields[-2]."/".$fields[-1];
+         chomp($F);
+       }
+       # End addition for cciss compatability
             my $Node = $F;
 
             unless($F =~/\.000$/ || $F =~/\.zip$/i)
@@ -2016,4 +2073,3 @@
 C:\Partimage\T1>perl -e "print 660600000 * 6"
 3963600000
 C:\Partimage\T1>perl -e "print 660600000 * 7"
-4624200000


Good luck!

Codd[/b]

arckane
Posts: 12
Joined: Tue Mar 20, 2007 1:07 pm
Location: UK
Contact:

Postby arckane » Tue Apr 03, 2007 8:24 pm

Curtis

Is there anywhere that it's all unpacked already? It saves me installing VMWare Server on my Gentoo box :)

User avatar
Natan
Site Admin
Posts: 1722
Joined: Sun Nov 20, 2005 12:29 am

Postby Natan » Thu Apr 05, 2007 8:58 am

Hi people,
thank you for being here and feeding this topic. I'm back after a weed away, and am currently working at the update.

The tools being used to update the image should probably be shared. I for myself use a Fedora running on a VM. Its aim is not only to update the content of the initrd iso, but as well to compile sources -- and add the binaries to the iso. The problem is that the linux itself needs to be updated, so to be able to compile everything, and it's quite big. Maybe the best choice is to keep centralizing the compile task (since it's not very interesting nor very smart a task), and share the works on the rc.ping file itself, as we're currently doing.

What is your opinion ?

Regards,
Natan

arckane
Posts: 12
Joined: Tue Mar 20, 2007 1:07 pm
Location: UK
Contact:

Postby arckane » Thu Apr 05, 2007 11:19 am

If everything is done via rc.ping then that works for me. All I need is a working environment.

I'm a gentoo user with a customised kernel so I will definitely need to run the same as you in VMware to get an identical environment.

User avatar
Natan
Site Admin
Posts: 1722
Joined: Sun Nov 20, 2005 12:29 am

Postby Natan » Thu Apr 05, 2007 11:46 am

Well, on my VM, I use the PING kernel... :)

arckane
Posts: 12
Joined: Tue Mar 20, 2007 1:07 pm
Location: UK
Contact:

Postby arckane » Thu Apr 05, 2007 12:29 pm

May I make one ickle suggestion:

Modular!

At the moment everything is stored in rc.ping. I would recommend using this as a menu structure, example:

rc.ping kicks off the start of the script, calls network.pl/.sh
Once network.pl/.sh completes rc.ping calls servertype.pl/.sh
servertype.pl/.sh = Samba, CIFS, NFS, FTP, etc and asks for questions regarding source/destination server
rc.ping then calls....

You get the idea (I hope). I only recommend this now as I can see PING becoming quite big as more people help out and I don't want to break the whole thing, it's better to break it in sections and rewriting all of PING later will be a pain in the rear.

User avatar
Natan
Site Admin
Posts: 1722
Joined: Sun Nov 20, 2005 12:29 am

Postby Natan » Thu Apr 05, 2007 12:41 pm

Hi Arckane,
I would not split too much, because this would lead to code repetitions. But I'd like to add a OO architecture, instead of having ugly global vars. There will be a need for some rewriting, I think.

User avatar
Natan
Site Admin
Posts: 1722
Joined: Sun Nov 20, 2005 12:29 am

Postby Natan » Thu Apr 05, 2007 1:38 pm

Hi Codd,
I've just implemented your changes, making very small changes on them. Please, find here the whole rc.ping (look for 'smartarray' to find the paragraphs). Thanks for checking this is good to you.

Then I'll update the initrd and iso files, too:
http://www.windowsdream.com/dl/PING_1.12/rc.ping

Regards
Natan

User avatar
Curtis8
Site Janitor
Posts: 985
Joined: Thu Mar 01, 2007 3:22 pm
Location: Canada
Contact:

Postby Curtis8 » Thu Apr 05, 2007 2:20 pm

I tried your link, seems to be broke :(
Curtis

If you can read this, help me by going to the following link (can only go once per day)
http://s13.bitefight.org/c.php?uid=32058

Thank you

User avatar
Natan
Site Admin
Posts: 1722
Joined: Sun Nov 20, 2005 12:29 am

Postby Natan » Thu Apr 05, 2007 2:26 pm

Oops, sorry. Should be OK.

User avatar
Curtis8
Site Janitor
Posts: 985
Joined: Thu Mar 01, 2007 3:22 pm
Location: Canada
Contact:

Postby Curtis8 » Tue Apr 24, 2007 2:25 pm

This code goes in the if($Action eq "Ghost" || $Action eq "Mixed")
area. A little past line 1700 (way near the bottom :P)
I do not know how to use diff so if you want automount (CD/DVD spanning) it will take some searching.

Code: Select all

            if($FF =~/\.000$/)
            {
                my $Dev = $F;
                $Dev =~s/\.\d{3}$//;
                system("umount /dev/$Dev >/dev/null 2>&1");
               
                # Added/Modified by Curtis
                my $cmd = "";
                if($SRC =~/cdrom/ && -e "/mnt/cdrom/AUTO")
                {
                   $cmd = "partimage -f3 -w -c -d -o -a\"/dev/$CD_Dev#/mnt/cdrom#iso9660\" restore /dev/$Dev $FF";
                }
                else
                {
                   $cmd = "partimage -f3 -b -c -d -o restore /dev/$Dev $FF";
                 }
                # End of Added/Modified by Curtis
                LOG("    * [$cmd]\n");
                sleep 2;
                system($cmd);
            }


Please note that with the automount feature, the batch mode of PartImage is disabled (will not work if you re-add the -b) There are also some messages and warnings before the partition starts to restore. This is a problem with PartImage as far as I can tell, however, if you can find the right switches and post them here, Natan and I would be ever grateful.
Curtis

If you can read this, help me by going to the following link (can only go once per day)
http://s13.bitefight.org/c.php?uid=32058

Thank you

BasicOs
Posts: 9
Joined: Wed Apr 25, 2007 11:45 pm

AutoInstall apps after recovering one partition or Hd

Postby BasicOs » Wed Apr 25, 2007 11:57 pm

I am in a open project Autoexecute,

who can it be useful for PING people, after recovering, or before.

  • after recovering a partition, there is allways need to install a bunch of apps, or useful programms,
  • Before recovering any parti. there could be some important data could be saved, collected, and zipped, then all sent to your loved gmail account as backup data

You can download autoexecute.exe and scripts:

links: www.emesn.com/autoexecute
www.emesn.com/autoitforum

There are many example scripts.

Salu2
:lol:

Codd
Posts: 7
Joined: Sun Mar 18, 2007 2:14 pm
Location: Canada

Contributions Thread

Postby Codd » Wed May 02, 2007 5:01 pm

Natan / Everyone,

Was away on vacation and have finally tested the HP Smart Array Code that was added into 1.12.

It appears that my original "diff" post above did not include the "detection" of cciss devices in the 'Ghost or Mixed' case section of the code, therefore the backup works flawlessly, but the restore does not work at all.

The code below includes what was missed :

Code: Select all

if($Action eq "Ghost" || $Action eq "Mixed")
    {
        foreach my $FF (@FF)
        {
            my @fields = split(/\//, $FF);
            my $F = $fields[-1];
       #
       # Section added for cciss compatability (HP SmartArray)
       #
       if($fields[-2] =~/cciss/i)
       {
      $F = $fields[-2]."/".$fields[-1];
      chomp($F);
       }
       #
       #
       #
            my $Node = $F;

            unless($F =~/\.000$/ || $F =~/\.zip$/i)
            {
                next;
            }

            LOG("  * Restore [/dev/?? from $F] with [$FF]\n");


Cheers,
Codd

crulie
Posts: 19
Joined: Mon May 21, 2007 1:52 pm

Logical bug/error during local backup/restore

Postby crulie » Sun Jun 03, 2007 4:51 pm

Hi All!

I'm using PING to backup and restore computer systems at work. Now and then I'm out in the "field" working on computer systems. In situations like that I've found the need to backup one harddrive to a second harddrive, preferably an external USB-drive.

So.. I sat down started to look at the code to change it to fit my needs. During my tests I noticed the following. If I choose to do a local backup/restore, and I choose a harddrive that has more than one existing partition, I get to choose a single partition to backup. But when the backing up starts, the script still create images of all my partitions... I'm not sure if I'm doing someting wrong or not.

Is there any active work on supporting imaging from one local drive to another local drive? If not I will try to change the script to suport that, and of course feed the change back to the community.

Thanks for a great program!


Return to “PING / General Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest