Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using parted command to create LVM partitions Post 302935017 by John K on Thursday 12th of February 2015 11:17:12 AM
Old 02-12-2015
Using parted command to create LVM partitions

Oracle Linux 6.6

To create Physical Volumes for Volume groups (LVM) , the disk need to be partitioned to LVM type ie. 'Linux LVM' type . In fdisk , this can done by choosing 8e when prompted for partition type.

Since it is easy to script (non-interactive), I use parted command rather than fdisk to create partitions


For creating standard partitions, I use the below 2 non-interactive steps in our scripts

Step1. Creating the partition table for the device
Code:
parted -s  /dev/sda  mklabel msdos

For gpt, I use
Code:
parted -s  /dev/sda  mklabel gpt

Step2. create a primary partition that starts after 1mb (to ensure proper alignement)

parted -s /dev/sda unit mib mkpart primary 1 100%



From the below link , I gathered that partition can be set to LVM type interactively using set [partition number] lvm on
But, how can I incorporate this into step2 (non-interactive) shown above ?
How to create LVM Partition in Linux
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Problem setting up raw partitions on SUSE v8.0 using LVM on Oracle 8.1.7.URGENT!!!!!!

Hi all! Working on Oracle v8.1.7.0.0 with OS  as Suse v8.0 Linux. I had created LVM,linked raw devices to LVM as below: # for binding raw devices raw /dev/raw/raw1 /dev/oracle/sam_raw_system_251m raw /dev/raw/raw2 /dev/oracle/sam_raw_users_26m raw /dev/raw/raw3... (2 Replies)
Discussion started by: Amitstora
2 Replies

2. UNIX for Advanced & Expert Users

Is there a tutorial on how to create RAID 1 on top of lvm?

Hi, there are tons of RAID1 tutorials, but none of them deal with lvm. The problem is that I want to expand my current lvm partition over RAID1 rather than creating a new lvm partition after RAID1 is created. My master harddrive has lvm partition. I'm wondering how to create a RAID1 image of... (1 Reply)
Discussion started by: onthetopo
1 Replies

3. Solaris

How to create new partitions in solaris,from the raw disk?

Hi all, I would like to know how to make new partitions.... I currently have allocated 60G for various slices (I have totally used 4 out of 7 available slices... I am running only solaris on my box. My plan is to have entire disk dedicated to solaris and run other OS from within... (19 Replies)
Discussion started by: wrapster
19 Replies

4. SCO

create disk partitions in sco

i have one 9 gb hdd having root 2 gb fs now i want to create additional 1gb fs in remaining space unix partation created in entired 9gb thanx (1 Reply)
Discussion started by: sudhir69
1 Replies

5. Solaris

How to create more partitions in x86 Solaris?

Friends, I have an 80 GB IDE hard disk on which I installed Solaris 10, the layout being Total size of the partition being 30 GB c0d0s0 = / directory = 15 GB c0d0s1 = swap file system = 1 GB c0d0s7 = /export/home directory = 1GB c0d0s8= boot c0d0s9 = alternates ... (3 Replies)
Discussion started by: saagar
3 Replies

6. Red Hat

create /var lvm during install

Hi All, How do I create /var as LVM type during install? I want my new OS to have /var as LVM so that I could extend it on the fly. Thanks for any comment you may add. (2 Replies)
Discussion started by: itik
2 Replies

7. 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

8. Filesystems, Disks and Memory

Partition management: lvm? fdisk? parted? (on RAID)

Hello, I have a RHEL system with two 500GB hard drives in RAID 1 (I think hardware, but not 100% certain - any way to tell?). It looks like it was just set up in default configuration with a small boot partition and one huge partition for the rest, which composes a LVM volume. I want... (1 Reply)
Discussion started by: builder88
1 Replies

9. Solaris

Create new partitions

Hello, Can someone tell me why should i do to resolve this problem? I cant creat the news partitions!! # /etc/init.d/volmgt start volume management starting. # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 1955 alt 2 hd 255 sec 63> ... (5 Replies)
Discussion started by: herbich1985
5 Replies

10. UNIX for Dummies Questions & Answers

How to create LVM snapshots?

Please suggest me how do I create LVM snapshots in linux. Best regards, Vishal (5 Replies)
Discussion started by: admin_db
5 Replies
PARTED(8)							 GNU Parted Manual							 PARTED(8)

NAME
GNU Parted - a partition manipulation program SYNOPSIS
parted [options] [device [command [options...]...]] DESCRIPTION
This manual page documents briefly the parted command. Complete documentation is distributed with the package in GNU Info format; see below. parted is a disk partitioning and partition resizing program. It allows you to create, destroy, resize, move and copy ext2, ext3, linux- swap, FAT and FAT32 partitions. This is useful for creating space for new operating systems, reorganising disk usage, and copying data to new hard disks. OPTIONS
-h, --help displays a help message. -i, --interactive where necessary, prompts for user intervention. -s, --script never prompts for user intervention. -v, --version displays the version. COMMANDS
[device] The block device to partition. [command [options]] Specifies a command to parted. If no command is given, parted will give you a command prompt. Commands are: check partition does a simple check on partition. cp [source-device] source dest copies the source partition's filesystem on source-device (or the current device if no other device was specified) to the dest partition on the current device. help [command] prints general help, or help on command if specified. mkfs partition fs-type make a filesystem fs-type on partition. fs-type can be one of "FAT", "ext2" or "linux-swap". mklabel label-type Creates a new disklabel (partition table) of label-type. label-type should be one of "bsd", "gpt", "loop", "mac", "mips", "msdos", "pc98" or "sun". mkpart part-type [fs-type] start end make a part-type partition with filesystem fs-type (if specified), beginning at start and ending at end (in megabytes). part-type should be one of "primary", "logical" or "extended" mkpartfs part-type fs-type start end make a part-type partition with filesystem fs-type beginning at start and ending at end (in megabytes) move partition start end move partition to start at start and end at end. Note: move never changes the minor number name partition name set the name of partition to name. This option works only on Mac and PC98 disklabels. The name can be placed in quotes, if necessary print displays the partition table quit exits parted resize partition start end resize the filesystem on partition to start at start and end at end megabytes rm partition deletes partition select device choose device as the current device to edit. device should usually be a Linux hard disk device, but it can be a partition, software raid device or a LVM logical volume if that is necessary set partition flag state change the state of the flag on partition to state. Flags supported are: "boot", "root", "swap", "hidden", "raid", "lvm" and "lba". state should be either "on" or "off" REPORTING BUGS
Report bugs to <bug-parted@gnu.org> SEE ALSO
fdisk(8), mkfs(8), The parted program is documented fully in the GNU partitioning software manual available via the Info system. AUTHOR
This manual page was written by Timshel Knoll <timshel@debian.org>, for the Debian GNU/Linux system (but may be used by others). parted 18 Mar, 2002 PARTED(8)
All times are GMT -4. The time now is 01:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy