/Synology_M2_volume

Easily create an M.2 volume on Synology NAS

Primary LanguageShellMIT LicenseMIT

Synology M2 volume

Description

Easily create an M.2 volume on Synology NAS without a lot of typing and no need for any how-to guides. And you don't need Synology branded NVMe drives.

This script will create the RAID and storage pool on your NVMe drive(s) for you so you can then create the volume in the DSM GUI.

All you have to do is run the script and type yes and 1, 2, 3 or 4 to answer some simple questions. Then reboot, go to Storage Manager, Online Assemable and Create Volume.

RAID levels supported:

RAID Level Drives Required
Single 1 drive
RAID 0 2 or more drives
RAID 1 2 or more drives
RAID 5 3 or more drives

Confirmed working on:

Model DSM version M.2 card
DS723+ DSM 7.1.1-42962 Update 4
DS423+ DSM 7.1.1-42962 Update 4
DS3622xs+ DSM 7.2-64216 Beta E10M20-T1
DS3622xs+ DSM 7.1.1-42962 Update 1
DS1522+ DSM 7.1.1-42962 Update 4
DS1821+ DSM 7.2-64216 Beta
DS1821+ DSM 7.2-64213 Beta
DS1821+ DSM 7.1.1-42962 Update 4
DS1621+ DSM 7.1.1-42962 Update 4
DS1520+ DSM 7.1.1-42962 Update 4
DS920+ DSM 7.1.1-42962 Update 1
DS920+ DSM 7.2-64216 Beta
DS720+ DSM 7.2-64216 Beta
DS1819+ DSM 7.2-64216 Beta M2D20
DS1819+ DSM 7.1.1 M2D20
DS1019+ DSM 7.1.1-42962 Update 4
DS918+ DSM 7.1.1

Important

If you later update DSM and your M.2 drives are shown as unsupported and the storage pool is shown as missing, and online assemble fails, you need to run the Synology_HDD_db script. The Synology_HDD_db script should run after every DSM update.

Download the script

See How to download the script for the easiest way to download the script.

To run the script

sudo -i /volume1/scripts/syno_create_m2_volume.sh

Note: Replace /volume1/scripts/ with the path to where the script is located.

Options:

  -a, --all        List all M.2 drives even if detected as active
  -s, --steps      Show the steps to do after running this script
  -h, --help       Show this help message
  -v, --version    Show the script version

It also has a dry run mode so you can see what it would have done had you run it for real.

What to do after running the script

  1. Restart the Synology NAS.
  2. Go to Storage Manager and select Online Assemble:
    • Storage Pool > Available Pool > Online Assemble
  3. Create the volume as you normally would:
    • Select the new Storage Pool > Create > Create Volume.
    • Set the allocated size.
      • Optionally enter a volume description. Be creative :)
    • Click Next.
    • Select the file system (Btrfs or ext4) and click Next.
    • Optionally enable Encrypt this volume and click Next.
      • Create an encryption password or enter your existing encryption password.
    • Confirm your settings and click Apply to finish creating your M.2 volume.
  4. Optionally enable and schedule TRIM:
    • Storage Pool > ... > Settings > SSD TRIM
    • Note: DSM 7.1.1. has no SSD TRIM setting for M.2 storage pools
    • Note: DSM 7.2 Beta has no SSD TRIM setting for M.2 RAID 0 or RAID 5

Storage Pool available for online assembly

Online Assemble step 1

Online Assemble step 2

Create Volume

Allocate volume capacity

Volume description

Select file system

Success!

Enable TRIM