Upgrading the disk on a Sony PCG-838 Notebook

Again, this is stream of consciousness, complete with mistakes and backtracks, so please read to the end before trying to duplicate what I did. If you want to jump ahead to where I actually succeeded look for "phdisk.exe", but you will need to read the previous stuff as well. This is happening 21 Nov 2000.

After some careful searching around on Toshiba's web site, it appears that I may be able to upgrade my Toshiba 6.4 Gb disk (MK6409 MAV) to an 18 Gb disk (MK1814 GAV). It appears to have the same physical dimensions, consume less power, and otherwise be a compatible IDE/ATA drive. The disk came from Dirt Cheap Drives, and was about $250. Cheap enough to take a chance on.

The disk caddy is quite elegant, and I don't forsee problems with putting the new drive into it. Of course I really want to have a new caddy as well, but that appears to be very very hard to do. I'm working on the local Sony service place... They were quite helpful, but eventually told me that I could purchase each of the various components of the disk caddy for about $50 apiece, totalling about $200. Crazy! Where do old PCG838's go to die, I wonder? I'd love to visit the graveyard and scrounge a few bones.

The interesting problems will be:

1. Does my BIOS recognize the disk or does the 24 bit IDE problem restrict me to 8.4 Gb? Just how current is the BIOS in this venerable notebook?

2. Where do I put the 200 Mb hibernation partition? Will it work?

3. What is the easiest way to move my old system(s) from the 6.4 to the 18 Gb disk? I think the answer is to partition the new disk in a compatible way, do a workstation install of Linux onto a new, big partition, get the ethernet up, restore the old stuff onto the new disk, and then try booting off of the old stuff from the new disk.

In the meantime, I clearly need a backup of the old disk:

  tar cvlf - /          | rsh avidya "cat > /va/notebook/root.tar"
  tar cvlf - /usr       | rsh avidya "cat > /va/notebook/usr.tar"
  tar cvlf - /home      | rsh avidya "cat > /va/notebook/home.tar"
  tar cvlf - /mnt/win98 | rsh avidya "cat > /va/notebook/win.tar"

Here's what I get using "cfdisk /dev/hda" on the existing disk:

                          cfdisk 2.10f
      
                       Disk Drive: /dev/hda
                      Size: 6495068160 bytes
       Heads: 240   Sectors per Track: 63   Cylinders: 839
      
 Name  Flags Part Type  FS Type          [Label]  Cyl     Sect   (MB)
-----------------------------------------------------------------------
 hda1  Boot   Primary   Win95 FAT32               269  4067280  2082.45
 hda5         Logical   Linux ext2                 14   211680   108.39 
 hda6         Logical   Linux ext2                340  5140800  2632.09
 hda7         Logical   Linux ext2                149  2252880  1153.48
 hda8         Logical   Linux swap                 13   196560   100.64
 hda9         Logical   Linux swap                 13   196560   100.64
 hda10        Logical   Linux swap                 13   196560   100.64
 hda4         Primary   IBM Thinkpad hibernation   27   408240   209.02
              Primary   Free Space                  1    15120     7.75

Partition Table for /dev/hda

         ---Starting---      ----Ending----    Start Number of
 # Flags Head Sect Cyl   ID  Head Sect Cyl    Sector  Sectors
-- ----- ---- ---- ---- ---- ---- ---- ---- -------- ---------
 1  0x80    1    1    0 0x0B  239   63  268       63   4067217
 2  0x00    0    1  269 0x05  239   63  810  4067280   8195040
 3  0x00    0    0    0 0x00    0    0    0        0         0
 4  0x00    0    1  811 0xA0  239   63  837 12262320    408240
 5  0x00    1    1  269 0x83  239   63  282       63    211617
 6  0x00    1    1  283 0x83  239   63  622       63   5140737
 7  0x00    1    1  623 0x83  239   63  771       63   2252817
 8  0x00    1    1  772 0x82  239   63  784       63    196497
 9  0x00    1    1  785 0x82  239   63  797       63    196497
10  0x00    1    1  798 0x82  239   63  810       63    196497

Well, my poor 6.4 Gb disk seems to have bitten the dust in the process of writing the tar files. It did finish writing them, but I cannot access the disk any more. Did it overheat? So now I'm really committed to this crazy idea.

Anyway, move the new disk into the caddy, plug it in, and find that the BIOS only sees 8.4 Gb worth. Oh well. This is likely to cause problems with the hibernate, and I'll have to be careful about where I put boot partitions, although Linux should still be able to deal with the entire disk.

Proceed with a Linux install as follows:

1. Boot linux install disk, ask for custom installation.

2. Partition the disk to have

   1 = 2082 Mb, type 0b  (this will be /mnt/win98)
   4 = 209 Mb, type 0a
   2 = 150 Mb, type 83  (this will be my /)
   3 = the rest
   5 = 100 Mb, type 82 swap (out of primary partition 3)
   6 = the rest, type 83 (which I designate as /usr)

3. Answer the questions to do a minimal install (don't make a boot floppy)

4. Linux boots. It can't mount /mnt/win98 because it's unformatted, so shut down, put in windows install disk, let it format (AND NO MORE).

5. Bring up the internet:

   ifconfig -a
   ifconfig eth0 ...my_IP_address...
   ifconfig eth0
   ifconfig eth0 broadcast ...my_netmask... netmask 0xffffff00
   route
   route add -net default gw ...my_gateway...
   netstat -rn

6. Try a hibernate -- sorry charlie, saves to memory not disk.

7. do a tar back from avidya of win98 to see if it works...

   cd /; rsh ...my_IP_address... cat /va/notebook/win.tar | tar xvpf -

Then add an entry to lilo.conf:

   other=/dev/hda1
         label=win98

rerun lilo, reboot, and it does seem to be OK. That's amazing.

8. Fool around with the BIOS. In [auto] detect it finds 17475 cyl, 15 hd, 63 sect -> 8455 Mb. Change to [user] with 35071 cyl, 16 hd, 63 sect -> 18100 Mb. Having done this Linux still boots but windows doesn't. The hope is that I can now put the hibernate partition at the very end.

OK, back to linux install, custom, use fdisk. This time partition, units are cylinders of 15120 * 512 bytes; disk has 240 heads, 63 sectors, 2334 cyl.

   1 = 2082 Mb, type 0b  (this will be /mnt/win98)
   4 = 209 Mb = 27 cyl, range between 2316-2343, type 0a
   2 = Extended, all the rest
   5 = 150 Mb, type 83  (will be /, currently /mnt/root)
   6 = 1000 Mb, type 83 (will be /usr, currently /mnt/usr)
   7 = 2500 Mb, type 83 (will be /home, currently /mnt/home)
   8 = 100 Mb, type 82 (swap)
   9 = 100 Mb, type 82 (swap)
  10 = 100 Mb, type 82 (swap)
  11 = the rest, type 83 (which I designate as /)

3. Answer the questions to do a minimal install (make a boot floppy)

But now this won't boot -- it gets to "LI" but can't get out the LILO. So sad.

OK, problem probably is using the extended partition which extends over the 8.4G boundary. Try the following:

   1 = 1-283 = 2139 Mb, type 0b  (/mnt/win98)
   4 = 2317-2343 = 209 Mb = 27 cyl, type 0a
   2 = 284-1000 = Extended, front half, up to 7.7Gb
   3 = 1001-2316 = back half of disk, (currently /mnt/big)
   5 = 150 Mb, type 83  (will be /, currently /mnt/root)
   6 = 1000 Mb, type 83 (will be /usr, currently /mnt/usr)
   7 = 441-962 = 4033 Mb, type 83 (will be /home, currently /)
   8 = 100 Mb, type 82 (swap)
   9 = 100 Mb, type 82 (swap)
  10 = 100 Mb, type 82 (swap)

This now works OK, but will not hibernate.

So let's go back to the idea of letting the BIOS use [auto] for the disk configuration, and put the hibernation partition at the very end of the 8.4 Gb. It thinks that it has 17475 cyl x 15 head x 63 sect = 16513875 blocks = 8455 Mb. When we get to Linux, we have to place things on even cylinder boundaries, which correspond to 15120 blocks, and 8455Mb corresponds to 1082.1875 linux cylinders. Hmmm. The problem is the incommesurability of what BIOS thinks the disk geometry is compared to Linux.

So let's try a hack. Delete all parititions using Linux (necessary since DOS fdisk won't deal with Linux logical partitions) and then boot up DOS from the system recovery CD and use DOS fdisk to create the windows and hibernation partitions. The hope is that DOS will take its cue from the BIOS. Of course I already know that DOS sees 17 Gb, so this may be a forlorn hope... But I very much suspect that the BIOS will not hibernate to a partition which disobeys its notion of what the geometry is.

Well, this doesn't seem to work either. All I can specify is partitions in units of Mbyte, and I'm extremely doubtful that the DOS fdisk will hit the right place. So one final attempt. I'll let the system recovery disk totally trash and restore the disk. It's going to give me a 17.3 Mbyte C: drive, so I suspect I'm screwed, but I'll let it do its thing.

Sniffing around the net yielded a few clues:

http://www.seanet.com/~scout/linux505.htm

   As it came out of the box, the drive had two partitions on it.
   Partition 1 had Win 98 with lots of apps on it, and Partition 4
   is the Hibernation partition, where the machine puts RAM and
   video data when you put the book to sleep.  Partition 4 was
   something like 130MB, which seemed like overkill to me.  I did
   some research, and found that the size of Partition 4 only needs
   to be the size of your RAM plus about 3 MB for Video memory.
   Run phdisk.exe (it's in the SonySys directory) to resize it.  I
   got the partition down to about 35 MB.  fdisk reports the
   parition id type as 'a0'.

OK, I found phdisk.exe on the system recovery disk in a subdirectory called SPT. It apparently is Phoenix Systems NoteBIOS's way to create a hibernate partition! With a complete Win98 eating up my entire disk I ran it:

phdisk /ram192 /create /partition

This nuked the windows partition, and created primary partition 1 with 204 Mbyte of space. Sheesh. I then reran DOS fdisk and created 2082M for primary partition 2 and made it active. Upon rebooting the system disk again I was asked to format it, and I agreed.

I reboot linux again, and find that

   1 = 1024-1306 = win98
   4 = 997-1023 = hibernate

Nuke partition #1 and redo as:

   1 =  1  - 283 = 2139 Mb, type 0b  (/mnt/win98)
 ( 4 =  997-1023 = hibernate )
   3 = 1024-2343 = back half of disk, (currently /mnt/big)
   2 =  284- 996 = Extended, front half, up to 7.7Gb
   5 =  284- 304 = 150 Mb, type 83  (will be /, currently /mnt/root)
   6 =  305- 440 = 1000 Mb, type 83 (will be /usr, currently /mnt/usr)
   7 =  441- 954 = 4033 Mb, type 83 (will be /home, currently /)
   8 =  955- 968 = 100 Mb, type 82 (swap)
   9 =  969- 982 = 100 Mb, type 82 (swap)
  10 =  983- 996 = 100 Mb, type 82 (swap)

After the minimal Linux installation was complete I tested the disk hibernation and it seems to work. Amazing. Then, in order to maximize the chances of getting Windows to work, I put the win98 recovery disk back in and let it reformat the windows partition once again.

So now all I have to do is clean up. I've got a bare-bones Linux in /dev/hda7 which allows me to access the net and move things back and forth. I mount the other partitions as /mnt/win98, /mnt/root, and /mnt/usr, and tar back the previous backups onto these partitions. I rerun lilo to point at this new partition /dev/hda5, reboot, and hey! my old system is back again. Even more amazing, windows appears to have survived this tarring and untarring intact. Now I wipe out the bare-bones linux in /dev/hda7 and restore my user files, and mount the back half of the disk as /d0. All done -- now I've got my 6.4 Gbyte old system in the 8.4 Gb front half of the disk and a new 10 Gb back half of the disk to play in.