The new RAID array will act as a data drive for the new system. To do this I’m going to mount it as /home. There are lots of options here – you could create a /data directory and map to that instead, but my preference is a combination of functional and user accounts in /home for all program and user data. Mounting the drive will involve editing fstab again – so a final performance tweak will be made too. Note that potentially if you lose power this tweak will mean that you may lose a few seconds of data.
First edit the fstab file. Note that we are adding the data=writeback to both the system and the new data drive – so an addition to the system drive line, and a new line underneath to mount /home. So fstab should end up like:
/dev/VolGroup00/LogVol00 / ext3 defaults,noatime,nodiratime,data=writeback 1 1
/dev/raiddata/lvm0 /home ext3 defaults,noatime,nodiratime,data=writeback 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
In order to use the data writeback option successfully we also need to change the grub (bootloader) options. To do this edit the /boot/grub/menu.lst and add a writeback option. The menu.lst file will look like this:
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-128.el5) root (hd0,0) kernel /vmlinuz-2.6.18-128.el5 ro quiet splash rootflags=data=writeback root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-128.el5.img
After editing the file you need to update the config:
[root@tranquilpc grub]# grub-install /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install’.
# this device map was generated by anaconda
Finally tunefs needs to be run on the two drives. Note that not doing this will probably mean that your filesystem will be mounted read only on a reboot.
[root@tranquilpc home]# tune2fs -o journal_data_writeback /dev/mapper/VolGroup00-LogVol00
tune2fs 1.39 (29-May-2006)
[root@tranquilpc home]# tune2fs -o journal_data_writeback /dev/mapper/raiddata-lvm0
tune2fs 1.39 (29-May-2006)
At this point when you reboot all should be good. To reboot you can either power off and on, or do:
[root@tranquilpc home]# shutdown -r now
After a reboot you should see everything ok with mount -l, or df -k.
[root@tranquilpc home]# mount -l
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,noatime,nodiratime,data=writeback)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/raiddata-lvm0 on /home type ext3 (rw,noatime,nodiratime,data=writeback)
/dev/sda1 on /boot type ext3 (rw) [/boot]
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
[root@tranquilpc home]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
33740528 1024848 30974064 4% /
961428808 204572 961224236 1% /home
/dev/sda1 101086 12015 83852 13% /boot
tmpfs 1032840 0 1032840 0% /dev/shm