Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to keep the following layout same in every installation on the identical servers:

dm-0 /dev/VolGroup00/LogVol00
dm-1 /dev/VolGroup00/LogVol01
dm-2 /dev/VolGroup00/LogVol02
dm-3 /dev/VolGroup00/LogVol03
dm-4 /dev/VolGroup00/LogVol04
dm-5 /dev/VolGroup00/LogVol05
dm-6 /dev/VolGroup00/LogVol06

But in every RedHat installation it creates the volumes and format the filesystem in different order. Such as;

dm-0 /dev/VolGroup00/LogVol0
dm-1 /dev/VolGroup00/LogVol02
dm-2 /dev/VolGroup00/LogVol03
dm-3 /dev/VolGroup00/LogVol04
dm-4 /dev/VolGroup00/LogVol05
dm-5 /dev/VolGroup00/LogVol06
dm-6 /dev/VolGroup00/LogVol01

The problem is I add the volume groups in the same sequence but it changes it during creation. Could you explain me why this happens and how can I keep the partition tables of all servers identical?

share|improve this question
    
Image them from a single master? –  Jeff Ferland Feb 1 '12 at 22:38
1  
If you find yourself building many alike systems, you should use something like Kickstart to provision the systems. This question makes it sound like you are using the bootable install media each time. –  Kyle Smith Feb 1 '12 at 23:14
2  
Why is this a problem? From docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/… "/dev/dm-N nodes should never be used in scripts to access the device since the N number is assigned dynamically and changes with the sequence of how devices are activated. Therefore, true names in the /dev/mapper directory should be used." –  Mark Wagner Feb 1 '12 at 23:24
    
I agree with @embobo. You should either use /dev/mapper names or UUIDs (obtained from blkid). –  James O'Gorman Feb 1 '12 at 23:31
1  
I have seen the dm-? device mappings be different between reboots of the same server. You should not depend on those values ever. If you have some software that is looking at only /proc/partitions you probably need to work on fixing/replacing that software. –  Zoredache Feb 2 '12 at 0:13

2 Answers 2

As Mark Wagner explained, /dev-dm? devices are dynamically assigned at boot time by the device mapper, and should never be used as the source of mount points whether it's mounted manually or via /etc/fstab. Instead, use /dev/volume_group/logical_volume or /dev/mapper/volume_group-logical_volume, or the UUID obtained with the blkid command (or the lvdisplay command, which shows it too). You can man those commands for more details if you are not familiar with the options.

To keep the same partitioning setup across all your servers, your best bet would be to create Kickstart files and to install your servers with it. Unfortunately, the system-config-kickstart GUI application does not allow you to configure logical volume groups, so you'll have to first save it and then manually edit the .cfg file to setup your disks.

To install with a Kickstart file, you need to edit the kernel parameters at the grub menu and add ks=URL_TO_YOUR_KICKSTART_FILE. Example: ks=http://myserver.example.com/kickstart/mykickstartfile.cfg

That implies you need to make the kickstart file available online through one of the supported network protocols (http, ftp, nfs, cifs, etc...)

Here's an example of the LVM partitioning I've used on a small VM of mine:

# Disk partitioning information
part /boot --asprimary --fstype="ext4" --size=200
part pv.01 --size=1 --grow
volgroup vg0 pv.01
logvol swap --vgname=vg0 --name=swap --fstype=swap --recommended
logvol /home --vgname=vg0 --name=home --size=512 --fstype ext4
logvol /tmp --vgname=vg0 --name=tmp --size=1024 --fstype ext4
logvol / --vgname=vg0 --name=root --size=1 --grow --fstype ext4

Here's a good reference for Kickstart from the official Red Hat docs site:

32.4. Kickstart Options

Of course, you can always manually customize the disk partitions during the interactive install of the server and just do the same thing on all server (so document it somewhere). Hope that helps!

share|improve this answer

RedHat has its own logic regarding partitioning and where to place what.

If you want full control, use the %pre section of Kickstart to set up the partition table yourselv, create VGs and LVs.

For partitioning use parted, for VG/LV-actions use the lvs command (like lvs pvcreate ...).

You can use the kickstart-command clearpart (before the %pre-section) to clear the partition table.

With parted first create a label, then the partitions.

Once you are through creating your LVs in your desired order, you can use the standard kickstart syntax to place filesystems on them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.