Tuesday, April 12, 2011

Adding SATA storage to a Cobalt RaQ 4

UPDATED: 2011-05-05
Partition manage with fdisk.

Nearly three months without writing anything in this blog. I did a lot of unsuccessful tests, but nothing well until this week. From the last christmas I am trying to compile the 6.5.18 CentOS kernel for the Cobalt servers. I have a valid patch but the resulting rpm package is bigger than 30MB. I will check this before put on a server. I'm using a Sun LX50 with the latest BlueOnyx for this job.

But last week a new VIA chipset SATA card arrived and yesterday I did a new test. I had a lot of problems with my previous SIL3112 card, it was recognized but the hard disk was not. I tested various hd's and some of them were recognized but never with a good stability.




For this test I used my backup server, a RaQ 4i with a 80GB hd for boot the machine and a WD Raptor SATA 150GB as additional storage. It's a 10k disk but I don't have any other SATA hd at home with no use at the moment. This machine was instaled with a fully updated Strongbolt OS, with the 2.6.20 kernel from OSOffice.

The first part of the test was to install the latest kernel I published: 2.6.9-89.0.23-cobalt. Wow, near one year ago! I have o compile a new one...

With this kernel the SATA card and hard disk was correctly recognized as you can see in the next capture of the hardware information page.

This was the easy part. To use this hard disk as storage for BlueQuartz we need to move our /home partition to it. Here you can see how the first hard disk was before any change:


Now the not easy part:
  • Login to the server as root.
  • Check if the hard disk appears on fdisk. As you can see it was formatted with NTFS:
[root@cobalt ~]# fidsk -l
Disk /dev/hda: 80.0 GB, 80026361856 bytes




255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1         250     2008093+  83  Linux
/dev/hda2             251         500     2008125   83  Linux
/dev/hda3             501         625     1004062+  82  Linux swap
/dev/hda4             626        9729    73127880    5  Extended
/dev/hda5             626         875     2008093+  83  Linux
/dev/hda6             876        9729    71119723+  83  Linux
Disk /dev/sda: 150.0 GB, 150039945216 bytes
255 heads, 63 sectors/track, 18241 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1       18242   146521088    7  HPFS/NTFS
  •  Start fdisk:
[root@cobalt ~]# fdisk /dev/sda1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 18241.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
  • Create a new DOS label. Im not sure if in my cas was needed because the hard disk had one but... Use the 'o' command
Command (m for help):o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 18241.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
  • As you can see above fdisk reported an error reading the partition table but nothis was wrong here.
  • Delete existent partitions (if necessary) and create the new one and then change the system disk ID:
# fdisk /dev/sda1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 18241.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): d
No partition is defined yet!

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-18241, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-18241, default 18241):
Using default value 18241

Command (m for help): t
Selected partition 1
Hex code (type L to list codes):83

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
  • Here I rebooted the server.
  • Create the ext3 filesystem: # mkfs.ext3 /dev/sda1
  • Now we need to mount the new hard disk to a temporary folder:
# mkdir /tmpmnt
# mount /dev/sda1 /tmpmnt
  • Copy all files from /home to /tmpmnt: # cp -axv /home/* /tmpmnt
  • Unmount the new hard disk: # umount /tmpmnt
  • Create a backup of the old /home partition (I was not able to do that part last time because an error message: Files in use):
# mkdir /oldhome
# mv /home /oldhome

# mkdir /home
# mount -t ext3 /dev/sda1 /home
  • Now we have to modify the /etc/fstab file to make the new partition automount at boot time. Just change hda6 to sda1. My file is this:
  • And the last part is to reboot!!!!!! Here you can see the result, a near 150GB home partition in a SATA hard disk!


Now it's time to check if everithing is OK, a will boot up the server in a week or two and see what happens in a 24/7 work.

IMPORTANT NOTE: During these test I found some problems with fdisk. IF fdisk returns a WARNING when you type the command 'w' (write), usually the hard disk partition is not stored on the hard disk. This is the message
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table
The new table will be used at the next reboot.
I had this problem until I was able to delete the NTFS partition with FDSIK (the firsts attempts fdisk didn't show the old partition table). Then you can check the results:
# fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 250 2008093+ 83 Linux
/dev/hda2 251 500 2008125 83 Linux
/dev/hda3 501 625 1004062+ 82 Linux swap
/dev/hda4 626 9729 73127880 5 Extended
/dev/hda5 626 875 2008093+ 83 Linux
/dev/hda6 876 9729 71119723+ 83 Linux

Disk /dev/sda: 150.0 GB, 150039945216 bytes
255 heads, 63 sectors/track, 18241 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 18241 146520801 83 Linux

3 comments:

carlos923 said...
This comment has been removed by the author.
Titox said...

Hi,
I'm using this one: http://www.priceangels.com/VIA_4-Port_SATA_and_IDE_Expansion_PCI_Card_p1659.html

Anonymous said...

Hi - I am certainly glad to discover this. Good job!