How to make USB Knoppix(6.2) to save your Windows(Mac) data

My friend’s laptop machine did not start up. It seems Windows system files got corrupted. I thought it can be fixed. I decided to create a back up system before I started doing anything on this machine. However the machine was Netbook model and there was no internal optical disk drive. I recalled that USB boot drive could be created with Knoppix thus I decided to give it a go.

I heard that Knoppix had new features in version 6 and above to create a bootable flash drive (in USB memory).
We can create both CD and DVD version. CD version (700MB), which is smaller in size, suits better for data recovery purpose. DVD version, which is 2400MB, is far too large. I used mac. Knoppix required preparing boot up CD before creating USB but I decided to boot up the machine with parallels (simply because I did not have time to burn on CD).

following the step.

1. Download Knoppix

Knoppix is distributed in Torrent file format. I visited its site shown below.

http://torrent.unix-ag.uni-kl.de/

As of 11/08/2010, the latest version available was 6.2.1. I downloaded followings.

KNOPPIX_V6.2.1CD-2010-01-31-EN

Download Knoppix using Torent software.
I recommend Transmission if you use mac.

2. Create a virtual machine with parallels from downloaded iso

Select “File -> Create New Virtual Machine” and follow the instractions.
Select downloaded iso file when you select file as shown in screen below.

3. Create USB Knoppix

Insert USB device to your machine when Knoppix starts up. The USB decide will be auto-detected.
Select “preference -> flash boot”

Note: you will be asked whether to format a drive. Do not format existing drive. Make sure you select USB device.

4. Change OS boot settings

By default, OS will be booted up from your HHD therefore you need to change the setting to USB.

When the machine is starting up Press F2 (the key can be different depending on mother board manufacturer). With displayed BIOS setting screen, continue setting up.

5. Backup to other media on Knoppix

Boot the system from USB memory drive. When Knoppix starts up, continue navigate as per normal and create back up to external HDD or USB.

This is it. I have to say it is a bit troublesome. It is the best to have it prepared before the machine starts giving a problem but I really did not feel like doing so.

Appendix

Apart from what I had just described above, You can also create your USB boot up system with “Ubuntu Rescure Remix” which is created using Ubuntu. If you are interested, please try it also.

http://ubuntu-rescue-remix.org/

http://www.linuxliveusb.com/

[CakePHP]How to save IP address or Host name automatically

I’ve been using CakePHP a lot so I would like to release the tips little by little during break.

If it’s CGM type web service, users do some actions and keep them in DB. It’s usual to keep user’s IP addresses at that time to follow users . It takes time to write the codes in all of models to keep IP so it’ll be way easy if you do like example below.

In that case, type “ip_address” in field of the table you would like to save IP address, type also “host_name” in field if you would like to save host name.
Then keep it in “beforeSave” of app_model.php , the table you added the field will save all of IP addresses automatically.

app_model.php

[php]
function afterSave($created) {
if ($created) {
if ($this->hasField(‘ip_address’)) {
$this->saveField(‘ip_address’, env(‘REMOTE_ADDR’));
}
if ($this->hasField(‘host_name’)) {
$this->saveField(‘host_name’, @gethostbyaddr(env(‘REMOTE_ADDR’)));
}
}
}
[/php]

[CakePHP]How to create navigation with well thought out about current page

Using layout template is general at cakephp view. There is a global menu in layout template. If we show the selected global menu in each page even if it takes time a bit, it looks neat as the example below which I found at Google group.

[php]
<?php
$navLinks = array(
‘home’ => array(
‘title’ => ‘home’,
‘path’ => ‘/’,
),
‘services’ => array(
‘title’ => ‘our services’,
‘path’ => ‘/pages/services’,
),
‘contact’ => array(
‘title’ => ‘contact us’,
‘path’ => ‘/contacts’,
),
‘about’ => array(
‘title’ => ‘about us’,
‘path’ => ‘/pages/about’,
),
);
?>

<ul id="global_nav">
<?php foreach ($navLinks as $key => $link) :

$class = null;
if (strpos($this->params[‘url’][‘url’], substr($link[‘path’], 1)) !== false) {
$class = array(‘class’ => ‘current’);
}
?>

<li id="nav_<?=$key?>"><?=$html->link($link[‘title’], $link[‘path’], $class)?></li>
<?php endforeach; ?>
</ul>
[/php]

Settings of multiple IP address in Proxy server squid

I’m operating proxy server and using squid but I might need multiple IP operation so I’d like to leave a note for that. Multiple IP operation in squid has no information even if it’s in English, so I wrote them just in case for those might be stuck.

First, edit below

vi /etc/squid/squid.conf

And add to port listen

http_port 200.200.200.200:3128 http_port 200.200.200.201:3128

describe acl

acl ip1 myip 200.200.200.200/32 acl ip2 myip 200.200.200.201/32

outgoing address settings

tcp_outgoing_address 200.200.200.200 ip1 tcp_outgoing_address 200.200.200.201 ip2

and, changing dns server settings

dns_nameservers xxx.xxx.xxx.xxx

/etc/init.d/squid restart

That’s all. It’s easy if you know that.

 

PTY allocation request failed on channel 0 [ssh|CentOS]

The subject issue may occur in VPS such as OpenVZ and Xen. The reason is vary but lots of case are happened in OpenVZ and Xen.

In my case, it happened in OpenVZ environment. One day I saw my blog the error said “cannot access to the database.” and nothing display. I thought mysqld dead so I logged in VPS.

PTY allocation request failed on channel 0

Just the error above showed and it’s horrible, I couldn’t do anything. In my case, seems like happened in CentOS update.

Although I found a solution by referring to URL below, http://www.asteriosk.gr/blog/2009/02/20/pty-allocation-request-failed-on-channel-0/

I could not establish ssh access, I contacted the customer support from hosting admin screen. I use NYNOC hosting provider. It has admin screen called “HyperVM”. I was instructed to use “Fix Centos Dev” execution button. On using the button, the access problem was resolved. I was beginning to feel that, perhaps the button was integrated into the admin screen because the problem frequently occurs. Anyhow I re-gain the ssh connection and tried to restart mysqld but it didn’t work.

I checked the log and it seems permission problem.

It showed that the file owner in /var/lib/mysql did not match /var/run/mysqld permission.

I really have no idea why but since I started using NYNOC, I have come across many unknown problems….:(