Debian 13 and RAID 1 Setup on a J1900 Snail NAS

The hacked Synology build that originally came with my Snail NAS had been stable for years, but I barely used the Synology-specific features. Since I had recently been doing remote development on a tiny 4 GB overseas server, I decided to upgrade the NAS at home to a more general Debian 13 setup. With Docker and CasaOS, that is already enough for what I need.

Hardware

  • CPU / Motherboard: J1900 (Snail NAS)
  • Memory: 8 GB DDR3L 1600
  • System Disk: 256 GB mSATA SSD
  • Data Disks: 3 x 4 TB HDDs (two in RAID 1, one as a standalone storage disk)
  • Operating System: Debian 13 (Netinst, command-line only, no desktop environment)

What else you need


1. Create the Bootable USB

  1. Prepare the ISO: debian-13.3.0-amd64-netinst.iso
  2. Write it with Rufus:
    • Insert the USB drive and open Rufus.
    • Device: select the correct USB drive.
    • Boot selection: choose the downloaded Debian 13 ISO.
    • Partition scheme: keep the default GPT first. If the system refuses to boot later, rewrite it and try MBR instead.
    • Click Start. When the popup appears, the default ISO Image mode is recommended. On older motherboards with poor compatibility, you can also try DD Image mode.

Rufus configuration Rufus popup

2. BIOS Settings and Boot

  1. USB port: I recommend plugging the USB drive into a black USB 2.0 port on the rear I/O panel. Front-panel ports and blue USB 3.0 ports are sometimes not detected correctly during the BIOS stage.
  2. Enter BIOS: repeatedly press F11 or Del while powering on.
  3. Adjust the boot order: under the Boot tab, find Boot Option #1, select the USB drive, and move it to the first position. The SSD system disk can stay second.
  4. Compatibility fallback: if the USB drive is not detected:
    • Try setting Fast Boot under the Boot menu to Disabled.

Save the settings and reboot.

Boot settings

3. Core Debian Installation Options

After booting from the USB drive, choose Install or Graphical install.

  1. Basic setup: choose the language, time zone, root password, and a normal user account.
  2. Disk partitioning (important):
    • Choose Guided - use entire disk. Guided partitioning
    • Make sure you select the SSD as the system disk. Select the SSD
    • Choose All files in one partition. All files in one partition
    • Confirm and write the changes with Write changes to disks. Write changes to disks
  3. Software selection:
    • Uncheck Debian desktop environment and any desktop options such as GNOME.
    • Keep only SSH server and standard system utilities.

Software selection

Once installation is complete, remove the USB drive and reboot.

4. Storage Configuration: RAID 1 plus One Standalone Disk

From another machine on the same LAN, SSH into Debian and switch to the root account with su -.

4.1 Identify the Disks

1
2
# List all disks
lsblk

Use the disk sizes to identify each device. In this article I assume sda is the system disk, sdb and sdc are the RAID disks, and sdd is the standalone data disk.

4.2 Create the RAID 1 Array

Warning: this will erase the disks. Make sure your data is backed up.

Install the RAID management tool and create the md0 array:

1
2
3
apt update && apt install mdadm -y
# Create a RAID 1 array named md0 from sdb and sdc
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc

(If you are warned that the disks contain leftover metadata, enter y to confirm.)

Important: syncing two 4 TB drives takes hours. You can continue with the next steps while synchronization runs in the background. To check the progress:

1
cat /proc/mdstat

Save the RAID configuration so it survives reboots:

1
2
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
update-initramfs -u

4.3 Format the Disks and Reclaim Reserved Space

Format both the RAID 1 array (/dev/md0) and the standalone HDD (/dev/sdd) as ext4.

Optimization note: ext4 reserves 5% of the disk space for the root user by default. On a 4 TB disk, that is roughly 200 GB. For pure data disks, that is usually unnecessary, so I set it to 0%.

1
2
3
4
5
6
mkfs.ext4 /dev/md0
mkfs.ext4 /dev/sdd

# Set the reserved space ratio to 0%
tune2fs -m 0 /dev/md0
tune2fs -m 0 /dev/sdd

4.4 Mount the Disks and Enable Auto-Mount at Boot

Create mount-point directories:

1
mkdir -p /mnt/raid1_4t /mnt/single_4t

Check and record the UUIDs:

1
2
blkid /dev/md0
blkid /dev/sdd

Edit /etc/fstab with nano:

1
nano /etc/fstab

Add the following lines at the end of the file. Replace the UUIDs with your real values.

1
2
UUID=your-md0-uuid /mnt/raid1_4t ext4 defaults 0 0
UUID=your-sdd-uuid /mnt/single_4t ext4 defaults 0 0

Test the mounts:

1
2
mount -a
df -h

4.5 Automatic Disk Spin-Down

If the disks do not see much read/write activity, you can configure them to spin down automatically.

1
2
3
4
5
# List disk IDs and identify the IDs of your HDDs, usually the ones starting with ata-
ls -l /dev/disk/by-id/ | grep -v part

# Edit the configuration file
vim /etc/hdparm.conf

At the end of the file, add entries like the following for your disks. Replace the IDs with your actual ones.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/dev/disk/by-id/ata-WDC_WD40EFZX-xxxxx_WD-WCCxxxxx {
    spindown_time = 241
}

/dev/disk/by-id/ata-Seagate_ST4000VN008-xxxxx_Zxxxxx {
    spindown_time = 241
}

/dev/disk/by-id/ata-Seagate_ST4000VN008-xxxxx_Zyyyyy {
    spindown_time = 241
}

At this point, the storage foundation is done. All disks are ready, and you can deploy Docker or any other services on top of them.

5. CasaOS

CasaOS is a lightweight, user-friendly home-cloud system built on top of Docker. It aims to give home users a simple all-in-one environment for NAS storage and application management.

That said, after using it myself, I felt it was not especially necessary. The feature set is fairly basic, and for Docker management I still prefer the command line.

1
curl -fsSL https://get.casaos.io | sudo bash

6. qBittorrent

Install qBittorrent with Docker:

1
2
3
4
5
6
7
8
# Create the config directory first
mkdir -p /opt/qbittorrent/config

# Enter the qbittorrent directory
cd qbittorrent

# Create compose.yml
vim compose.yml

Example compose.yml, which you can adjust as needed:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
services:
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    environment:
      - PUID=0          # Make sure this UID has read/write access to the mounted disks
      - PGID=0          # Make sure this GID has read/write access to the mounted disks
      - TZ=Asia/Shanghai
      - WEBUI_PORT=8085
    volumes:
      - /opt/qbittorrent/config:/config               # qBittorrent config and torrent files
      - /mnt/raid1_4t/PT:/downloads/raid1_4t          # Mount the PT folder from the raid1_4t disk
      - /mnt/single_4t/PT:/downloads/single_4t        # Mount the PT folder from the single_4t disk
    ports:
      - 8085:8085
      - 52000:52000
      - 52000:52000/udp
    restart: unless-stopped

Start qBittorrent:

1
2
3
4
5
6
7
8
docker compose up -d

# Check the startup logs and get the temporary login password
docker logs qbittorrent

# You should see output similar to:
# The WebUI administrator username is: admin
# The WebUI administrator password was not set. A temporary password is provided for this session: X9JAJQQr7

Open http://nas_ip:8085 in your browser and sign in with:

  • Username: admin
  • Password: X9JAJQQr7
    Use the password shown in your own logs.

To switch the language: Tools -> Options -> User Interface Language -> Simplified Chinese, then click Save.

To change the password: Tools -> Options -> WebUI -> Username / Password, then click Save.

7. Jellyfin

Jellyfin is a free, open-source self-hosted media server for managing and streaming personal video, music, and photo libraries. It is the free software fork of Emby, so users keep full control over their own data. Jellyfin runs on Windows, Linux, Docker, and more, supports hardware transcoding, and can sync watch history across TVs, phones, and web clients.

1
2
3
4
5
6
7
8
# Create the folder
mkdir -p /opt/jellyfin/config

# Enter the folder
cd /opt/jellyfin

# Create compose.yml
vim compose.yml

Adjust the media mount paths based on your own needs:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
services:
  jellyfin:
    image: lscr.io/linuxserver/jellyfin:latest
    container_name: jellyfin
    environment:
      - PUID=0
      - PGID=0
      - TZ=Asia/Shanghai
    volumes:
      # Host paths on the left, container paths on the right. Make sure the host paths actually exist.
      - /opt/jellyfin/config:/config               # Jellyfin config files and poster cache
      - /mnt/raid1_4t/PT/MT:/media/raid1_4t/PT/MT  # Root directory for movies / TV shows
      - /mnt/raid1_4t/归档/video:/media/归档        # Another media directory
    ports:
      - 8096:8096  # Default web access port
    devices:
      - /dev/dri:/dev/dri  # Pass through the J1900 integrated GPU for hardware acceleration
    restart: unless-stopped

Then start the container with docker compose up -d and open http://NAS_IP:8096 in your browser to begin the initial setup.

转载请保留本文转载地址,著作权归作者所有