# New-partition -Offset not working

**URL:** <https://forums.powershell.org/t/new-partition-offset-not-working/19881>\
**Category:** PowerShell Help\
**Created:** [July 13, 2022, 2:35pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881 "2022-07-13T14:35:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [July 13, 2022, 2:35pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/1 "2022-07-13T14:35:49Z")

</div>

Hi folks,  
I have this code, it works fine if I remove the -offset

`New-Partition -DiskNumber 1 -UseMaximumSize -Offset 1048576 | Format-Volume -FileSystem NTFS -NewFileSystemLabel newdrive -AllocationUnitSize 65536`

I cannot get a valid Offset number to work. Its supposed to be type UInt64 - I thought that would be a factor of 64 like 64 \* 1024.

Any ideas on that -Offset?

Thanks!

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 13, 2022, 2:48pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/2 "2022-07-13T14:48:50Z")

</div>

> [@matt1974](#):
>
> I have this code, it works fine if I remove the -offset

Do you need to set the offset?

> [@matt1974](#):
>
> Its supposed to be type UInt64 - I thought that would be a factor of 64 like 64 \* 1024.

The data type `[UINT64]` is just an `[INT]` with higher maximum … you can get it with:

```auto
[uint64]::MaxValue

```

BTW: if you get errors please share them completely formatted as code.

---

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [July 13, 2022, 2:55pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/3 "2022-07-13T14:55:12Z")

</div>

Hey Olaf,  
I do need to set the offset to preferably 1MB

Thats a HUGE number:  
[uint64]::MaxValue  
18446744073709551615

The error:

```auto
PS C:\WINDOWS\system32> New-Partition -DiskNumber 1 -UseMaximumSize -Offset 1048576 | Format-Volume -FileSystem NTFS -NewFileSystemLabel newdrive -AllocationUnitSize 65536
New-Partition : The specified offset is not valid.
Activity ID: {f153031e-06aa-411f-9abb-d2a96da4aef2}
At line:1 char:1
+ New-Partition -DiskNumber 1 -UseMaximumSize -Offset 1048576 | Format- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (StorageWMI:ROOT/Microsoft/Windows/Storage/MSFT_Disk) [New-Partition], CimException
    + FullyQualifiedErrorId : StorageWMI 41012,New-Partition

```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 13, 2022, 3:05pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/4 "2022-07-13T15:05:48Z")

</div>

> [@matt1974](#):
>
> I do need to set the offset to preferably 1MB

So your disk type or partition type may not support an offset 1MB!? 🤷🏽‍♂️ You may try other values.

Do you already have partitions you could inspect for existing values?

---

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [July 13, 2022, 3:08pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/5 "2022-07-13T15:08:16Z")

</div>

I didn’t think of that, I always blame my code first.

Ill try on some other disks and see whats up.

Thanks!

---

<div class="post-metadata">

**Author:** ![matt1974](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matt1974](https://forums.powershell.org/u/matt1974)\
**Post date:** [July 13, 2022, 3:46pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/6 "2022-07-13T15:46:00Z")

</div>

If I increase the -Offset to 16777216 it works on my servers disks. That gives a ~16MB offset which is fine I think. Is there a minimum value for that? Or does it depend on other variables like disk size, partition size etc?

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 13, 2022, 3:58pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/7 "2022-07-13T15:58:02Z")

</div>

> [@matt1974](#):
>
> If I increase the -Offset to 16777216 it works on my servers disks.

Great. I’m glad to hear that. 👍🏽

> [@matt1974](#):
>
> Is there a minimum value for that?

I have no idea. 🤷🏽‍♂️

> [@matt1974](#):
>
> Or does it depend on other variables like disk size, partition size etc?

Possible. Sounds plausible, sort of, I think. 🤔

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:17pm UTC](https://forums.powershell.org/t/new-partition-offset-not-working/19881/8 "2024-05-16T20:17:43Z")

</div>


