WD My Cloud Home to Linux Server – 2. Installation / Openmediavault

There is a new and easy way of installing Debian Linux with or without Openmediavault.
For those of you who speak russian, find latest instructions and download link at the 4PDA forum:
https://4pda.to/forum/index.php?showtopic=467828&view=findpost&p=110514773
Everybody else, stay here and download from this mirror, if the 4PDA link is down.

1. Create the USB installer.
You need a USB stick of about 500MB, formatted with FAT32(MBR!). Just unpack the zip you downloaded to the USB stick and wait until it is finished and safely eject it. 😉

2. Install
Put the USB drive in the USB port of your WD My Cloud Home, hold the reset switch down while you connect the power and hold it until the light stops flashing.

The installer does not automatically install anything. You need to connect via Telnet first. Windows should have a telnet client onboard. Otherwise you can use the Termux Android app (e.g. in the F-droid store). Connect to your MCH via Telnet:

telnet [the IP address of your MCH]

  1. Backup (optional)
    If you want to back up your current partitions, you can enter the following commands:
    mkdir -p /mnt/flash/WD
    dd if=/dev/sda1 of=/mnt/flash/WD/01-FW_TABLE.bin
    dd if=/dev/sda2 of=/mnt/flash/WD/02-KERNEL_A.bin
    dd if=/dev/sda3 of=/mnt/flash/WD/03-ROOTFS_A.bin
    dd if=/dev/sda4 of=/mnt/flash/WD/04-ROOTFS_B.bin
    dd if=/dev/sda5 of=/mnt/flash/WD/05-FDT_A.bin
    dd if=/dev/sda6 of=/mnt/flash/WD/06-FDT_B.bin
    dd if=/dev/sda7 of=/mnt/flash/WD/07-AFW_A.bin
    dd if=/dev/sda8 of=/mnt/flash/WD/08-KERNEL_B.bin
    dd if=/dev/sda9 of=/mnt/flash/WD/09-ROOTFS_GOLD.bin
    dd if=/dev/sda10 of=/mnt/flash/WD/10-FDT_GOLD.bin
    dd if=/dev/sda11 of=/mnt/flash/WD/11-AFW_B.bin
    dd if=/dev/sda12 of=/mnt/flash/WD/12-BOOTCODE32.bin
    dd if=/dev/sda13 of=/mnt/flash/WD/13-BOOTCODE64.bin
    dd if=/dev/sda14 of=/mnt/flash/WD/14-BL31.bin
    dd if=/dev/sda15 of=/mnt/flash/WD/15-BL32.bin
    dd if=/dev/sda16 of=/mnt/flash/WD/16-KERNEL_GOLD.bin
    dd if=/dev/sda17 of=/mnt/flash/WD/17-AFW_GOLD.bin
    dd if=/dev/sda18 of=/mnt/flash/WD/18-CONFIG.bin
    dd if=/dev/sda19 of=/mnt/flash/WD/19-SYSTEM_A.bin
    dd if=/dev/sda20 of=/mnt/flash/WD/20-SYSTEM_B.bin
    dd if=/dev/sda21 of=/mnt/flash/WD/21-CACHE.bin
    dd if=/dev/sda22 of=/mnt/flash/WD/22-DATA.bin
    dd if=/dev/sda23 of=/mnt/flash/WD/23-SWAP.bin

This will copy all your partitions, EXCEPT FOR YOUR DATA to the usb stick. And your USB stick must be larger if you want to create a backup.

  1. Create partition table and install the OS
    Execute the script that resizes your partitions (make a backup first).

makepartshdd.sh

After the script ran through you need to issue the following command before rebooting:

cd / ; umount /mnt/* ; sync ; busybox reboot

Do not let the device reboot by itself. Again, hold the reset switch when you connect power and only release it when the light stops flashing.

Connect again via telnet.

telnet [the IP address of your MCH]

Check your partition table

sgdisk /dev/sda -p

Run the script that installs the OS

installos.sh

If you come from the stock firmware you must wipe the data partition. If you come from a prior installation of Linux, you can keep your data by not executing the following command:

make_ext4fs -L UsersFolders /dev/sda21

After all this is done, reboot the device:

cd / ; umount /mnt/* ; sync ; busybox reboot

Wait 40-50 seconds.

You can log in to your new linux server with SSH

ssh root@[the IP address of your MCH, which might have changed]. You can try ssh root@wdmch

The password is „root“.

You are now logged in to your Linux server. Congratulations!

Now it depends on what you want to run upon Debian. I describe three variants.
A – Set up a file server manually by setting up Samba, NFS, Seafile etc.
B – Install Openmediavault
C – Install DietPi, a script that installs various servers.

If you want to install DietPi, do not execute any of the commands below, but continue straight with the blog post on DietPi!

Variant A – Set up a Linux server manually (for Openmediavault, read Variant B)

If you do not want to install openmediavault, you can start by mounting the data partition.
I create the mountpoint for the data partition in /mnt/data . You can also choose another mount point like e.g. /media/files etc.

First the path must exist
mkdir /mnt/data

Then the mountpoint must be created in the fstab file which holds all mount points:
nano /etc/fstab

Add a line to mount partition 21 which is your data partition.
/dev/sda21 /mnt/data ext4 defaults 0 0

Save changes with ctrl+o and exit with ctrl+x
Mount it first with the following command. After the next reboot it will mount automatically.

mount /mnt/data

A5. Tuning if you did not install OMV

You can switch the kernel version, enter any of below commands (a reboot will occur)

/boot/bootA #ver.4.9.266 + GPU (RAM ~ 750MB)
/boot/bootB #ver.4.9.266 -GPU (RAM ~ 1GB)
/boot/bootG #ver.4.1.17 -GPU (RAM ~ 1GB)
I use BootB as I do not need GPU acceleration. If you successfully tested GPU transcoding e.g. for Plex, please comment.

To have less writes to the HD execute the following commands:
echo ‚kernel.printk = 3 4 1 3‘ >> /etc/sysctl.conf
echo ‚debug.exception-trace = 0‘ >> /etc/sysctl.conf
echo ‚vm.swappiness = 30‘ >> /etc/sysctl.conf

sysctl -p

clear the logs :
echo > /var/log/messages ; echo > /var/log/syslog ; echo > /var/log/kern.log
etc..pp…

Also, the folder and its contents / var / log / journal / * / grow to indecent sizes measured by gigabytes – reduce it to 32MB (option 1) or completely turn off (option 2) :

nano /etc/systemd/journald.conf

Option 1:

SystemMaxUse = 32M

SystemMaxFileSize = 1M

Option 2:

Storage = none


Save the configuration in the file and restart the service:

systemctl restart systemd-journald

If you chose option two in the last tweak, delete the journal.

rm -r /var/log/journal/

To have less disk acitivity it makes sense to keep log files, caches etc. in RAM and only have it periodically written to disk.
I use folder2ram.
https://github.com/bobafetthotmail/folder2ram

Install the necessary packages first:
apt update
apt install -y rsync hdparm smartmontools wget

Then download folder2ram to the path /sbin. Note: You need to have the path configured like it is described in the second post.
wget -O /sbin/folder2ram https://raw.githubusercontent.com/bobafetthotmail/folder2ram/master/debian_package/sbin/folder2ram
And make it executable
chmod +x /sbin/folder2ram
Then execute it (as superuser). See the folder2ram github for explanations.

folder2ram -configure
The script will ask you which editor you would like to run. I use nano.
nano
Append the paths to the log files below. Be careful to use two TAB keys in between the type and mount point. If you use spaces it will fail!

tmpfs /var/log
tmpfs /var/tmp
tmpfs /var/spool
tmpfs /var/lib/smartmontools
tmpfs /var/lib/systemd
tmpfs /var/lib/dhcp
tmpfs /var/lib/systemd/timesync/

The following only if you install samba

tmpfs /var/lib/samba

The following line if you want to install NFS

tmpfs /var/lib/nfs

Plex…

tmpfs /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs

Seafile…

tmpfs /var/lib/seafile

Save and exit.
Afterwards start folder2ram with
folder2ram -mountall

Make it start at boot:
folder2ram -enablesystemd

I installed automatic timesync with my local internet router (Fritzbox). You can use any NTP server. e.g. 0.europe.pool.ntp.org

apt install ntpdate
ntpdate fritz.box

Then you can install and configure your locale (otherwise you will see an error whenever you install something).

apt-get install locales
dpkg-reconfigure locales

Variant B – Install Openmediavault

If you want to continue with Openmediavault, run the following script;

/root/installomv6.sh

bash /root/installomv6.sh
Wait until it is run through. It can take 10 Minutes.
After it is finished, reboot.

systemctl reboot

Now you can connect to the device via your webbrowser.
Type in the IP address of your device in the browser.
Username = admin
Password = openmediavault

B5 – Tuning

The following is a translation from the russian language website. I did not install OMV myself. Check it for links to plugins! https://4pda.to/forum/index.php?showtopic=467828&st=16980#Spoil-110514773-1

extraplugins will already be installed, HDD and its SMART are visible

to display the sda19 / SYSTEM system section (System label), you need to install the plugin openmediavault-sharerootfs 6.xx

to display the user section sda21 / DISKVOLUME1 (UsersFolders label), you need to mount it in Vault->File systems

for display in a network environment, drunk starting from version 6.0.19, enter sequentially 4 commands :

echo ‚OMV_SAMBA_NMBD_ENABLE=“YES“‚ >> /etc/default/openmediavault
monit restart omv-engined
omv-salt stage run prepare
omv-salt stage run deploy

You can switch the kernel version, enter any of below commands (a reboot will occur)

/boot/bootA #ver.4.9.266 + GPU (RAM ~ 750MB)
/boot/bootB #ver.4.9.266 -GPU (RAM ~ 1GB)
/boot/bootG #ver.4.1.17 -GPU (RAM ~ 1GB)

To have less writes to the HD execute the following commands:
echo ‚kernel.printk = 3 4 1 3‘ >> /etc/sysctl.conf
echo ‚debug.exception-trace = 0‘ >> /etc/sysctl.conf
echo ‚vm.swappiness = 30‘ >> /etc/sysctl.conf

sysctl -p

clear the logs :
echo > /var/log/messages ; echo > /var/log/syslog ; echo > /var/log/kern.log
etc..pp…

Also, the folder and its contents / var / log / journal / * / grow to indecent sizes measured by gigabytes – reduce it to 32MB (option 1) or completely turn off (option 2) :

nano /etc/systemd/journald.conf

option 1 :

SystemMaxUse = 32M

SystemMaxFileSize = 1M

option 2 :

Storage = none

Save the configuration in the file and restart the service:

systemctl restart systemd-journald

when choosing „option 2“, delete the folder with all the contents:

rm -r / var / log / journal /

To have less disk acitivity it makes sense to keep log files, caches etc. in RAM and only have it periodically written to disk.

If you installed OMV, you can install the plugin openmediavault-flashmemory 6.xx and enable it:
folder2ram -configure

tmpfs [press 2 TAB] /var/cache
tmpfs [press 2 TAB] /var/lib/dhcp
tmpfs [press 2 TAB] /var/lib/monit
tmpfs [press 2 TAB] /var/lib/openmediavault
tmpfs [press 2 TAB] /var/lib/php
tmpfs [press 2 TAB] /var/lib/rrdcached
tmpfs [press 2 TAB] /var/lib/samba
tmpfs [press 2 TAB] /var/lib/smartmontools
tmpfs [press 2 TAB] /var/lib/systemd
tmpfs [press 2 TAB] /var/spool
tmpfs [press 2 TAB] /var/tmp

when choosing „option 2“ from the previous setting, we also transfer the logs

tmpfs [press 2 TAB] /var/log

reboot the system and check

folder2ram -status

/var/cache is mounted
/var/lib/dhcp is mounted
/var/lib/unit is mounted
/var/lib/openmediavault is mounted
/var/lib/php is mounted
/var/lib/rrdcached is mounted
/var/lib/samba is mounted
/var/lib/smartmontools is mounted
/var/lib/systemd is mounted
/var/spool is mounted
/var/tmp is mounted
note: Logs are transferred to RAM only when disabled / var / log / journal / (option 2)
/var/log is mounted

24 Kommentare zu „WD My Cloud Home to Linux Server – 2. Installation / Openmediavault

  1. Some people have their MCH on a local domain controlled by a router provided by their internet provider. Some of those do nu run a decent dnsmasq to resolve the local domain, yielding „ssh buster@wdnas“ not working.

    However, the MAC address of your MCH is mentioned on the box, which can be translated into a IPv6 IP.
    (see amongst others: https://stackoverflow.com/questions/27693120/convert-from-mac-to-ipv6)

    if IPv6 is working on your local domain „ssh buster@FE80::****“ will work where FE80::**** is the translation of your MAC address into a local domain IPv6.

    In this way, I could get the above mentioned image running.

    Like

  2. Hi and thanks for your post.
    It is still not clear how to create the zip files from debian image.
    What is the start point
    Where it should be done. Can I use my own pc to create the files or should it be done on mch
    What is ment by replace files in /omv
    Where do I get /omv from the start?
    What is the base the we build this files upon??
    //Abbe

    Like

    1. The starting point is a MCH with a stock image.
      First you backup all data that you need. Everything will be deleted.
      Download this file https://c.gmx.net/@328058200588813603/Pk5D2RKaTXawr7RvjnmMUw
      Unpack it to USB stick that is freshly formatted with FAT32.
      Then you put the USB Stick to your MCH that is switched OFF.
      Hold the reset button while you switch it on and hold it until the flashing light is permanently on.
      Then you wait. After a few minutes you should be able to log in to you new Debian Server:
      ssh buster@wdnas

      Like

      1. Thanks for your answer
        But what i ment is the starting point to make your own files from debian buster.
        Imagine that I have a fresh mch and I want to make minimum debian of my own.
        What to start with.
        Does the original os have a ssh client that I can login into and start from there or ?
        Do it as like mch for dummies:)

        Like

      2. No, the original OS has no SSH client. The starting point would be a debian with OMV that you can download from a russian forum. I changed the manual to make that more clear.

        Like

      3. Hi again!
        So if I get you right, then to make your own copy you need first to install debian from the Russian link, then you create your own debian files on your own mch. Then you use the same image from the Russian link but thus time you replace 3 compressed files and the rest is the same

        Like

  3. I have a question, at Time i use Buster, i want to update to Bullseye, when i update with USB Stick for fresh install , will my data partiton be gone ?

    Like

  4. i have one question, i have at the moment a debian buster installation, i want to go to Bullseye. When i install Bullseye with USB Stick will be my Data Partition be Deleted ? I try to update with Instruction from here but it faills with an error an now i dont come again on buster with ssh

    Like

  5. I have installed openmediavault a week back and installed jellyfin yesterday directly on debian not docker, and left it overnight after adding some shows. In the morning, I checked Angry IP Scanner and I had several devices with their IPs on my network and WDMCH was not responding so I pulled the plug for it and now it won’t work at all. I’m trying the same old thing of plugging USB into it and holding reset switch but it won’t work, light won’t flash anymore. Any suggestions on what else can I do?

    Gefällt 1 Person

  6. thanks a lot for the great work! I’ll soon get my hands on a used MCH Duo. It’s without drives. I’m wondering if the operating system is gone with the original drives, or it’s hopefully stored in another internal memory. Can I simply install 2 new empty disks and follow your guide?

    Like

  7. Hi, I need some help. After following the instruction I am stuck at „If you come from the stock firmware you must wipe the data partition.“ Can you tell me what to do?

    Like

  8. I just wanted to say thank you for the excellent step-by-step instructions. I will admit, wiping my data was not exactly what I wanted, but restoring from my backups onto the clean Debian-based system was easy and fast! Fastest I’ve ever seen this piece of hardware work. It used to take days just to back up one laptop I have. Now, the entire backup was done in a couple of hours. Happy to be free of WD!

    Like

  9. hello, can you help me?
    after installing the os i log with shh command and everything is ok.
    however when trying to install openmediavault, in the end it says that the version is unsupported.

    Like

Hinterlasse einen Kommentar