Operating System - Linux
1748255 Members
3804 Online
108760 Solutions
New Discussion юеВ

Re: fdisk to create LINUX partitions

 
SOLVED
Go to solution
Ravi S. Banda
Regular Advisor

fdisk to create LINUX partitions

Hi,
Would it be possible or recommended to use fdisk on a disk device that's already being used by LVM (VGs, LVs etc.)? I still have 177.97 GB free in the PV /dev/cciss/c0d0p2.

Or am I in the danger of overwriting the OS and the filesystem and/or boot partition?

I need to create partitions using fdisk to use them for ASMLIB of Oracle 11g. I don't have HBA drivers installed to connect to our existing SANs or any additional disks to create additional devices.

The verify of fdisk shows 1757398544 unallocated sectors.

Print shows Disk /dev/cciss/c0d0p2: 899.7 GB, 899788055040 bytes
255 heads, 32 sectors/track, 215367 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes.

Thanks!
4 REPLIES 4
Ragu_3
Trusted Contributor

Re: fdisk to create LINUX partitions

>> Would it be possible or recommended to use fdisk on a disk device
>> that's already being used by LVM

Fdisk should not be used on LVM physical or logical volume groups, it has to be used before you vgcreate.

Instead of fdisk you should move over to using 'gnu parted', even then it is used before vgcreate.

LVM is a layer over the fdisk/parted sliced up partitions.
Debian GNU/Linux for the Enterprise! Ask HP ...
Matti_Kurkela
Honored Contributor
Solution

Re: fdisk to create LINUX partitions

/dev/cciss/c0d0p2 indicates partition 2 of disk c0d0, so your LVM PV is apparently a fdisk-style partition already.

If this is a system disk, then /dev/cciss/c0d0p1 is probably the /boot filesystem, which must be a regular fdisk-style partition so that BIOS and GRUB can understand it.

What does "fdisk -l /dev/cciss/c0d0" show?

Trying to partition /dev/cciss/c0d0p2 with fdisk would damage your LVM PV.

However, you *can* use "pvresize --setphysicalvolumesize xxG /dev/cciss/c0d0p2" to shrink the LVM PV to xx gigabytes, then use "fdisk /dev/cciss/c0d0" to shrink the partition to the same size (or to slightly greater size, just to be safe).

After that, you can create new partitions with "fdisk /dev/cciss/c0d0" using the now-free space. The new partitions would be c0d0p3 or greater.

It's also possible to use LVM logical volumes for ASM. Google found this discussion in the Oracle forums:

http://forums.oracle.com/forums/thread.jspa?messageID=3384186

(I don't have access to Metalink at the moment, but I think the Metalink reference at the last post of the above-mentioned thread might be useful.)

MK
MK
Ravi S. Banda
Regular Advisor

Re: fdisk to create LINUX partitions

MK,
1) You're right on partition2 and partition1.
I used on /dev/cciss/c0d0 - you're right - it didn't let me create a 3rd partition (because there are no allotted slots).
I did NOT go with using fdisk on p2 as it will damage it, like you said.

2) What does "fdisk -l /dev/cciss/c0d0" show?
Ravi: it shows both the partitions like I said above.

3) Trying to partition /dev/cciss/c0d0p2 with fdisk would damage your LVM PV.
Ravi - didn't partition with p2.

4) However, you *can* use "pvresize --setphysicalvolumesize xxG /dev/cciss/c0d0p2" to shrink the LVM PV to xx gigabytes, then use "fdisk /dev/cciss/c0d0" to shrink the partition to the same size (or to slightly greater size, just to be safe).
Ravi - this I didn't know as I wasn't comfortable shrinking pv (less risk), and partition (more risky with cylinders/headers and all). Anymore documentation on shrinking partition using 'fdisk'?

5)After that, you can create new partitions with "fdisk /dev/cciss/c0d0" using the now-free space. The new partitions would be c0d0p3 or greater.
Ravi - same as 4) above.

6) It's also possible to use LVM logical volumes for ASM. Google found this discussion in the Oracle forums:
Ravi: I have tried this in the past with little success. With Oracle 11gR2, it seems like it is much better - with oracleasm and all. Initially, it failed, but with right permissions on the LVOLs, I was able to 'createdisk' and create datagroup in ASM using off of LVOLASM (that is basically a LVOL).

Points assigned.
Thanks!
Ravi.
Matti_Kurkela
Honored Contributor

Re: fdisk to create LINUX partitions

Ok, looks like your problem is solved.
Please let me explain the source of my confusion.

In the original message you said:
> Print shows Disk /dev/cciss/c0d0p2: 899.7 GB, 899788055040 bytes
> 255 heads, 32 sectors/track, 215367 cylinders
> Units = cylinders of 8160 * 512 = 4177920 bytes.

This is only the top three lines of a "fdisk -l" output. The actual list of partitions is not there. Also, "Disk /dev/cciss/c0d0p2" suggests something is not quite right...

I guess you copy/pasted the wrong output by mistake. Don't worry, it happens to the best of us :)

MK
MK