Cloning a hard drive over a network using netcat

My wife's PC has been around for a few years, and I had a newer PC that I wanted to move her onto. Problem was, her old PC only had IDE connectors for the HD, and the replacement only had SATA.

Being a linux guy, I whipped out an old removable USB hd I had lying around, and booted up the replacement PC off of an Ubutnu 9.10 CD I keep around for just such purposes, and i used gparted to clone a copy of the replacement PC's HD off to the USB HD. So the replacement PC is now ready to serve as a true replacement.

On her old PC, I fired up an Ubuntu 10 CD, only because I had a separate Ubuntu 10 CD lying around, and for some strange reason, gparted on the Ubuntu 10 CD bombs. Anyhow this ain't about gparted. So I googled up "copy hard disk over network" and found this: http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html and it did the trick. But here are the specifics I used which actually worked:

Both source (her old PC) and target (the newer pc) are booted up using an Ubuntu 9 or 10 LiveCD. On both PCs I fire up a terminal session

$sudo su -
#passwd root

and I enter a new password for root. I can't tell for sure if you do or don't need to do this. I'm just telling what worked for me. So I now have a root terminal session fired up on both source and target PCs.

Let's say the target PC's IP address is 192.168.0.10. Also, let's say I used gparted on both the source and target to look at the disks, and I determine that /dev/sda is the disk I want to copy on the SOURCE PC, and /dev/sdb is the disk I want to overwrite on the TARGET PC. Very important.

On the TARGET PC, in that terminal session, I issue the following:

#netcat -v -p 2222 -l |bzip2 -d | dd of=/dev/sdb bs=16M

So I see netcat fire up and it says it's listening on port 2222.

On the SOURCE PC, in that terminal session, I issue the following:

#bzip2 -c /dev/sda | nc -v 192.168.0.10 2222

And it looks like this:

root@ubuntu:~# bzip2 -c /dev/sda | nc -v 192.168.0.10 2222
Connection to 192.168.0.10 2222 port [tcp/*] succeeded!

Okay,here is where patience kicked in. I started in 3:00 pm in the afternoon, and it wasn't done until the next morning! Was it the "bs=16M" in the dd command? Both computers were going at gig speed on the NICs. The disk was 80gb, so that'll give you an idea. But you know what? It worked! I rebooted the new PC, and Vista fired up. Awesome.

ubuntu server 8.10 = cannot login

Did a clean install of Ubuntu Server 8.10. Configured to run only print server and Samba. All went well until the install was done and the new system fired up. Can't login at all. Only way to login is to reboot and use the recovery console. Which I did. Decided to upgrade the distro to the latest Ubuntu, which I did. Still can't login.

Finally, the fix.

sudo pam-auth-update

Do that and unselect the "SMB password synchronization". Reboot and all is well.

Getting Kino to work with a DV camera input

On my Ubuntu Studio workstation, I've added in a generic DV capture card, one with a firewire (1394) interface on it. Getting it to work with kino, however has proven to be somewhat of a pain. This is mostly here now for my own recollection in the future.

This worked for me. I cannot say it will work for anybody else, nor do I even begin to claim to have any "how-to" suggestions beyond what you read here and now. So here is how I got it to work:

  • Connect camcorder's DV output to the DV capture card, and power up the camcorder
  • Reboot the workstation with the camera powered up
  • After reboot, log on as ordinary user
  • Fire up a terminal session
  • Issue the following commands:
  • modprobe raw1394
    gksudo kino
  • Yes, this means it has to run as root. You will likely be prompted to re-enter your credentials, so do it.
  • Kino will fire up. Under Edit > Preferences > IEEE 1394, you should now see your DV device.
  • It still took some fiddling around with the display settings and what-not, but the device will work if you keep at it.

And that's how I got it to work.

Ubuntu - getting more screen resolution options

I installed Ubuntu on two different PCs, and in both cases, the default screen resolutions offered were lame! In both cases, the only one that worked was 800x600. Googling around revealed that I was not alone in this frustration. One evening I decided to give it another go, and now have, happily, got plenty of screen resolution choices to pick from, such as 1024x768, which I'm using now.

Here is what I did:

Well, first off, google up the specs for your monitor. In my case, I've got an old NEC MultiSync 5FGp. Googling turned up this:

NEC, MultiSync 5FGp, 17", 27-79kHz, 55-90Hz, 0.28mm
(you might not need this step) I then visited The XFree86 Modeline Generator and plugged in the horizontal sync and vertical sync info I found for my monitor. I took the resulting modeline and copied it down for future use.

Okay, now edit /etc/X11/xorg.conf. I used vim to do the editing, you can use whatever you like.

$ sudo vim /etc/X11/xorg.conf

Scroll down and find the section that looks like this:

Section "Monitor"
Identifier "Configured Monitor"
HorizSync 28-40
VertRefresh 43-60

Comment out those original values, and stuff in the values for your monitor.

Section "Monitor"
Identifier "Configured Monitor"
#HorizSync 28-40
#VertRefresh 43-60
HorizSync 27-79
VertRefresh 55-90

In this case, you can see the values are quite a bit different from the default. Log out, log back in, and I bet you got lots of screen resolution choices now.

Okay, so if you don't, you need to toss in that modeline info from the Modeline Generator.

Section "Monitor"
Identifier "Configured Monitor"
#HorizSync 28-40
#VertRefresh 43-60
HorizSync 27-79
VertRefresh 55-90
modeline "800�600@56" 36.0 800 824 896 1024 600 601 603 625
modeline "800�600@72" 50.0 800 856 976 1040 600 637 643 666
modeline "800�600@75" 49.5 800 816 896 1056 600 601 604 625
modeline "800�600@60" 40.0 800 840 968 1056 600 601 605 628
Modeline "1024x768@75" 85.52 1024 1056 1376 1408 768 782 792 807
Modeline "1024�768@60" 64.56 1024 1056 1296 1328 768 783 791 807
Modeline "1152�720@60" 66.75 1152 1184 1432 1464 720 735 742 757
modeline "1152�768@54" 64.995 1152 1178 1314 1472 768 771 777 806
Modeline "1280�800@60" 83.91 1280 1312 1624 1656 800 816 824 841
modeline "1280�854" 80.0 1280 1309 1460 1636 854 857 864 896
modeline "1280�768@60" 80.14 1280 1344 1480 1680 768 769 772 795
modeline "1280�720@60" 74.48 1280 1336 1472 1664 720 721 724 746
modeline "1280�800@75" 107.21 1280 1360 1496 1712 800 801 804 835
modeline "1280�768@75" 102.98 1280 1360 1496 1712 768 769 772 802
modeline "1280�720@50" 60.47 1280 1328 1456 1632 720 721 724 741
modeline "1280�800@60" 83.46 1280 1344 1480 1680 800 801 804 828
modeline "1680�1050@75" 188.07 1680 1800 1984 2288 1050 1051 1054 1096
modeline "1920�1200@60" 193.16 1920 2048 2256 2592 1200 1201 1204 1242

EndSection

Section "Screen"
Identifier "Default Screen"
Device "Configured Video Device"
Monitor "Configured Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1440�900@60" "1600�1024@60" "1440�900@75" "1680�1050@60" "1280�800@60" "1680�1050@75" "1280�720@50" "1920�1200@60" "1280�768@75" "1280�800@75" "1280�720@60" "1280�768@60" "1280�800@60" "1280�854" "1152�720@60" "1152�768@54" "1024�768@60" "1024x768@75" "800�600@60" "800�600@75" "800�600@72" "800�600@56"
EndSubSection
EndSection

In the above sample, I stuffed in the "1024x768@75" entry in there. But I bet you dont' have to do that. I bet changing the horizontal sync and vertical refresh does the trick for you.

Well, at least it worked for me. No promises this will work for you.

BlogCFC was created by Raymond Camden. This blog is running version 5.9.3.002. Contact Blog Owner