Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto make an old PC function as a Home NAS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
rsnfunky
Tux's lil' helper
Tux's lil' helper


Joined: 30 Dec 2007
Posts: 77

PostPosted: Mon Oct 14, 2024 8:22 am    Post subject: Howto make an old PC function as a Home NAS Reply with quote

Hi,

As the question describes, the aim is to get an old PC function as a home NAS to which the following can be connected:

1) TVs for playing media saved on HDDs
2) Mobile Phones
3) Linux / Windows PCs / Laptops to access and save data
4) If possible access this data from net using a VPN

I was reading this article: https://www.xda-developers.com/how-turn-old-pc-into-nas/

This was on TrueNAS and I understand that it requires one dedicated disk to boot.

My Aim:
1) Have the same features like TrueNAS but using a gentoo box. Can also make it dual boot with Windows and connect to a TV (Functions as a PC in another room).

2) Install Softwares like:
a) Nextcloud for working like Google Photos and backup
b) Jellyfin for Media Server - Will this also fuction as a DLNA for playing media on home smart TV?
c) Any google drive alternative for auto back android devices and whatsapp backups
d) Any other softwares which can be recommended?
d) How to get secure access from the internet.

3) I can connect to this old PC NAS, all the internal and external HDDs that I have and these will be availabe whenever I am at home and that too from any device on the wifi.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3461

PostPosted: Mon Oct 14, 2024 9:48 am    Post subject: Reply with quote

Sounds like a plan.
What's the actual problem though? You're unlikely to get a full-blown custom guide, just ask specific questions once you get stuck on something.


Quote:
c) Any google drive alternative for auto back android devices and whatsapp backups

Can you even use an alternative server to backup android devices?
Quote:
d) Any other softwares which can be recommended?
This tells me you're on a hype train. You're trying to do way too much in one go.
A NAS is essentially not that different from any other installation, even though it is typically intended to be a very minimal, light-weight installation, just enough to expose some disk space via NFS, SMF and FTP. You're builing a custom solution for personal use, so even those rules don't apply, since you're defining your NAS by function rather than a software stack.
Basically, you'll cross that bridge when you need to, there's no point thinking about it in advance.
Quote:
d) How to get secure access from the internet.

Depends on how you are connected to the internet in the first place, and what do you understand by "access from the internet" and what do you consider "secure"
Most people are behind NATs and would need a VPN. The implementation will vary depending on the things one line above.
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 529

PostPosted: Mon Oct 14, 2024 9:58 am    Post subject: Reply with quote

I would imagine that any Linux distribution would be capable of providing basic NAS functions. It really depends on the amount of set-up you want to do. I don't think using Gentoo here would offer an advantage over any other distribution -- there would still be a lot of set-up. I guess that's where platforms like TrueNAS score: they'll do most of the basic stuff with little additional set-up. My understanding is that TrueNAS can only be installed on a complete drive, but storage is cheap, and you could still dual-boot by using the PC's BIOS to select a drive to boot from (rather that, say, using multiple partitions on the same disk).

But I fear that you might soon get fed up with the constant fan noise and poor energy-efficiency. In my view, it's only worth using PC-type hardware for NAS if you plan to run more CPU-intensive stuff on it as well. Otherwise it's a waste of resources. Just my $0.02, of course.

BR, Lars.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54588
Location: 56N 3W

PostPosted: Mon Oct 14, 2024 10:05 am    Post subject: Reply with quote

Build on what you know works. Add thigs so you know what breaks. :)
and can back it out.

Start with NFS as that's fairly simple to make work.
Add Samba for the Windows systems.

Do not install everything you think you need and tell us it's not working.
We already know that. :)
The idea is to keep the problem space small, so it's easy to diagnose and fix.

Actually the order you add bits is not important. It's the one at a time that matters.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3374
Location: USA

PostPosted: Sun Oct 20, 2024 10:25 pm    Post subject: Reply with quote

Using an old PC for a NAS is a great idea -- but if you let feature creep determine how much functionality you want, you're likely to reach the point where old hardware may not fit the bill and new hardware will be required.

I've been doing this for a long long time. The demands that we placed on old PCs that were re-tasked as home servers were a lot simpler back then. My first "NAS" was built long before the term "NAS" became a marketing thing. Back then I just ran linux on an old PC and installed SAMBA to serve Win and Linux clients at home. Back then we just called them SAMBA servers. The hardware requirements for that sort of thing in the home were so minimal that you could literally use any old boatanchor and a few big IDE disks to do the job. Way back when I used a 486 and then Pentium box for this sort of thing. Ultimately the disk and networking interface requirements forced motherboard/CPU upgrades.

I was deep into Gentoo at the time, yet for the NAS I moved to a FreeNAS to do file serving, backup, and media streaming. It was just simpler to use a turnkey distribution than to try to build everything by hand. Back then just building a LAMP server on Genoo was a major project and a full blown multi-feature NAS was beyond the reach of most people.

If I were in your shoes, I wouldn't start off trying to do it all under Gentoo -- there will just be too much heavy lifting while you're learning the ropes. If it were me, I'd start off with a turnkey distribution, get a basic system up and running, and then add features as needed, taking incrementally small steps. If you really want to do it in Gentoo, I'd recommend building the Gentoo box after the turnkey box is already up and running. I say this because getting your full featured NAS up and running as quickly as possible will be a lot more rewarding than the delayed gratification that will come from a full Gentoo build.


Regarding the dual boot idea, I can't really say that I would ever consider building a NAS and then taking it offline to boot windows on that metal. It just seems counterproductive to me to take down the NAS for any secondary task, but that's just me.


With the older version of TrueNAS (FreeNAS), the dedicated boot device could be a USB stick. Back in my FreeNAS days (prior to the advent of SSD) I used mirrored USB sticks as boot devices for fault tolerance. That was a great solution as it allowed me to reserve the machine's SATA ports for the data disk array. When they rebuilt FreeNAS and the devs were using SSD, they lost USB compatibility and forced everyone to use SSD for the OS mirror. The result was that they consumed 2 SATA slots that put limits on the number of disks in the zpool. Everyone ran out of SATA ports and ended up migrating to LSI SAS disk controllers as the disk arrays grew and grew.

The moral of that little story is that things get very complicated very fast, and the more features you want, the more you're going to strain your hardware, and the more likely that the prospect of building a very complex modern system out of old hardware is likely to fail. You're likely to end up being forced into new hardware. My suggestion would be to start off simple, and add features incrementally, so you'll know what features force you into upgrades and you can make decisions about whether or not they are worthwhile and fit the budget.

Neddy's recommendation to keep the problem space small, and perform incremental feature expansions are true words of wisdom.
Back to top
View user's profile Send private message
rsnfunky
Tux's lil' helper
Tux's lil' helper


Joined: 30 Dec 2007
Posts: 77

PostPosted: Sun Oct 27, 2024 10:51 am    Post subject: Reply with quote

Update:

Got my gentoo installation up and running. It took an insanely long time for compile. The gtk-2-webkit took over 30 hours of compile time and kernel about 8 hours on my Athlon II 965 (4 core processor) with 8 gb ram.

Got the NFS server functional and exported 2 NTFS partitions: extract of /etc/fstab

Code:
/mnt/sda1               /mnt/d          ntfs            defaults        0 0
/mnt/sda2               /mnt/e          ntfs            defaults        0 0
/mnt/d                  /export/d       none            bind            0 0
/mnt/e                  /export/e       none            bind            0 0


The /etc/export
Code:
/export         *(insecure,rw,sync,no_subtree_check,crossmnt,fsid=0)


The server came up with no issues.

My /etc/portage/make.conf

Code:
COMMON_FLAGS="-O2 -pipe -march=amdfam10"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
LC_MESSAGES=C.utf8
MAKEOPTS="--jobs 4"
USE="video_cards_radeon bluetooth samba ffmpeg vlc matroska taglib exiv2 ffmpegthumbnailer grub dracut ctype curl fileinfo filter gd iconv ssl posix session simplexml xmlreader xmlwriter zip zlib curl imagemagick libmount fsv4 uuid caps junction acl python"


VIDEO_CARDS="amdgpu radeonsi"
ACCEPT_LICENSE="*"





Problem statement 1: Why did it take insanely long time to get an gentoo install with Gnome.

Problem statement 2: I tried opening the file server by typing the ip address on my mobile browser and the error was connection refused.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54588
Location: 56N 3W

PostPosted: Sun Oct 27, 2024 1:18 pm    Post subject: Reply with quote

it's a server, why do you want a GUI on a server?

To connect via a web browser, you will need a web server listening on port 80 for http and/or port 443 for https.
Webservers were not mentioned, so you won't have one. Hence connection refused.
You will get a self signed certificate for https to get started. Your phone won't like that until you tell it to trust it.
Longer term, you can get a real free certificate from letsencrypt.
It will need to be renewed every 3 months.

There are several web servers to choose from.
I use apache as I've been using it for 20 years and have lot looked at anything else.
That's not a reccomendation, more an admission that I'm stuck in a rut. :)

== edit ==
If you start sshd on the PC and install a ssh client on your phone, you should be abe to ssh ito the PM from your phone.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
steve_v
Guru
Guru


Joined: 20 Jun 2004
Posts: 411
Location: New Zealand

PostPosted: Sun Oct 27, 2024 5:45 pm    Post subject: Re: Howto make an old PC function as a Home NAS Reply with quote

rsnfunky wrote:

1) TVs for playing media saved on HDDs
2) Mobile Phones
3) Linux / Windows PCs / Laptops to access and save data
4) If possible access this data from net using a VPN

All relatively straightforward. Start by working out which servers/protocols are required for access from your client devices, and set them up one at a time.


rsnfunky wrote:
dual boot with Windows and connect to a TV (Functions as a PC in another room).

Uhh, why? That's well outside the scope of Network Attached Storage.


rsnfunky wrote:
Any google drive alternative for auto back android devices and whatsapp backups

What you can use for android backups depends on how you have configured the android device(s) involved.
Stock google android supports only google services (for obvious google reasons), many OEMs add their own proprietary backup solutions, and AFAIK none of those have readily available self-hosted server components.
Some AOSP-based projects (e.g. seedvault as included in lineageos) have automatic backup solutions that work with pretty much anything.

Basic backups of files / contacts / calendar / messaging can be done with FOSS android apps (and integrate with nextcloud), but for application and settings backups (i.e. backing up files that are "private" to another app), you'll need root or an AOSP ROM. Google only allows Google services full access to everything on the device, because "security". :roll:
As for whatsapp... Probably the same as above. Can't say for sure though, since I don't run blatant spyware on my phone.

Personally, I find nextcloud (WebDAV) + supysonic (subsonic) on apache suits my android (lineageos) file access / backup / music streaming needs nicely. Using NFS for high-performance (10G) LAN file access, and OpenVPN and/or SSH(FS) for everything else...
Disclaimer: The server in question actually runs Devuan, because it's low maintenance and I'm lazy. Anything you can do with Devuan/Debian you can do just as well with Gentoo of course.


rsnfunky wrote:
How to get secure access from the internet.

WebDAV, OpenVPN, or plain-old SSH. Again, depends on what you are trying to connect from.


rsnfunky wrote:
all the internal and external HDDs that I have and these will be availabe whenever I am at home and that too from any device on the wifi.

Sure. First you need to decide how those filesystems are going to be made available. What protocols do your client devices support?


rsnfunky wrote:
The gtk-2-webkit took over 30 hours of compile time and kernel about 8 hours on my Athlon II 965 (4 core processor) with 8 gb ram.

1) Don't install gtk2-webkit or other GUI trash, it's a server.
2) Trim your kernel config so you're not compiling every driver known to man and dog, or use gentoo-kernel-bin.


rsnfunky wrote:
Got the NFS server functional and exported 2 NTFS partitions
...
I tried opening the file server by typing the ip address on my mobile browser and the error was connection refused.

To be expected, browsers talk to webservers, which NFS is not. You should probably go read some basics WRT remote filesystem protocols and webserver configuration.


rsnfunky wrote:
Gnome

Just... Why? Why do people keep doing this?
Installing a full-blown DE on a server is a waste of resources at best, and a bunch of gratuitous attack-surface if it's internet-facing. On Gentoo, it's also a bunch of time and energy spent compiling things a server doesn't need.
Administration of a server or a NAS is best done from a CLI, over SSH. No need for Gnome, wayland, X, or 99 other libraries of dubious utility, and no lengthy chrome-kit compiles of any kind.



Bob P wrote:
The hardware requirements for that sort of thing in the home were so minimal that you could literally use any old boatanchor and a few big IDE disks to do the job. Way back when I used a 486 and then Pentium box for this sort of thing.

LoL, likewise. An overclocked AMD DX4-120 IIRC, with disks far larger than the BIOS supported (because Linux can), and some incredibly janky modem sharing & answering machine services I forget the details of. Lived in a grubby basement, as was the natural habitat of such creatures. Only took me a couple of years to move it from the (literal) cardboard box to a proper case, and that only because the CPU cooler (rubber bands) fell off so I had reason to mess with it.
If you take the ship of Theseus approach, I'm kinda running the same sever today... Just many, many incremental upgrades later :P
_________________
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum