Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Question about lvm file creation Post 302925865 by ongoto on Wednesday 19th of November 2014 07:47:22 PM
Old 11-19-2014
Hi stew
Code:
# Generate a list of device names that exist on your machine.
disk_list=$(ls /dev/sd[b-z])
for disk in $disk_list
do
# Avoid pvcreate risk!!
echo pvcreat $disk
done

This will generate a list of device names based on devices present on your machine, and then create the physical volumes if you remove 'echo '. Be sure of what you are doing! You can always remove volumes with pvremove if you mess up but your data on those drives will be gone!
Quote:
So what my understanding is first it is checking the disk under /dev sdb,sdc,sdd,...sdz whether 25 disk are existing
if not then its creating the 25 physical volume.
No. If they DO exist the volumes will be created. pvcreate will fail if the devices are not present.
Code:
#!/bin/ksh
disk_list=$(ls /etc/mylocal/ab[a-c])
...
...

This code is pointless! Why have two identical lists? /etc/mylocal is where the disk names would come from, not where they are going.

Not sure where you got this script, but you shouldn't use it! Be very picky about which drives/partitions you use for an LVM and make sure you don't have important data on them!

Last edited by ongoto; 11-19-2014 at 09:15 PM.. Reason: added caveat
 

10 More Discussions You Might Find Interesting

1. Solaris

DiskSuite 4.2.1 Database creation question

I'm trying to figure out how to simply create a 500Gb ufs file system named /rec using DiskSuite 4.2.1 on a Solaris 8 platform via command line using two 250Gb partitions on two different disks. Does anyone know what the proper command string and options are to perform this task? Would I use the... (2 Replies)
Discussion started by: ruger14
2 Replies

2. Programming

Question on creation of Thread pool

dear sir/madam presently i am in a process of creating a multithread pool using clone() system call in unix with c programming. i am facing some problem ie., i am able create multithread pool and able to keep all the threads in wait state,but when i call kill (afunction revoke a... (6 Replies)
Discussion started by: Radha
6 Replies

3. Linux

LVM snapshot question

Hi All, I am planning to do a LVM replicate to another server. Example : server1.foo.com has / , /boot , swap and few LVM partitions. All are in /dev/sda disk of size 80GB. /dev/sda5 is a LVM partition which has only one vg00 and it has 2 LV's (/var and /usr) and a SAN storage connected to... (0 Replies)
Discussion started by: rakrhn
0 Replies

4. Filesystems, Disks and Memory

LVM snapshot question

Hi All, I am planning to do a LVM replicate to another server. Example : server1.foo.com has / , /boot , swap and few LVM partitions. All are in /dev/sda disk of size 80GB. /dev/sda5 is a LVM partition which has only one vg00 and it has 2 LV's (/var and /usr) and a SAN storage connected to... (0 Replies)
Discussion started by: rakrhn
0 Replies

5. HP-UX

How to reduce LVM to create another LVM

Hi, I'm new to HP-UX. I have LVM on /var with 92Gig. I would like to reduce it to create another LVM for Oracle client with 800 meg or so. How to do it. I'm running 11.iv3 Thanks (4 Replies)
Discussion started by: lamoul
4 Replies

6. Red Hat

LVM question

Hi all; I have a quick question about LVM. 2.6.18-92.1.18.el5 Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 5.3 (Tikanga) Release: 5.3 Codename: Tikanga I was going through /etc/lvm.conf and I am not clear with lvm meta... (0 Replies)
Discussion started by: maverick_here
0 Replies

7. Red Hat

SAN/LVM question

Hey everyone. I am working on designing a logging solution for a deployment we have going out in a few months. Right now we have a single storage head end, connected via fibre to a SAN. Basically the plan is to create a number of smaller LUNs on the SAN, and then use LVM2 to handle concatenating... (5 Replies)
Discussion started by: msarro
5 Replies

8. UNIX for Dummies Questions & Answers

Linux LVM Question

I've three partitions on /dev/sda: sda1, sda2 sda3. There is FREE space between sda2 and sda3 and sda3 ends on the last sector. sda2 and sda3 have the same number of sectors allocated and so are the exact same size. /dev/sda2 is already part of the VG VolGroup. However, what puzzles me is that... (0 Replies)
Discussion started by: Devyn
0 Replies

9. UNIX for Dummies Questions & Answers

How to convert non LVM root partition to LVM?

Hi Guys, I m using redhat 6, I have installed root partition as non-LVM . Is there any way i can convert it to LVM? (1 Reply)
Discussion started by: pinga123
1 Replies

10. UNIX for Advanced & Expert Users

LVM mirror creation problem

I apologize is this isn't an appropriate post for the 'advanced' UNIX, so please let me know if I should post this under UNIX for dummies, but here's my problem in a nutshell: I having problems creating a mirrored logical volume. I have created two new physical volumes ... (2 Replies)
Discussion started by: simonrodan
2 Replies
PVCHANGE(8)						      System Manager's Manual						       PVCHANGE(8)

NAME
pvchange - change attributes of a physical volume SYNOPSIS
pvchange [--addtag Tag] [-A|--autobackup y|n] [-d|--debug] [-f|--force] [--deltag Tag] [--metadataignore y|n] [-h|-?|--help] [-t|--test] [-v|--verbose] [-a|--all] [-x|--allocatable y|n] [-u|--uuid] [PhysicalVolumePath...] DESCRIPTION
pvchange allows you to change the allocation permissions of one or more physical volumes. OPTIONS
See lvm for common options. -a, --all If PhysicalVolumePath is not specified on the command line all physical volumes are searched for and used. --metadataignore y|n Ignore or un-ignore metadata areas on this physical volume. If metadata areas on a physical volume are ignored, LVM will not not store metadata in the metadata areas present on this Physical Volume. -u, --uuid Generate new random UUID for specified physical volumes. -x, --allocatable y|n Enable or disable allocation of physical extents on this physical volume. Example "pvchange -x n /dev/sdk1" disallows the allocation of physical extents on this physical volume (possibly because of disk errors, or because it will be removed after freeing it. SEE ALSO
lvm(8), pvcreate(8) Sistina Software UK LVM TOOLS 2.02.95(2) (2012-03-06) PVCHANGE(8)
All times are GMT -4. The time now is 04:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy