Re-reading the partition table failed with error 22: invalid argument

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

2 Answers

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

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like