# Server intel NVME drives



## bagas (Jun 28, 2017)

Hello.
Server intel NVME drives.

```
nvd0: <INTEL SSDPE2MX450G7> NVMe namespace
nvd0: 429247MB (879097968 512 byte sectors)
nvd1: <INTEL SSDPE2MX450G7> NVMe namespace
nvd1: 429247MB (879097968 512 byte sectors)
```
How do I split the disk correctly?
To split a SSD drive with a 4 offset?


----------



## SirDice (Jun 28, 2017)

A sharp chisel will probably do the trick. But seriously though, what exactly do you mean by "split the disk"?


----------



## bagas (Jun 28, 2017)

SirDice said:


> A sharp chisel will probably do the trick. But seriously though, what exactly do you mean by "split the disk"?


Create the correct disk geometry
Partition with a 4K offset.

like this

```
dd if=/dev/zero of=/dev/da2 bs=512 count=100
gpart create -s mbr /dev/da2
gpart add -t freebsd da2
gpart create -s BSD da2s1
gpart add -b 1 -t freebsd-ufs da2s1
newfs -U -f 4096 /dev/da2s1a
```


----------



## SirDice (Jun 28, 2017)

Don't set the start (-b), use the -a option and let the system figure out where exactly to start. The alignment option will make sure it starts and stops at the correct block. I would also recommend using GPT instead of MBR. It's much easier to use (no BSD labels needed) and will allow you to create more than 4 slices.

```
-a alignment  If specified, then gpart utility tries to
                                 align start offset and partition size to be
                                 multiple of alignment value.
```
From gpart(8)


----------



## ralphbsz (Jun 29, 2017)

bagas said:


> Partition with a 4K offset.


If you mean by that that you want each partition to be aligned to the nearest 4KiB, then use "-a 4K".  I personally use alignment to the nearest MiB these days; that can be a tiny bit wasteful (but with typical disk sizes measured in TB, a megabyte rounding error is no longer relevant), and makes it much more likely than an internal hardware alignment of flash devices matches the partitions (flash devices have internal structures that are much larger than 4K).



> Create the correct disk geometry



SirDice already responded to the "how".  In order to help you with the "what", we need to know what you are trying to accomplish; that will help guide the discussion of what "correct" means.  What do you want to use these devices for?  Are they going to be the only (main) disk in the machine?  If yes, what is the intended use of the machine: is it gaming, or a web server, or a compute server, or a file and IO server, or a host for many VMs?  Or are they a special file system, used for high-performance workloads?  What file system do you intend to use on them?  Are you going to use some RAID layer (you have two drives, so maybe mirroring is what you intended)? Are you going to use them as L2ARC in ZFS?  

This is very much like buying a car: If you walk into a car dealer and ask "sell me the correct car", they will need to know what your requirements are.  Do you need a red sports car, a minivan with enough seats to take all the kids to soccer practice, a pickup truck for your yard work projects, a vehicle for towing your 10-ton mobile home, or an energy-efficient small car for daily commute to work?


----------



## bagas (Jun 29, 2017)

ralphbsz said:


> If you mean by that that you want each partition to be aligned to the nearest 4KiB, then use "-a 4K".  I personally use alignment to the nearest MiB these days; that can be a tiny bit wasteful (but with typical disk sizes measured in TB, a megabyte rounding error is no longer relevant), and makes it much more likely than an internal hardware alignment of flash devices matches the partitions (flash devices have internal structures that are much larger than 4K).
> 
> 
> 
> ...




```
root@dir:/ # gpart show
=>       40  879097888  nvd0  GPT  (419G)
         40     409600     1  efi  (200M)
     409640  869908480     2  freebsd-ufs  (415G)
  870318120    8388608     3  freebsd-swap  (4.0G)
  878706728     391200        - free -  (191M)
```

Without raid.
On the first disc nvd0 system installed.

```
# uname -rms
FreeBSD 11.0-RELEASE-p1 amd64
```
On the second disk nvd1, wakes up a couple of jails, web servers


----------



## ralphbsz (Jun 29, 2017)

Your gpart output looks good.  The partition locations and sizes are all divisible by 8, and 8 sectors = 4KiB, so everything is 4K aligned.  Whether the partition sizes and types are suitable for your use, only you can know.


----------

