Jack's Jots

Saturday, January 5, 2008

dd disk transfer performance

For the second time this year, I had a disk crash. I am getting smarter about making backups. Not as good as I should be, but better.

So, to make a complete backup, I made copies of the disk partitions by using dd to write to our family server. Well that took a long time over the net, but it did it.

I got smart and deleted the network for the install by bringing the USB drive on the server to my computer. However, that was still slow. It was taking hours to move the data over USB to the SATA drive in my computer. So, I began thinking about block-sizes. Why do we always use 512 byte blocks? Seems that is rather archaic since the drives are much faster than they were 30 or so years ago when dd was first created. The OS and the disk controllers will have some optimum performance. So, I did some timing with various values of block sizes, the actual command that I ran was: dd if=copy_sda4 of=/dev/sda2 bs=XXX


BlocksizeRate in MB/s
512 B7.9
1 KB8.4
2 KB37.8
4 KB32.6
8 KB32.8
16 KB32.8
32 KB32.8
64 KB32.9
128 KB32.9
256 KB32.9
512 KB32.9
1 MB32.8
2 MB32.7
4 MB32.0

So, for my USB and SATA setup had the best performance at 2KB. Your mileage may very.

Here this code I used to capture the data.

#!/bin/bash

size=( 512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M 2M 4M )

for i in ${size[@]:0} ; do
(dd if=jbriner_sda4 of=/dev/sda2 bs=$i ) & ddPid=$!
echo Blocksize set to $i for $ddPid
sleep 60
sync
kill -SIGUSR1 $ddPid
sleep 4
kill -SIGHUP $ddPid
sleep 2
done


Labels: , ,

Help with File Transfers to Your Webhosting Service

As I run a hosting service (www.holycitywebsites.com), I thought I would provide some help for those that are having difficulty with downloading and uploading files. We provide a number of tutorials to help the people with ftp. However, since I just had a request for someone using Joomla to recover his password, I thought that we all sometimes need a real walk through.

Note, we also provide a web based ftp program. However, I usually like to use Internet Explorer for simple things.

So, I am going to go through the process of taking a file from one of my Joomla based accounts, editing it and putting it back. Step 1, go to your site with IE. It should pop up a log on message.


Next, you will want to switch from ie to a desktop file manager. So, select the option under page to open the FTP site in Windows Explorer.


This will allow you to drop and drag files. Once you are logged in you will have what looks like the normal Windows Explorer. However, this is not quite the case. You can only surf, drag, drop, rename and do simple copies from the current page. So, in the steps below we just click down to plugins and authentication to find joomla.php.

1. Now, drag the file to your desktop or some folder (do not edit directly off the ftp browser).

2. Make a copy of the original (select, ctrl+C, ctrl+V). Now, you can make whatever changes
you like to joomla.php. After saving the file, drag the file back to the ftp server.

3. Do whatever you have to. In the case of the authentication problem (see earlier blog), you would change the password as described and save the changes in Joomla.

3. If you need to restore to the original configuration (which you should if you are doing the authentication bypass). Erase the modifed "Joomla.php" and rename "Copy of joomla.php" to "joomla.php"

4. Drag the original joomla.php back to the ftp server.

5. If all goes well with your testing, delete the local copy.


6. Now, if you want to restore back to the original state, rename the copied file back to the original.

7. and, drag the renamed file back to the ftp site.


Good luck and let me know if you found this helpful.

A better solution instead of all of this moving around would be an editor that knows how to use ftp. I am fond of notepad++, a free context-based editor with a plug-in that supports ftp.

Note, I don't like using ftp to transfer to servers. Unfortunately, Some hosting companies provide this as the primary method for uploading files. sftp or some other method that does not passwords in the clear would be much better.

Labels: , ,

Joomla Super Administrator Password Recovery Solution

I received a request for clarification on my Joomla Super Administrator Password Recovery Solution.

Hi Jack,

I have a website that was hacked the other day. My hosting

company restored the site however, I can no longer login to the admin section.
The username and password no longer work. I tripped over your posting
http://community.contractwebdevelopment.com/joomla-how-to-reset-super-admin-pass
wordand was wondering if this fix works with the Joomla 1.0 version. If so,
would you mind explaning which file needs to be edited. I am not a wizard at this
stuff and have looked extensively for a simple solution, including the Joomla
forums to no avail.

Thanks for your time. XXXX

There are at least two ways to recover your lost password.

  1. The passwords are kept in your mysql database whose location and credentials are held in the configuration.php file at the top of your Joomla directory. You need to update by an SQL query (or table manger), the hashed password to something that you know. It's not too hard, but I had trouble getting my hash right when I tried using mysql admin. Also, it is a bit dangerous to mess with SQL if you don't know what you are doing.

  2. The method that I use is fairly simple but also leaves room for problems:

    1. Ftp the file plugins\authentication\joomla.php from your site to your machine.
    2. Save a copy of the file (like orig-joomla.php)
    3. Then, modify the line below as shown using wordpad (etc.)
      if ($crypt == $testcrypt)

      to read
      if (true /* $crypt == $testcrypt */)


      This enables all logins -- rather dangerous.
    4. Login as admin to the administration site with any password.
    5. On the site, go to user administration and update with a new password.
    6. VERY IMPORTANT: FTP the original file (e.g. orig- joomla.php to joomla.php) back to the server to put back on authentication.

If your account was hacked into, I would also suggest that you also consider changing the config.php file to have new secrets in it. It contains the password of your database (you can also do this in global configurations). You would need to use the mysql tool to make sure that you have matching passwords.

Let me know if this helps.

Labels: ,