So, after a Linux crash that caused my previous ddrescue to fail(after 350GB), I started to look into how to speed it up, because 30+ hours did not sound like a good idea to me.
I look into ways to speed it up and using a larger block size did the trick. I experimented with a few different sizes and figured out that using 2M gave me the best throughput. So instead of a couple of megs a second i was getting over 24 MB/s. So about a 4 1/2 hour recovery after that.
ddrescue -b 2M /dev/sda2 /media/newdisk/olddata /media/newdisk/logfile
The ddrescue process will attempt to recover any lost sectors and retrim the lost data. Luckily, I only lost about 3100k of data so the most of my data is safe.
You can attempt to rerun ddrescue with the -r <# of times to retry> and it will continue to attempt to read those failed sectors that were unrecoverable. There is no guarantee that you will get back all the data.
Once this data is recovered, you can (hopefully) mount this file as a disk under linux.
mount /media/newdisk/olddata /mnt/newdisk
Now remember to back up your data and you will not go through the pain that I did to recover this data.
Part 1 of article
Tags: dd, ddrescue, Linux
So I was trying to do some work the other morning in my hotel room and my Windows 7 computer gave me the dreaded blue screen of death and would not boot past loading a certain library file. I was able to boot into an Ubuntu disk that I happened to have and found that there were many S.M.A.R.T. errors on the disk and wished I had thought to monitor this. So it seemed that my drive was cooked and I could not get any of the data from it.
I was disappointed that Spinrite was unable to save me from the problems that I was having and I paid 90 bucks for it. So I turned to tools in Linux that might do the job. I had used the dd utility to copy the contents of my drive to a new drive in the past, but dd will exit on the first error. So I found that there is an addition to the dd program called ddrescue which is part of the GNU Project.
This utility will let you copy the contents of a disk or partition and allow you to skip the errors or even retry the error spots a number of times.
The command line is something like:
ddrescue -r 3 /dev/sda1 /media/newvolume/diskimage.iso /media/newvolume/logfilefordiskimage
The really nice thing is if you have to stop the command for some reason, it will restart from the end of the log file. It does take quite a bit of time. I am 6 1/2 hours into recovering a 500GB disk, but it beats losing all my data. I will follow up this post with the results of the rescue and the next steps I took to recover the data.
Part 2 of article
Tags: dd, ddrescue, Linux
Sometimes you have a drive that your want to mount under Linux. The mount command can make the drive available to you. But you need to also create a directory to hold the mount point.
mkdir /mnt/drivepoint
Then you can mount the drive to that mount point by using the mount command and giving the device identifier, in this case it is /dev/sda1, and the mount point which we created as /mnt/drivepoint. One thing to note, is that the mount will use whatever directory you specify, so if there are files located in the directory you use as a mount point, they will no longer be visible.
mount /dev/sda1 /mnt/drivepoint
This must be run as root or with the sudo command.
Tags: Linux, OS, Utilities
Recently I upgraded to WordPress 3.2.1 and in the midst of this I was fixing a problem in my functions.php file. It turned out that using the editor happened to leave an extra line at the end of my functions.php file and this caused all of the admin pages to no longer load. I removed the extra space at the end of the file and now I am able to admin my site.
So check any recently updated files and make sure there are no erroneous spaces at the end of the files.
Tags: Wordpress
I was tearing my hair out the other night trying to figure out why there was a 28px margin at the top of the page that I don’t remember setting up. I searched the for the issue and found that there is an issue with the version I am stuck on and the work around is to put the following code just before the </body> tag in footer.php.
<?php wp_footer(); ?>;
Tags: Wordpress
Sometimes it is necessary to install other modules into the Perl environment. Luckily there is a great repository of modules known as CPAN (The Comprehensive Perl Archive Network). This lets you install modules to help with encryption, XML,YAML, and many other things. There are a few ways to install a package and here are the ones that I use the most.
Using the CPAN shell:
perl -MCPAN -e shell
This will open a command prompt that will let you search for CPAN modules with:
i /PACKAGENAME/
or install a new module:
install /DateTime/
The nice thing about installing with CPAN is that it will look for the dependencies and suggest installing them before the module you requested.
NOTE:This can take some time and your dependencies could have dependencies.
The other method I use is to skip the CPAN prompt and just directly execute the install of the module:
perl -MCPAN -e 'install DateTime'
This is just the most basic of usage, and there is probably a lot more you can do, but I have not had to use much more than this.
Tags: perl, Programming, scripting
Here is a list of the Hello World Programs for different languages:
C
#include <stdio.h>
int main()
{
printf("Hello World!");
}
C++
#include <iostream.h>
int main()
{
cout << "Hello World!" << endl;
}
C#
public class HelloWorld
public static void Main()
{
System.Console.WriteLine("Hello World!");
}
Java
class HelloWorld {
static void main(String[] args)
{
System.out.println("Hello World!");
}
SHELL
echo "Hello World"
Python 2
print "Hello World!\n"
Python 3
print ("Hello World!")
Ruby
puts "Hello World!"
Perl
print "Hello World!n";
PHP
<?php
print "Hello World!";
?>
Rust
fn main() {
println("Hello World!");
}
This is the simplest form of Hello World for most of these languages.
Tags: C, Java, perl, PHP, Programming, Python, Ruby, Shell
Every once in awhile, I need to backup a large directory from another computer. This can be done by creating a zip or tar of the files you are looking to save and then copying those zips to the other computer. But what it you have a very large directory and not enough room to store the extra file. Here is a way to use tar over ssh:
ssh tar zcvf – /wwwdata | ssh root@backupserver.mydomain.com “cat > /backup/wwwdata.tar.gz”
Did you know? You can Set file timestamp using touch command. One way to do this is:
touch -c -t YYMMDDhhmm filename.txt
Learnable
www.learnable.com
Brought to you by Sitepoint. They have created a site to host their on-line classes and a place for people to create their own as
well.
Udemy
www.udemy.com
Just checking this one out, I found some interesting courses, but many seem to be placeholders for classes to come later.
LiveMind
www.livemind.com
Just read about this one and have not looked thorugh it very much yet.