Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Oracle Linux on a VM and I'm trying to create partitions on /dev/sda2 of size 30 gigs using fdisk utility. I made four partitions each of size 512M and they appear in the partition table. However, when i try to write (w) table to disk, i get the error as above.

Here's what i've tried so far

  • Reboot does not change anything.
  • fdisk -u -l /dev/sda2 shows the 4 created partitions (p1,p2,p3,p4), but fdisk -l doesn't.
  • kpartx -a /dev/sda2px shows failed to stat() /dev/sda2px
  • partprobe /dev/sda2 shows:

Error: Error informing the kernel about modifications to partition /dev/sda2px - invalid argument. This means Linux won't know about any changes you made to /dev/sda2p1 until you reboot -- so you shouldn't mount it or use it in any way before rebooting

Any ideas will be much appreciated. Thanks in advance.

share|improve this question
    
just to let me get it straight, you try to create partitions inside a msdos-style partition? /dev/sda2 represents already a partition on your hdd. If this is really what you want, I don't know the answer. Otherwise you maybe whish to create partitions on /dev/sda instead –  AlexTr Sep 12 '12 at 11:48
    
Yes i wanted to create the partitions on sda2. My sda has lower disk space. –  Jay Sep 12 '12 at 13:38

2 Answers 2

up vote 5 down vote accepted

Setting up partitions on other partitions isn't a supported operation. If you want to subdivide your /dev/sda2 then one option is to use LVM2 (that's Arch Linux documentation but applies everywhere).

For your example of three 512Mb:

pvcreate /dev/sda2
vgcreate TEST /dev/sda2
lvcreate -L 512M -n one TEST
lvcreate -L 512M -n two TEST
lvcreate -L 512M -n three TEST

This will give you /dev/TEST/one /dev/TEST/two and /dev/TEST/three as separate 512Mb slices, without having a partition within a partition.

share|improve this answer
    
Ah i got it now. I was actually trying to partition a volume but fdisk can only be used to partition a disk. Thank you :) –  Jay Sep 17 '12 at 2:26

You should boot the system from the gparted live cd and use it to make the changes. That would tell you if it is your OS or hardware.

share|improve this answer
    
How is gparted going to be any different from fdisk? I think the OS being on a virtual machine is the cause here –  Jay Sep 12 '12 at 13:39
    
I suggested using the live cd because it removes the possibility of there being a problem with his OS install or a package or a corrupt file or other random cause rooted in his software. –  Dave York Sep 12 '12 at 14:50

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.