Tag Archives: Linux

Moved every bit of laptop’s disk to a much bigger disk

My dear old Dell laptop has served me well over the years. At the time the hard drive was average, I’d guess. 30 GB total. Of course today that’s rather small and the poor thing was getting close to full, with a few too many “C: drive nearly full” messages popping up.

So what to do?  The rest of it is fine.

I decided to buy a replacement hard disk. For like $77 I got a brand name 160 GB laptop IDE drive.

Rather than start again (copy all my data to a spare disk or PC, install the new disk, install Windows XP and all the drivers and updates and applications and fixes and settings and and and), I went for the uber-geek approach: clone the current hard drive, every bit of it, over to the new drive. And I did it with (legally) free software.

Technically I copied three things:

  1. The partition table (tiny)
  2. The boot record (tiny)
  3. The NTFS partition itself (big, the C: drive itself)

The Basic Steps

I may give the step-by-step instructions in another post, but the executive summary goes like this:

  • Booted the Laptop with a Live CD of Linux. I used Knoppix, a Linux distribution, in basic Command Line mode (Mode 2). This boots a fantastic, powerful operating system, but it itself does not write to the hard drives, i.e. it totally runs in RAM. However,  Knoppix can still ‘see’ the Laptop’s hardware, including the hard drive….it can even copy and write to it (!).  Windows cannot copy itself to a new drive, whilst active.
  • Configured Knoppix for networking on my LAN
  • On my main Linux (Debian) PC configured the NFS server, enabling the Knoppix Laptop to ‘directly’ copy files to it
  • Copied the above 3 items over using Knoppix commands:
  • Partition Table (using sfdisk)
  • Boot Record (via dd)
  • The NTFS parition (using ntfsclone)
  • ..to the Debian PC via NFS
  • For more on these last few steps, I used this site and this one for ntfsclone.

    If we stop and look now, I have a complete, bit-perfect image of the laptop’s hard drive – it only had one, the C: disk – stored on an external system, my Debian Linux PC.  

    Now it was time to replace the hard drive with the new one and reverse the process:

    • Following the Dell Manual, I removed the Laptop’s hard drive and put in the new one and restarted the Laptop.  The system found it, but – naturally – got an error saying it couldn’t boot from it.
    • So I booted the Laptop via the Knoppix CD and it too found the new drive; even reporting it as 160 GB. Sweet.
    • Using sfdisk, dd and ntsfclone I copied the ‘image’  files back from the Debian PC, via the LAN, to the new, empty 160 GB disk in the Laptop.

    The laptop booted first time into XP with all my data and settings there just fine. Not a single error message!

    Grow grow grow

    As it was literally a bit copy, the Laptop happily reported a C: drive of 30 GB. And 130 GB unused. Not available as such, not as a D: drive…just sitting there empty.

    Easy to fix, simply ‘grow’ the C: drive.  Again some (legally) free software called Gparted to the rescue. Booted with that and via a GUI just dragged the size of the C: disk (technically the NTFS Partition) from 30 GB to 120 GB.  I wanted to leave a bit free for something else later on, beyond the scope of this Post.

    It took a few minutes to do this. When I rebooted, XP correctly saw the disk had changed size and ran some (quick) tests on it. Another reboot and there it is. My C: drive is now 120 GB and all my original data, programs, settings etc are still there.

    Some things I learned

    I didn’t know, but my Dell IDE drive had an adapter over most of the IDE connectors. This really confused me as the manual didn’t mention it.  Hence the new drive and old drive had different physical plugs and the new one wouldn’t initially work; the new drive didn’t ship with said adapter. In semi desperation I just tugged at the current drive’s connectors and the adapter slipped off.  Hence I learned of its existence :-)

    The first time I’ve used NFS and it was easy to use, but wasn’t very fast at all. Could be that the LAN adapters – at one or both ends – were only running at 100 MB, not 1000 MB.

    I may have been able to directly copy the data from the old drive to the new drive, in situ. If I’d known about the IDE adapter thing and had a spare adapter. I have a IDE-to-USB2 adapter and it may have worked.

    All in all, very happy indeed. Not something for the feint hearted, but I reckon it saved me hours, if not days of work.

    Ubuntu Linux woes: but Debian worked first time

    I’ve installed Ubuntu Linux, oh, about 6 times I’d guess. Pretty much flawless each time. But not recently. I wanted to put a new 320 GB disk into a very old PC. Previously this had a much smaller disk – it can only support one drive – and it too was running Ubuntu.

    So at 4pm I plugged in the drive and off it went installing the latest Ubuntu. I gave up nearly 5 hours later. It spent what seemed like 2 hours doing (waiting for?) some sort of language thing. . What a pain. All I wanted was a simple, CLI – that means Command Line Interface (no Windowed GUI) server. I then tried another way and it finally installed…but only after waiting for what seems like an hour for a linux kernel to install.

    Then it totally failed on first boot. An error about the disk being too big for the way Ubuntu was installed. And the system is so old you can’t update the BIOS for such bigger drives.

    The web solution: re-install and manually create a /boot partition at the physical start of the disk. I wasn’t going to wait another few hours, so I gave up on Ubuntu for this ‘simple’ install. Maybe Ubuntu isn’t really designed for this sort of thing and therefore I should share part of the blame.

    Following morning it was back to Ubuntu’s older, wiser brother, Debian Linux. Opted for network install ; my ISP allows ‘free’ access to their Debian archives in terms of monthly usage quota. Within about 1 hour, I had a booted CLI system. Not long after that I had SAMBA installed and was backing up the Windows PC’s files to my new Debian server….

    Backing up with Areca

    I don’t think I’ve ever lost a hard drive. As in had one crash, be zapped, stolen, corrupted…and the data not recoverable.

    I have lost a days work, back in the 80′s, when the file transfer between PCs and Servers (actually Mainframes) was in its infancy. I did the transfer the wrong way – it was a big long command you typed in. So instead of copying today’s work up to the Server, I copied yesterdays down. And clobbered all of today’s work.

    Anyway with hundreds of gigabytes of disk on my main Windows PC, I now stand to lose a lot more than a days work, should the hard drives go boom. Photos, music, videos, documents. I’d hate to think.

    So I back up the photos and documents (etc) to an external USB2 hard drive. I just plug it in and back up the key data.

    The music files are another 80 GB. The above external drive it getting a bit full to store the music files, so just yesterday I bought a 320 GB disk and put it into a very old PC. After a lot of mucking around with Ubuntu Linux, I abandonded that…and went back to Debian Linux 4.0. To cut to the chase, it’s now on my network and Windows thinks it has a new (remote) 300+ GB drive. For the tech heads: yes, it’s SAMBA, of course.

    For the remote (network) drive and the external USB2 drive, I use the free, open source program Areca Backup to, umm, back up the nominated PC folders. Works a treat and recommended.

    One hiccup is an apparent Windows limitation. If your c:\complete\filename\including\path\is.very.long (more than 256 characters) for either the “from” or “to” file, Areca stops, due to this Windows problem. In fact my remote servers ‘path’ was initially a UNC one \\servername\share\backupFolder\ Hence adding lots of characters. I simply created a SAMBA share direct to this backupFolder and mapped a new drive to it. The above UNC name now simply becomes K:\ All okay now.