Difference between revisions of "User:Pytony/Home Server Journey"
(Added day 5)
|Line 109:||Line 109:|
And still kept funtoo-stable-hardened/pure64/generic_64-pure64 build.
And still kept funtoo-stable-hardened/pure64/generic_64-pure64build.
Let's run <code>emerge -
Let's run <code>emerge ---with-bdeps=y @world && genkernel kernel --no-clean --no-mountboot && emerge zfs</code> and go to sleep. :)
Revision as of 21:03, September 7, 2015
Home Server Journey
I am thinking about setting up a local server that would mainly serve as a NAS but also provide some other services I could reach at home or from my office or anywhere else. I also would like to use it as a media center to bind any audio source (jack, bluetooth, inner storage, USB peripherals, network, ...) to the amplifier. Most services (especially those I'm not gonna be the only user) would be controllable via a mobile-friendly web interface.
This is the base idea for this beginning journey. :)
Time to find the hardware... My main criteria were the price, the size of the case and power consumption. In order to satisfy these criteria I decided to look for a mini-ITX motherboard with integrated CPU and supplied through ATX. My other criteria for the motherboard were:
- At least 1 HDMI output (ideally 2)
- At least 1 optical S/PDIF output
- At least 4 SATA III ports (ideally 6)
- At least 1 Ethernet 1Gbps controller
- Ideally some PCI slots
- Ideally hardware RAID support
Originally, I chose the ASRock N3700-ITX but it was not in stock and procurement was unknown. I decided to wait but finally I found the ASRock N3150-ITX which was $30 cheaper and very close to my original choice. One thing I especially appreciated with these motherboards is that the processor is fanless, which I think is good for power consumption and silence.
For this kind of server I don't think RAM is essential so I just took 2×2GB Crucial CT25664BF160B.
For the storage, I first thought about 3 or 4 HDD in RAID 5 or 6. But I remembered my price criteria and decided to start with 1×2To HDD and add some more in the future. I chose WD Green WD20EZRX (mainly because there was $20 off as it was a reconditioned product).
I wanted a silent modular 350-450W power supply at least 80Plus Gold certified. The choice was quite limited and I found myself with a Corsair CS450M.
Finally, I looked for a small case, ideally white in order to break with all that black furniture and stuff in my living room, and not ugly. My choice fell on a Cooler Master Elite 120 Advanced white.
My excitation when I received all that stuff quickly dissipated when I realized the stand-off screws were missing in the case. Without them I was unable to set up the motherboard.
A week later I received the missing screws I had requested. Still I could assemble my server. I originally planned a fanless system, but I noticed there were two fans in the case, so I plugged them, just in case.
The first time I turned on the computer, nothing happened. :( When checking again the cable connections, I noticed I plugged the system panel header on the COM port header by mistake while I rearranged the cables in the case. Fortunately this didn't damage any component, and everything worked fine the second time I turned on the computer.
Now it's time to install the best GNU/Linux distribution in the world: Funtoo. =)
I wanted to try ZFS and build my own initramfs for the first time. But I also wanted to get it working as soon as possible. So I decided to stick with the ZFS Install Guide and use genkernel to configure the kernel and initramfs. Knowing that this doesn't prevent me from building alternate kernel/initramfs later.
Bleh, got a kernel panic after reboot. =( I think there is a couple of things I've done wrong:
- I didn't boot sysresccd via UEFI, though I partitioned my disk using `gdisk`
- I didn't care about this warning "Today is 2015-05-12. ZFS has undertaken an upgrade - from 0.6.3 to 0.6.4. Please ensure that you use a RescueCD with ZFS 0.6.3."
- I didn't care about this warning "When booting into the ISO, Make sure that you select the "Alternate 64 bit kernel (altker64)".".
So let's try again with
funtoo-stable-hardened/pure64/generic_64-pure64 stage3 (nothing related to the kernel panic here, but I think this will be better than what I originally chose (
And... it failed again. :)
grub-install: error: cannot find EFI directory. I didn't to extensive researches about this error, I'm pretty sure this is due to something I've done wrong in the beginning. So I'm gonna start again. However I'll first try to do a "standard" installation. I thought about using LVM instead of ZFS (I also learned ZFS is a bit greedy in terms of RAM, so this is probably better anyway), but there is a couple of things that I am not used to: UEFI installation, initramfs, use of genkernel to build a kernel, ... I think the first thing to do is successfully building a system booting with UEFI.
OK, standard install worked with UEFI. I accidentally made
ext2 instead of
vfat, fortunately it was quite easy to fix afterwards. I think it's one of the mistakes I made in the previous installs. So I'll try again taking especially care about UEFI things.
I made a 500MB EFI partition and all space left for ZFS:
Disk /dev/sda: 3907029168 sectors, 1.8 TiB Logical sector size: 512 bytes Disk identifier (GUID): E2066145-69F3-46DD-8329-6DC3D3094EB2 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 3907029134 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector) End (sector) Size Code Name 1 2048 1026047 500.0 MiB EF00 EFI System 2 1026048 3907029134 1.8 TiB BF00 Solaris root
And here is how I partitioned the system:
root@sysresccd /root % mkfs.vfat -F 32 /dev/sda1 mkfs.fat 3.0.22 (2013-07-19) root@sysresccd /root % zpool create -f -o ashift=12 -o cachefile=/tmp/zpool.cache -O normalization=formD -m none -R /mnt/funtoo toast /dev/sda2 root@sysresccd /root % zfs create -p toast/funtoo root@sysresccd /root % cd /mnt root@sysresccd /mnt % zfs create -o mountpoint=/ toast/funtoo/root root@sysresccd /mnt % zfs create -o mountpoint=/home toast/funtoo/home root@sysresccd /mnt % zfs create toast/swap -V 8G -b 4K root@sysresccd /mnt % mkswap /dev/toast/swap Setting up swapspace version 1, size = 8388604 KiB no label, UUID=dffed32f-f0f0-4e9c-b405-9a82b1e30805 root@sysresccd /mnt % swapon /dev/toast/swap root@sysresccd /mnt % zfs create -o mountpoint=/opt toast/funtoo/opt root@sysresccd /mnt % zfs create -o mountpoint=/usr toast/funtoo/usr root@sysresccd /mnt % zfs create -o mountpoint=/var toast/funtoo/var root@sysresccd /mnt % zfs create -o mountpoint=/tmp toast/funtoo/tmp root@sysresccd /mnt % zfs create -o mountpoint=/var/tmp toast/funtoo/var/tmp root@sysresccd /mnt % zfs create -o mountpoint=/var/portage/distfiles toast/funtoo/var/portage-distfiles root@sysresccd /mnt % zfs create -o mountpoint=/var/portage/packages toast/funtoo/var/portage-packages root@sysresccd /mnt % cd funtoo root@sysresccd /mnt/funtoo % chmod 1777 var/tmp root@sysresccd /mnt/funtoo % chmod 1777 tmp
Obivously, not to forget the fstab:
# <fs> <mountpoint> <type> <opts> <dump/pass> /dev/sda1 /boot vfat defaults 0 2
And still kept
emerge -uDN --with-bdeps=y @world && genkernel kernel --no-clean --no-mountboot && emerge zfs and go to sleep. :)