Convert to LVM for the rootvg on local drive
Check the current setup
[root@lab1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 18G 2.9G 14G 18% /
tmpfs 1005M 0 1005M 0% /dev/shm
[root@lab1 ~]# fdisk -l /dev/cciss/c0d0
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 2350 18876343+ 83 Linux
/dev/cciss/c0d0p2 2351 3394 8385930 82 Linux swap / Solaris
Remove the current swap space to make room for a temporary root partition
[root@lab1 ~]# swapoff -a -v
[root@lab1 ~]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8920.
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)
Command (m for help): d
Partition number (1-4): 2
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 2350 18876343+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab1 ~]# partprobe
Make sure to leave enough room, so that you can create /boot partition on slice 1, since /boot can not be under LVM support.
[root@lab1 ~]# fdisk /dev/cciss/c0d0
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 2350 18876343+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (2351-8920, default 2351): 2371
Last cylinder or +size or +sizeM or +sizeK (2371-8920, default 8920): 4721
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab1 ~]# partprobe
Create a filesystem on the new slice, and copy the contents of slice 1 over.
[root@lab1 ~]# mke2fs -j /dev/cciss/c0d0p3
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2361760 inodes, 4721101 blocks
236055 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
145 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@lab1 ~]# mount -t ext3 /dev/cciss/c0d0p3 /mnt
[root@lab1 ~]# cd /
[root@lab1 /]# find / -xdev|cpio -pvmd /mnt
Make the new partition bootable.
[root@lab1 /]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8920.
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)
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 2350 18876343+ 83 Linux
/dev/cciss/c0d0p3 2371 4721 18884407+ 83 Linux
Command (m for help): a
Partition number (1-4): 3
Command (m for help): a
Partition number (1-4): 1
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 1 2350 18876343+ 83 Linux
/dev/cciss/c0d0p3 * 2371 4721 18884407+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab1 /]# partprobe
Edit the /mnt/etc/fstab file to point to the new partition.
[root@lab1 /]# vi /mnt/etc/fstab
[root@lab1 /]# cat /mnt/etc/fstab
/dev/cciss/c0d0p3 / ext3 defaults 1 1
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
[root@lab1 /]#
Edit the /mnt/boot/grub/grub.conf and /boot/grub/grub.conf file to point to the new partition also.
[root@lab1 /]# vi /mnt/boot/grub/grub.conf
[root@lab1 /]# cat /mnt/boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/cciss/c0d0p1
# initrd /boot/initrd-version.img
#boot=/dev/cciss/c0d0
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-92.el5 ro root=/dev/cciss/c0d0p3 pci=nommconf rhgb quiet
initrd /boot/initrd-2.6.18-92.el5.img
[root@lab1 /]# vi /boot/grub/grub.conf
[root@lab1 /]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/cciss/c0d0p1
# initrd /boot/initrd-version.img
#boot=/dev/cciss/c0d0
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-92.el5 ro root=/dev/cciss/c0d0p3 pci=nommconf rhgb quiet
initrd /boot/initrd-2.6.18-92.el5.img
Reboot the server, and it should come up on the new partition.
[root@lab1 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p3 18587892 2984316 14659356 17% /
tmpfs 1029044 0 1029044 0% /dev/shm
Remove slice 1 and create a /boot partition on slice 1, and the new root partition on slice 2.
[root@lab1 ~]# fdisk /dev/cciss/c0d0
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 1 2350 18876343+ 83 Linux
/dev/cciss/c0d0p3 * 2371 4721 18884407+ 83 Linux
Command (m for help): d
Partition number (1-4): 1
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
[root@lab1 ~]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8920.
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)
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p3 * 2371 4721 18884407+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-8920, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2370, default 2370): 20
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 1 20 160618+ 83 Linux
/dev/cciss/c0d0p3 * 2371 4721 18884407+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (21-8920, default 21): 21
Last cylinder or +size or +sizeM or +sizeK (21-2370, default 2370): 2370
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 1 20 160618+ 83 Linux
/dev/cciss/c0d0p2 21 2370 18876375 83 Linux
/dev/cciss/c0d0p3 * 2371 4721 18884407+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab1 ~]# partprobe
10. Change the partition type of 2 to LVM (8e) and make the partition 1 bootable.
[root@lab1 ~]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8920.
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)
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 1 20 160618+ 83 Linux
/dev/cciss/c0d0p2 21 2370 18876375 83 Linux
/dev/cciss/c0d0p3 * 2371 4721 18884407+ 83 Linux
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): a
Partition number (1-4): 1
Command (m for help): a
Partition number (1-4): 3
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 20 160618+ 83 Linux
/dev/cciss/c0d0p2 21 2370 18876375 8e Linux LVM
/dev/cciss/c0d0p3 2371 4721 18884407+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab1 ~]# partprobe
11. tar the contents of the original /boot dir.
[root@lab1 /]# cd /boot
[root@lab1 boot]# tar -cvf /tmp/boot.tar *
config-2.6.18-92.el5
grub/
grub/stage2
grub/fat_stage1_5
grub/ufs2_stage1_5
grub/ffs_stage1_5
grub/menu.lst
grub/jfs_stage1_5
grub/splash.xpm.gz
grub/xfs_stage1_5
grub/reiserfs_stage1_5
grub/grub.conf
grub/stage1
grub/iso9660_stage1_5
grub/device.map
grub/e2fs_stage1_5
grub/minix_stage1_5
grub/vstafs_stage1_5
initrd-2.6.18-92.el5.img
initrd-2.6.18-92.el5.img.orig
symvers-2.6.18-92.el5.gz
System.map-2.6.18-92.el5
vmlinuz-2.6.18-92.el5
12. Create a new filesystem on slice 1 , the new boot partition.
[root@lab1 /]# mke2fs -j/dev/cciss/c0d0p1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2361760 inodes, 4721101 blocks
236055 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
145 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
13. Delete everything in the original /boot filesystem on the temporary partition.
[root@lab1 mnt]# cd /boot
[root@lab1 boot]# ls
config-2.6.18-92.el5 initrd-2.6.18-92.el5.img symvers-2.6.18-92.el5.gz vmlinuz-2.6.18-92.el5
grub initrd-2.6.18-92.el5.img.orig System.map-2.6.18-92.el5
[root@lab1 boot]# rm -f -r *
14. Mount slice 1 onto /boot and untar the contents.
[root@lab1 /]# mount -t ext3 /dev/cciss/c0d0p1 /boot
[root@lab1 /]# cd /boot
[root@lab1 boot]# tar -xvf /tmp/boot.tar
config-2.6.18-92.el5
grub/
grub/minix_stage1_5
grub/jfs_stage1_5
grub/device.map
grub/splash.xpm.gz
grub/fat_stage1_5
grub/e2fs_stage1_5
grub/ffs_stage1_5
grub/xfs_stage1_5
grub/ufs2_stage1_5
grub/iso9660_stage1_5
grub/vstafs_stage1_5
grub/stage1
grub/grub.conf
grub/reiserfs_stage1_5
grub/menu.lst
grub/stage2
initrd-2.6.18-92.el5.img
initrd-2.6.18-92.el5.img.orig
symvers-2.6.18-92.el5.gz
System.map-2.6.18-92.el5
vmlinuz-2.6.18-92.el5
[root@lab1 boot]# pwd
/boot
[root@lab1 boot]# ls
config-2.6.18-92.el5 initrd-2.6.18-92.el5.img lost+found System.map-2.6.18-92.el5
grub initrd-2.6.18-92.el5.img.orig symvers-2.6.18-92.el5.gz vmlinuz-2.6.18-92.el5
15. Change /etc/fstab to point to the new /boot partition.
[root@lab1 boot]# vi /etc/fstab
[root@lab1 boot]# cat /etc/fstab
/dev/cciss/c0d0p3 / ext3 defaults 1 1
/dev/cciss/c0d0p1 /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
16. Recreate the intitrd image.
[root@lab1 ~]# mkinitrd -f /boot/initrd-2.6.18-92.el5.img `uname -r`
17. Create a new MBR for the new /boot partition.
[root@lab1 /]# grub-install /dev/cciss/c0d0
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
(hd0) /dev/cciss/c0d0
18. Remove the /boot references in the /boot/grub/grub.conf file.
[root@lab1 ~]# vi /boot/grub/grub.conf
[root@lab1 ~]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/cciss/c0d0p1
# initrd /boot/initrd-version.img
#boot=/dev/cciss/c0d0
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/cciss/c0d0p3 pci=nommconf rhgb quiet
initrd /initrd-2.6.18-92.el5.img
19. Reboot, and it will boot off the new /boot partition.
[root@lab1 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p3 18587892 2984528 14659144 17% /
/dev/cciss/c0d0p1 155543 15571 131942 11% /boot
tmpfs 1029044 0 1029044 0% /dev/shm
20. Initialize the LVM
[root@lab1 /]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “uservg” using metadata type lvm2
21. Create a physical volume on partition 2 that was created earlier.
[root@lab1 /]# pvcreate /dev/cciss/c0d0p2
Physical volume “/dev/cciss/c0d0p2″ successfully created
22. Create the root volume group on the partition just created.
[root@lab1 /]# vgcreate rootvg /dev/cciss/c0d0p2
Volume group “rootvg” successfully created
23. Create a logical volume for the new root volume group.
[root@lab1 /]# lvcreate -n lv00 –size 18G rootvg
Logical volume “lv00″ created
24. Create a filesystem on the new logical volume.
[root@lab1 /]# mke2fs -j /dev/rootvg/lv00
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2359296 inodes, 4718592 blocks
235929 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
144 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
25. Mount the new filesystem and copy the root files over.
[root@lab1 /]# mount -t ext3 /dev/rootvg/lv00 /mnt
[root@lab1 /]# cd /
[root@lab1 /]# find / -xdev | cpio -pvmd /mnt
……..
/mnt/usr/include/gnome-desktop-2.0/libgnomeui
/mnt/usr/include/gnome-desktop-2.0/libgnomeui/gnome-ditem-edit.h
/mnt/usr/include/gnome-desktop-2.0/libgnomeui/gnome-hint.h
/mnt/usr/include/mpfr.h
/mnt/usr/include/ftw.h
/mnt/usr/include/spawn.h
/mnt/lost+found
5030570 blocks
[root@lab1 /]#
26. Recreate the initrd image.
[root@lab1 /]# mkinitrd –f /boot/initrd-2.6.18-92.el5.img `uname –r`
27. Make sure the initrd image is configured for LVM.
[root@lab1 /]# cd /tmp
[root@lab1 tmp]# mkdir working-intitrd
[root@lab1 tmp]# cd working-intitrd
[root@lab1 working-intitrd]# zcat /boot/initrd-2.6.18-92.el5.img|cpio -i
17771 blocks
[root@lab1 working-intitrd]# ls bin/lvm
bin/lvm
[root@lab1 working-intitrd]# ls etc/lvm
lvm.conf
28. If the image does not LVM support it can be added this way.
[root@lab1 working-intitrd]# cp -r /etc/lvm etc/
cp: overwrite `etc/lvm/backup/rootvg’? y
cp: overwrite `etc/lvm/backup/uservg’? y
cp: overwrite `etc/lvm/archive/rootvg_00001.vg’? y
cp: overwrite `etc/lvm/archive/uservg_00000.vg’? y
cp: overwrite `etc/lvm/archive/rootvg_00000.vg’? y
cp: overwrite `etc/lvm/lvm.conf.default’? y
cp: overwrite `etc/lvm/cache/.cache’? y
cp: overwrite `etc/lvm/lvm.conf’? y
[root@lab1 working-intitrd]# pwd
/tmp/working-intitrd
[root@lab1 working-intitrd]# ls etc/lvm/
archive backup cache lvm.conf lvm.conf.default
[root@lab1 working-intitrd]# pwd
/tmp/working-intitrd
[root@lab1 working-intitrd]# find . -print | cpio -o -c |gzip -9 > /tmp/initrd-2.6.18-92.el5.img
17817 blocks
[root@lab1 working-intitrd]# cp /boot/initrd-2.6.18-92.el5.img /boot/initrd-2.6.18-92.el5.img.bak
[root@lab1 working-intitrd]# ls -l /boot/initrd-2.6.18-92.el5.img.bak /tmp/initrd-2.6.18-92.el5.img
-rw——- 1 root root 3713844 May 20 15:23 /boot/initrd-2.6.18-92.el5.img.bak
-rw-r–r– 1 root root 3716171 May 20 15:22 /tmp/initrd-2.6.18-92.el5.img
[root@lab1 working-intitrd]# cp /boot/initrd-2.6.18-92.el5.img.bak /boot/initrd-2.6.18-92.el5.img
29. Edit the /mnt/etc/fstab to reflect the new rootvg volume group
[root@lab1 /]# vi /mnt/etc/fstab
[root@lab1 /]# cat /mnt/etc/fstab
/dev/rootvg/lv00 / ext3 defaults 1 1
/dev/cciss/c0d0p1 /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
30. Edit the /boot/grub/grub.conf to point to the new rootvg
[root@lab1 /]# vi /boot/grub/grub.conf
[root@lab1 /]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/cciss/c0d0p1
# initrd /boot/initrd-version.img
#boot=/dev/cciss/c0d0
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/rootvg/lv00 pci=nommconf rhgb quiet
initrd /initrd-2.6.18-92.el5.img
31. Run grub-install to recreate the MBR.
[root@lab1 /]# grub-install /dev/cciss/c0d0
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
(hd0) /dev/cciss/c0d0
32. Reboot, and it should come up under LVM support.
[root@lab1 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rootvg-lv00
18578172 2984604 14649852 17% /
/dev/cciss/c0d0p1 155543 19214 128299 14% /boot
tmpfs 1029044 0 1029044 0% /dev/shm
33. Delete the temporary root partition 3.
[root@lab1 ~]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8920.
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)
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 20 160618+ 83 Linux
/dev/cciss/c0d0p2 21 2370 18876375 8e Linux LVM
/dev/cciss/c0d0p3 2371 4721 18884407+ 83 Linux
Command (m for help): d
Partition number (1-4): 3
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab1 ~]# partprobe
34. Create a swap partition.
[root@lab1 ~]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8920.
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)
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 20 160618+ 83 Linux
/dev/cciss/c0d0p2 21 2370 18876375 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (2371-8920, default 2371): 2371
Last cylinder or +size or +sizeM or +sizeK (2371-8920, default 8920): +8192M
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 20 160618+ 83 Linux
/dev/cciss/c0d0p2 21 2370 18876375 8e Linux LVM
/dev/cciss/c0d0p3 2371 3367 8008402+ 83 Linux
Command (m for help): t
Partition number (1-4): 82
Value out of range.
Partition number (1-4): p
Partition number (1-4): 3
Hex code (type L to list codes): 82
Changed system type of partition 3 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes
255 heads, 63 sectors/track, 8920 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 20 160618+ 83 Linux
/dev/cciss/c0d0p2 21 2370 18876375 8e Linux LVM
/dev/cciss/c0d0p3 2371 3367 8008402+ 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab1 ~]# partprobe
35. Create swap space on the partition.
[root@lab1 ~]# mkswap /dev/cciss/c0d0p3
Setting up swapspace version 1, size = 8200597 kB
[root@lab1 ~]# vi /etc/fstab
[root@lab1 ~]# cat /etc/fstab
/dev/rootvg/lv00 / ext3 defaults 1 1
/dev/cciss/c0d0p1 /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/cciss/c0d0p3 swap swap defaults 0 0
[root@lab1 ~]# mount -a
[root@lab1 ~]# swapon -a
[root@lab1 ~]# swapon -s
Filename Type Size Used Priority
/dev/cciss/c0d0p3 partition 8008392 0 -1
35. Reboot and make sure everything comes up okay.
I’ve been in the IT industry for over 15 years, and I am currently a System Administrator specializing in AIX, Solaris, and Redhat.
Anthony Cicone
www.agccomputerservices.com
July 20th, 2010 by in Smart Night Vision Articles | No Comments