biolocal:Nodedisk

From Wiki CEINGE

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:54, 4 August 2009 (edit)
Gianluca (Talk | contribs)

← Previous diff
Current revision (13:05, 28 October 2009) (edit) (undo)
Mauro (Talk | contribs)

 
Line 26: Line 26:
,104127,L ,104127,L
EOF EOF
- /sbin/mkswap /dev/hda1; /sbin/mkswap /dev/hda2; /sbin/swapon /dev/hda1; /sbin/swapon /dev/hda2;+ /sbin/mkswap /dev/hda1; /sbin/mkswap /dev/hda2;
/sbin/mkfs -t ext3 -L scratch /dev/hda3; /bin/mount LABEL=scratch /sbin/mkfs -t ext3 -L scratch /dev/hda3; /bin/mount LABEL=scratch
fi fi
fi fi
 +/sbin/swapon /dev/hda1; /sbin/swapon /dev/hda2;
</PRE> </PRE>

Current revision

Each node should be initialized with the following partitions on the local disk:

  • swap1 - 2Gb
  • swap2 - 2Gb
  • scratch - 50Gb


The new CentOS 5 cluster installation is based on labels for disk partitioning.

A script is installed in /usr/local/sbin/build_disk.sh to create at boot time the disk partitioning if the expected partitions don't exist.

cat /usr/local/sbin/build_disk.sh

#!/bin/sh

/sbin/findfs LABEL=scratch 2>1 > /dev/null;

if [ $? -ne 0 ];
then
        /bin/mount | grep hda
        if [ $? -ne 0 ];
        then
                /sbin/sfdisk /dev/hda << EOF
0,4161,S
,4161,S
,104127,L
EOF
                /sbin/mkswap /dev/hda1; /sbin/mkswap /dev/hda2;
                /sbin/mkfs -t ext3 -L scratch /dev/hda3; /bin/mount LABEL=scratch
        fi
fi
/sbin/swapon /dev/hda1; /sbin/swapon /dev/hda2;

This script is called by rc.local and works only if the partition label "scratch" isn't found and any hda partition is already mounted.

sfdisk takes some command from the std input to create the partitions:

  • from 0 cylinder, with size 4161 cylinders, of type swap (0,4161,S)
  • from last cyl, with size 4161 cylinders, of type swap (,4161,S)
  • from last cyl, with size 104127 cylinders, of type linux (,104127,L)

Finally the partitions are created and mounted.

Note : The swap partition should always exist, otherwise the scheduler wouldn't get the node (it looks for nodes with free swap space)

Personal tools