VMware Cloud Community
LudovicLerat
Contributor
Contributor

partedUtil : Error: Read-only file system during write

Hi,

Plateform : One machine with 8 hard drives in Raid 5 => 1 LUN of 2To, vSphere 5.0.0 Upd1


We want to deploy a Oracle RAC 10g. For this purpose we follow this document : https://www.vmware.com/files/pdf/solutions/oracle/Oracle_Databases_VMware_RAC_Deployment_Guide.pdf

In the prerequisites, we need to have several datastores.


In the vSphere client, we can't create several datastores : only one of 2To (default) or, if we delete the default one, we can create a smaller, but the remaining space isn't available anymore.

So we decide to create manually the several datastores, by following this document : Manually creating a VMFS volume using vmkfstools -C (1009829)

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100982...

The command we want to do is this one :

vmkfstools -C vmfs5 -b 1m -S NewDatastore /vmfs/devices/disks/naa.60901234567890123456789012345678:1


In this document, we have to make a partition for each datastore we want to create.


Layout of the disks

~ # ls -lah /vmfs/devices/disks/

drwxr-xr-x    1 root     root          512 Jun 26 12:13 .

drwxr-xr-x    1 root     root          512 Jun 26 12:13 ..

-rw-------    1 root     root         1.9T Jun 26 12:13 naa.600605b00581fb6018c09f852081693a

-rw-------    1 root     root         4.0M Jun 26 12:13 naa.600605b00581fb6018c09f852081693a:1

-rw-------    1 root     root         4.0G Jun 26 12:13 naa.600605b00581fb6018c09f852081693a:2

-rw-------    1 root     root 50.0G Jun 26 12:13 naa.600605b00581fb6018c09f852081693a:3

-rw-------    1 root     root 250.0M Jun 26 12:13 naa.600605b00581fb6018c09f852081693a:5

-rw-------    1 root     root 250.0M Jun 26 12:13 naa.600605b00581fb6018c09f852081693a:6

-rw-------    1 root     root 110.0M Jun 26 12:13 naa.600605b00581fb6018c09f852081693a:7

-rw-------    1 root     root 286.0M Jun 26 12:13 naa.600605b00581fb6018c09f852081693a:8

lrwxrwxrwx    1 root     root           36 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552 -> naa.600605b00581fb6018c09f852081693a

lrwxrwxrwx    1 root     root           38 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552:1 -> naa.600605b00581fb6018c09f852081693a:1

lrwxrwxrwx    1 root     root           38 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552:2 -> naa.600605b00581fb6018c09f852081693a:2

lrwxrwxrwx    1 root     root           38 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552:3 -> naa.600605b00581fb6018c09f852081693a:3

lrwxrwxrwx    1 root     root           38 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552:5 -> naa.600605b00581fb6018c09f852081693a:5

lrwxrwxrwx    1 root     root           38 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552:6 -> naa.600605b00581fb6018c09f852081693a:6

lrwxrwxrwx    1 root     root 38 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552:7 -> naa.600605b00581fb6018c09f852081693a:7

lrwxrwxrwx    1 root     root           38 Jun 26 12:13 vml.0200000000600605b00581fb6018c09f852081693a536572766552:8 -> naa.600605b00581fb6018c09f852081693a:8

Edit disk settings with fdisk => Failure.

~ # fdisk -u /vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a

Found valid GPT with protective MBR; using GPT

fdisk: Sorry, can't handle GPT partitions, use partedUtil

Edit disk settings with partedUtil.

~ # partedUtil getptbl "/vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a"

gpt

254458 255 63 4087881728

1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B systemPartition 128

5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0

6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0

7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0

8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0

2 1843200 10229759 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0

3 10229760 115087359 AA31E02A400F11DB9590000C2911D1B8 vmfs 0

~ #

we tried to create a partition with partedUtil.

~ # partedUtil setptbl "/vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a" gpt "9 115087360 157030400 AA31E02A400F11DB9590000C2911D1B8 0"

gpt

0 0 0 0

9 115087360 157030400 AA31E02A400F11DB9590000C2911D1B8 0

Error: Read-only file system during write on /dev/disks/naa.600605b00581fb6018c09f852081693a

SetPtableGpt: Unable to commit to disk

Questions :

Why the disk is in Read/only mode ?

How can we change that ?

Do you have any advice ?


Thanks.

Regards.


Ludovic.


PS : Plz, forgive my english, i'm french Smiley Wink

Reply
0 Kudos
13 Replies
admin
Immortal
Immortal

partedUtil setptbl "/vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a" gpt "9 115087360 157030400 AA31E02A400F11DB9590000C2911D1B8 0"


The starting sector does not looks good, it should be either 128 if the vmfs3 is upgraded to vmfs 5. If this is a new vmfs5 then it should be 2048. I am not sure from where you got the value "9 115087360" may be you can have a look at this article


VMware KB: Re-creating a missing VMFS datastore partition in VMware vSphere 5.x (Just for an example) then try to create a partition

LudovicLerat
Contributor
Contributor

Thank you for the response.

I think you have pointed the mistake.

9 is the number of the new partition (1-8 already exist except 4). I don't think the mistake is here.

115087360 is the value of the first sector i choose. Basicly, i did the last of partition 3 (the max one) and +1. The value of the last sector (157030400) is first + 20*1024*1024 (for 20 Go).

Obviously, my calculations are completly wrong !

I followed the document you have linked and i understood difference between bloc of 128 and 2048. But i don't understand how to calculate the first and the last value of sectors.

have you an advice please ?

Thank you.

Regards.

Reply
0 Kudos
admin
Immortal
Immortal

Ohh just realize this is a local datastore.

Run the below command and post the output


partedUtil getUsableSectors /vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a

Reply
0 Kudos
LudovicLerat
Contributor
Contributor

Thx again for help.

My company is closed for the weekend. I will run the command Monday.

Have a nice WE Smiley Happy

Reply
0 Kudos
LudovicLerat
Contributor
Contributor

/etc # partedUtil getUsableSectors /vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a

34 4087881694

Does it means that the 1,9 To is read-only  :smileyconfused: ?!

Reply
0 Kudos
LudovicLerat
Contributor
Contributor

I tried this command :


/vmfs/volumes # vmkfstools -P "/vmfs/volumes/DATASTORE"

VMFS-5.54 file system spanning 1 partitions.

File system label (if any): DATASTORE

Mode: public

Capacity 53418655744 (50944 file blocks * 1048576), 52400488448 (49973 blocks) avail

UUID: 51c99974-3e0e9fd0-40e4-90e2ba309b92

Partitions spanned (on "lvm"):

        naa.600605b00581fb6018c09f852081693a:3

Is Native Snapshot Capable: NO


Here, the blocks are 1Mo (1048576).


Like you said, it seems that the read-only error occurs because i try to create on a occupied space.

But I dont understand how to seek the new partition in the free space.


Any help is welcomed :smileygrin:

Reply
0 Kudos
admin
Immortal
Immortal

VMware do not support creating multiple vmfs partition from single disk. But you can try this command am not sure this is going to help you or not. make sure you are not running this in a production environment. I am not really confident on the output of this command


partedUtil setptbl "/vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a" gpt "9 115087360 4087881694 AA31E02A400F11DB9590000C2911D1B8 0"

Reply
0 Kudos
admin
Immortal
Immortal

i think the numbers are correct.... as mentioned by AT10

Reply
0 Kudos
AVT123
Contributor
Contributor

Apologies if I should be starting a new thread for this instead of reusing this one.

I am running into the same issue, using ESXi 5.1 u1 on Dell poweredge R320, using local storage (two disks hardware RAID 1, so ESXi sees a single 500GB disk)

This is a freshly installed ESXi 5.1 with no datastores currently set up. I am trying to create a single VMFS5 datastore that spans all remaining available space so I can start deploying VMs.

Here is my disk layout:

~ # partedUtil getptbl /vmfs/devices/disks/naa.6b8ca3a0e6df030019482dcc149c8519
gpt
60734 255 63 975699968
1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B systemPartition 128
5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0
8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
2 1843200 10229759 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0

~ # partedUtil getUsableSectors /vmfs/devices/disks/naa.6b8ca3a0e6df030019482dcc149c8519

34 975699934

Looks like partition 3 does not exist in the partition table above, so I am going to pick that as my partition to create. Since partition 2 ends at 10229759, I will pick 10229760 as my starting sector, and from the getUsableSector output above, I will use 975699934 as my ending sector (please let me know if my logic here is incorrect).

~ # partedUtil setptbl /vmfs/devices/disks/naa.6b8ca3a0e6df030019482dcc149c8519 gpt "3 10229760 975699934 AA31E0
2A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
3 10229760 975699934 AA31E02A400F11DB9590000C2911D1B8 0
Error: Read-only file system during write on /dev/disks/naa.6b8ca3a0e6df030019482dcc149c8519
SetPtableGpt: Unable to commit to disk

I have also tried substituting for "2048" as my starting sectior, as suggested in a previous comment, but received the same error as above. What am I missing?

Any help is greatly appreciated! Thanks!

Reply
0 Kudos
LudovicLerat
Contributor
Contributor

Apologies to have not answering on the answer of AT10.

And thanks for these answers, AT10 and AakashJ.

the command partedUtil setptbl "/vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a" gpt "9 115087360 4087881694 AA31E02A400F11DB9590000C2911D1B8 0" didn't work either.

Same error of Read-only.

I decided to give away on multiple partitions because of this : VMware do not support creating multiple vmfs partition from single disk.

I had extended the last partition to 4087881694. by this command : partedUtil resize "/vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a" 3 10229760 4087881694

then i created one datastore

vmkfstools -C vmfs5 -b 1m -S DATASTORE /vmfs/devices/disks/naa.600605b00581fb6018c09f852081693a:3

For my initial problem, i decided to use new hardrive in the VM and use multiwriting and then create the partitions in it.

To answer to AVT123, your command seemed correct.

It's similar to my case except i did a extension where you tried to create another partition.

Do you try with another partition number as 9 per example ?

Regards.

Reply
0 Kudos
AVT123
Contributor
Contributor

Thanks for the reply, Ludovic.

I did try to create the partition with # 9 instead of 3, and received the same exact error. Interestingly enough, I am able to create the datastore via vSphere client, and it creates a GPT with the same exact parameters I provided in my command line.

My goal is to automate this process since I have to do it on 50 servers, so figuring out that last piece of the command line to get it working would be super helpful.

I should also specify that I am running this command after SSH-ing in to the ESXi server as root - should I be enabling a specific mode or anything like that before running my command? Should I not be running this command while SSH'ed in?

Reply
0 Kudos
vmjoe
Enthusiast
Enthusiast

Old, old thread, I know. But I spent some hours with the same problem and finally found the solution, so in case someone finds this thread by searching...

The error with partedUtil setptbl resulting in SetPtableGpt: Unable to commit to disk is "simple":  setptbl seems to require to specify the ENTIRE partition layout, so all existing partitions with all their starting end ending sectors etc., plus the one you want to create.

But, luckily, that is not necessary if you just need to add a partition at the end (or probably also in between, if there's space). Just use partedUtil add instead and it should work!

MATPOC
Contributor
Contributor

Thanks, that helped ). I didn't have to reinstall ESXi on my home lab server ).

Reply
0 Kudos