5

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.

2
  • 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
    – user118305
    Sep 12, 2012 at 11:48
  • Yes i wanted to create the partitions on sda2. My sda has lower disk space.
    – Jay
    Sep 12, 2012 at 13:38

2 Answers 2

4

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.

1
  • 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, 2012 at 2:26
1

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.

2
  • 1
    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, 2012 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.
    – d4v3y0rk
    Sep 12, 2012 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .