requirement: sdb3 should be formated as ext4, DO not use f2fs/NTFS/exFAT.
debootstrap --arch=amd64 stretch /mnt/sdb3/debian http://deb.debian.org/debian
mount -o bind /proc /mnt/sdb3/debian/proc
mount -o bind /sys /mnt/sdb3/debian/sys
mount -o bind /dev /mnt/sdb3/debian/dev
chroot /mnt/sdb3/debian /bin/bash
apt update
apt install mongodb
apt install software-properties-common
add-apt-repository "deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti"
apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
apt update
apt install unifi
chroot /mnt/sdb3/debian /bin/bash
/etc/rc.local add content before exit 0:
mount -o bind /proc /mnt/sdb3/debian/proc
mount -o bind /sys /mnt/sdb3/debian/sys
mount -o bind /dev /mnt/sdb3/debian/dev
chroot /mnt/sdb3/debian /bin/bash service mongodb start
chroot /mnt/sdb3/debian /bin/bash service unifi start