❓ What This Is About
I picked up an affordable PC for ¥3,300 at Hard Off, so I'm turning it into a NAS (file server).
I'm a total beginner at this, so consider this post more of a personal notebook and running commentary.
My motivation was that my Mac's storage had filled up, and since I've been taking more photos and videos lately, I wanted to build a cheap file server that I could access wirelessly from various devices instead of relying on a wired connection.
The Amazon links in this post include affiliate links.
🧳 What I Used
Main PC
- Chip: Apple M1
- Memory: 16 GB
- macOS: Sonoma 14.5
Server PC (Today's Star)
PC
- Chip: Intel Core i5 4430
- Memory: 8 GB
- GPU: GTX 645
- Price: ¥3,300
- Where I got it: Hard Off
HDD
- Spec: 500GB HDD, 2.5 inch
- Price: roughly ¥1,000?
- Where I got it: pulled from an old laptop I used to own
SSD
- Spec: M.2 2TB
- Price: roughly ¥17,000
- Where I got it: Amazon
- Purchase link: https://amzn.to/3VLSyeZ
SATA-to-USB Cable
- Price: roughly ¥1,000
- Where I got it: Amazon
- Purchase link: https://amzn.to/3VAlk0K
M.2-to-USB Cable
- Price: roughly ¥2,000
- Where I got it: Amazon
- Purchase link: https://amzn.to/3KPelwf
🖐️ Steps
Getting Linux Ready
I decided to build this using Ubuntu. I don't think it matters much which distribution you pick, but I went with Ubuntu because its GUI is easy to work with.
Installation
Download the Ubuntu ISO file from the official site below.
https://ubuntu.com/download
Get a USB drive ready. I remember the ISO being around 4GB last time I touched this, but it's now grown to just under 6GB. So it's a good idea to use a USB drive with some headroom — around 8GB.
I used the following tool to turn it into a boot disk. This is what's recommended on Ubuntu's own official page, so that's why I used it.
https://etcher.balena.io/
Reorder the boot sequence in the BIOS and boot from it.
From there, just follow the setup guide and you should be able to make it all the way through the install.
Initial Linux Setup
Once it's booted, open a terminal.
Since this is the first time, run the following command.
sudo apt upgrade
This updates all your packages in one go.
The steps that follow often take a while, so if you'd like to prevent the machine from going to sleep, it's worth setting that up first using this post (Keeping Ubuntu from Going to Sleep) as a reference — it'll make the rest of this much less stressful.
Initializing the Disk
Since I got a Crucial M.2 SSD from Amazon this time, I'm going to proceed on the assumption that I'll connect it over USB as external storage, and also use it as portable storage for my Mac.
Open the Disks app.
Select the hard disk (SSD) you want to initialize and choose "Format Disk…" from the menu in the top right.

A "Format Disk" popup will appear.
Here, I went with
Erase: Overwrite existing data with zeroes (Slow)
Partitioning: Compatible with modern systems and hard disks > 2TB
since my SSD was a brand-new 2TB drive.


A confirmation menu appears — click "Format" to proceed.

This takes forever...
Once it's done, create a partition.

Choosing the Format Type

Since I wanted to use this drive as external storage that works on both Mac and Windows, I set it up as exFAT.
I've covered the exFAT setup in this post.
If you have no plans to use this disk outside Linux, Ext4 works fine too.
Once done, click the ▶︎ button in the bottom left to mount it.
If you want it recognized automatically on boot (surprisingly, Windows doesn't need this step), configure it from Edit Mount Options.
Added on 2024/06/22
Since exFAT doesn't support chmod, it turned out to be difficult to use as a server, so in the end I decided to choose from Ext4, XFS, or Btrfs instead.
I ultimately settled on Btrfs after reading this blog post, "Thoughts After 13 Years of Using Btrfs": https://chienomi.org/articles/linux/202203-btrfs.html
Choosing a file system is tricky for beginners, so I put together a quick summary of what I learned here: "A Look at Disk Formatting Types on Ubuntu (Linux)"
Mount Options
Set the mount options so the drive gets mounted automatically at boot.
(In the screenshot below the name is set to Server202406, but you can use whatever name you like, such as ShareData.)

Setting Up Samba
Working from the CLI, there's a step where you'll need to write to files.
Let's start by upgrading vim (otherwise, pressing an arrow key just prints letters like A and B).
sudo apt install vim
Directory Permissions
Since I formatted a new disk this time, /mnt/ShareData exists, so let's change the permissions on that directory.
⚠️ Note: Some other blog posts use system-config-samba, but that's no longer available from Ubuntu 18 onward.
sudo chmod 777 /mnt/ShareData
Configure smb with the following command.
sudo vim /etc/samba/smb.conf
Under the global section near the top,
[global]
dos charset = CP932
unix charset = UTF-8
workgroup = WORKGROUP

add the lines above.
Then add the following at the end of the file.
[share]
path = /mnt/ShareData/
writable = yes
guest ok = yes
create mask = 0777
directory mask = 0777

Verify it — the following command lets you check the config for errors.
testparm
Finally, start Samba.
sudo systemctl enable smbd nmbd
This should get everything working!!
Reboot at the end, and when I clicked the Network tab in the Mac's Finder…!!!

There it was!! Woohoo
📕 Reference Sites
Sharing files between Linux and Windows with Samba
https://qiita.com/k-Mata/items/8bee9e02e74565b6c147
Japan Samba Users Group website
https://www.samba.gr.jp/project/translation/current/htmldocs/manpages/smb.conf.5.html