LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   changing swap and LVM partitions in CentOS (https://www.linuxquestions.org/questions/linux-general-1/changing-swap-and-lvm-partitions-in-centos-769972/)

ascfu 11-18-2009 10:20 AM

changing swap and LVM partitions in CentOS
 
I am setting up a number of workstations with CentOS.
I have installed all the software (and its actually being used by someone) on a set up with the following partitions:

Code:

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63    20482874    10241406    7  HPFS/NTFS
/dev/sda2        20482875    21511034      514080  83  Linux
/dev/sda3        21511035    54283634    16386300  82  Linux swap / Solaris
/dev/sda4        54283635  1953520064  949618215    5  Extended
/dev/sda5        54283698  1953520064  949618183+  8e  Linux LVM

I have since set up another machine (having read a bit more documentation about swap partitions) as follows:

Code:

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63    20482874    10241406    7  HPFS/NTFS
/dev/sda2        20482875    21511034      514080  83  Linux
/dev/sda3        21511035  1924169309  951329137+  8e  Linux LVM
/dev/sda4      1924169310  1953520064    14675377+  5  Extended
/dev/sda5      1924169373  1928362274    2096451  82  Linux swap / Solaris
/dev/sda6      1928362338  1932555239    2096451  82  Linux swap / Solaris
/dev/sda7      1932555303  1936748204    2096451  82  Linux swap / Solaris
/dev/sda8      1936748268  1940941169    2096451  82  Linux swap / Solaris
/dev/sda9      1940941233  1945134134    2096451  82  Linux swap / Solaris
/dev/sda10    1945134198  1949327099    2096451  82  Linux swap / Solaris
/dev/sda11    1949327163  1953520064    2096451  82  Linux swap / Solaris

On a few basic benchmarking tests, it performs vastly better. Any way I can change the first machine to have the same partitions as the second, without a complete re-install, or is it just rediculously complicated...?

Thanks :-)

phil.d.g 11-18-2009 01:08 PM

It's relatively simple to do.

Use a livecd and boot off it. Mount your root partition as /mnt/os and mount any other partitions such as /boot or /home underneath that. Tar up and store on an external hard drive or other computer.

Next, umount the partitions, repartition and mount the new layout. Untar onto the new hierarchy.

Mount using --bind /dev /proc and /sys to /mnt/os/{dev,proc,sys

Chroot into /mnt/os

Alter /etc/fstab and /boot/grub/menu.lst to suit and reinstall grub to the mbr.

umount everything, and reboot.


All times are GMT -5. The time now is 03:07 AM.