Manual LVM2 config


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Manual LVM2 config
# 1  
Old 10-09-2009
Manual LVM2 config

I've got two Ubuntu 9.04 LTSP servers, lts1 and lts2, which have been setup differently by different people. Each server has 4+ scsi disks that I'd like to setup with LVM and SW_Raid-1 (for mirroring) on disks 0-3 on each.

Abbreviated:
Code:
root@lts1:~# lshw -C disk                         
  *-cdrom                                                      
       ...
  *-disk:0                                                     
       description: SCSI Disk                                  
       logical name: /dev/sda                                  
       size: 8683MiB (9105MB)
  *-disk:1
       description: SCSI Disk
       logical name: /dev/sdb
       size: 8683MiB (9105MB)
  *-disk:2
       description: SCSI Disk
       logical name: /dev/sdc
       size: 16GiB (18GB)
  *-disk:3
       description: SCSI Disk
       logical name: /dev/sdd
       size: 8683MiB (9105MB)

Abbreviated:
Code:
root@lts2:~# lshw -C disk           
  *-cdrom                 
       ...
  *-disk:0                                       
       description: SCSI Disk                    
       logical name: /dev/sda                    
       size: 8683MiB (9105MB)                    
  *-disk:1                                       
       description: SCSI Disk                    
       logical name: /dev/sdb                    
       size: 8683MiB (9105MB)                    
  *-disk:2                                       
       description: SCSI Disk                    
       logical name: /dev/sdc
       size: 8683MiB (9105MB)
  *-disk:3
       description: SCSI Disk
       logical name: /dev/sdd
       size: 8683MiB (9105MB)
  *-disk:4
       description: SCSI Disk
       logical name: /dev/sde
       size: 16GiB (18GB)

The first part of this problem is that lts2 server was setup with LVM on /dev/sda during install, and the lts1 server wasn't, so I need to emulate the LVM configuration of lts2 on lts1. So, first I need to move the standard install off of lts1:/dev/sda to /dev/sdd, so that I can begin a new LVM configuration on lts1:/dev/sda.

Is "dd if=/dev/sda of=/dev/sdd" a sufficient copy?

The LVM install on lts2 had created:
Code:
root@lts2:~# ls -l /dev/lts2
total 0
lrwxrwxrwx 1 root root 21 2009-09-11 15:02 root -> /dev/mapper/lts2-root
lrwxrwxrwx 1 root root 23 2009-09-11 15:02 swap_1 -> /dev/mapper/lts2-swap_1

Were these links/nodes automatically created by "vgscan --mknodes"?

I'd like to end up with the same for lts1:
Code:
root@lts1:~# ls -l /dev/lts1
total 0
lrwxrwxrwx 1 root root 21 2009-09-11 15:02 root -> /dev/mapper/lts1-root
lrwxrwxrwx 1 root root 23 2009-09-11 15:02 swap_1 -> /dev/mapper/lts1-swap_1

That's enough to start, I think.
# 2  
Old 10-21-2009
re: manual lvm2 config

Don't get me wrong - what you are looking to do here is possible, however it involves a lot of mangling that may not be obvious at first. Honestly, if at all possible it is simpler to back up the data, wipe and re-install the system the way you want it to be. I've done this type of thing on Fedora based systems and it isn't pretty.

Besides just moving the data around, you'll have to reconfigure grub to find the new location of the root partition (it will be different inside an lvm) and you'll also have to create a new initrd file with LVM/RAID modules and information. Since the system wasn't installed with lvm & raid originally it won't have lvm & raid modules in the current initrd.

You'll need to change the /etc/fstab file for all the filesystems to change them to LVM - though if you are careful to re-create the filesystem labels properly that may work ok for some of them (if they are using filesystem labels to recognize the FS at least)

You will probably also need to boot the system from a rescue CD or liveCD to do the data-migration between disks. I don't know if you even CAN do a clean copy of sda if that is where your OS is running from. I would boot from a CD, create a filesystem on /dev/sdd, and use cpio to make cpio archives of the filesystems on /dev/sda, then wipe /dev/sda and create the LVM partitions/filesystems and use cpio to put the data back. Actually - if you're booting from a CD anyway, just swap sda and sdd. Saves you the time of copying all the data since you're just going to copy it back anyway.

But be prepared to do a lot of mangling with grub and initrd files to be able to get the system to boot again.

Oh - and I also noticed your disks are different sizes - don't forget that software RAID requires the raided partitions to be the same size.

As I said at the start - it's probably simpler/faster to just back up the system and re-install it.

Cheers,
Anthony

Last edited by icefalcon; 10-21-2009 at 11:03 AM..
# 3  
Old 10-21-2009
Thanks. I reinstalled.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Red Hat

Apache virtual host config vs global config problem

Hi folks, I am trying to configure Apache webserver and also a virtual host inside this webserver. For Global server config: /var/www/html/index.html For virtual host config: /var/www/virtual/index.html Both client10 & www10 are pointing to 192.168.122.10 IP address. BUT, MY... (1 Reply)
Discussion started by: freebird8z
1 Replies

2. SuSE

LVM2: Are these physical volumes free?

Hi, I am trying to find some free space on this system. The following physical volumes look empty. Would you please help me confirm this? What other commands can I use to find free space? Thank you in advance! # pvdisplay -m /dev/block/104:2 --- Physical volume --- PV Name ... (3 Replies)
Discussion started by: aixlover
3 Replies

3. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

4. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

5. Shell Programming and Scripting

Exiting a manual

I'm sure it's really easy, but I have searched on Google and on the forums and haven't found anything. For instance, if I open the grep manual (man grep), I can't close it. I've tried ctrl+c, ctrl+x, scrolling to the bottom of the manual. How can I exit the manual without closing the shell? ... (8 Replies)
Discussion started by: dennis89
8 Replies

6. Shell Programming and Scripting

Need help with a manual task

I have an ASCII file that I receive on a monthly bases that is fixed length. I break the file into separate files based on a 5 character numerical sequence. I have 20 different sequences I have to find. the input file looks something like this xy-ins 2008yuthnrlsinrthsntwilgrha33260001... (4 Replies)
Discussion started by: jcalisi
4 Replies

7. Solaris

Sun Solaris and LVM2

It's possible ? Install LVM on Sun Solaris 10 ? (3 Replies)
Discussion started by: jess_t03
3 Replies

8. UNIX for Dummies Questions & Answers

No manual entry for

I don't seem to be able to get man pages up for any command. When I try the "No manual entry for..." message is displayed. When checking my $MANPATH variable I get the following /opt/SUNconn/man: However, when I check this directory it doesn't exist. Searching for any man directories results... (3 Replies)
Discussion started by: FattyLumpkin
3 Replies
Login or Register to Ask a Question