LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-18-2009, 10:20 AM   #1
ascfu
LQ Newbie
 
Registered: Nov 2009
Posts: 18

Rep: Reputation: 0
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 :-)
 
Old 11-18-2009, 01:08 PM   #2
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Back Up (And Restore) LVM Partitions With LVM Snapshots LXer Syndicated Linux News 0 04-17-2007 11:16 AM
Resizing Swap in LVM on Fedora 6 tnine9 Fedora 2 03-03-2007 12:12 PM
how do I add partitions to drives that have Logical Volume (LVM) partitions? The MJ Linux - Software 5 08-17-2006 06:15 PM
How to increase swap size in LVM? Akhran Debian 1 04-04-2006 09:47 AM
3 issues: Making swap, fixing partitions, changing ownership of mounted filesystem. Dunedain Linux - Newbie 2 01-27-2004 03:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration