So a lot of my viewers keep asking me to explain how I’m using a Mac Mini G4 as a file server. So I thought I’d go ahead and put this video together, and I would like to go ahead and point out that the vast majority of everything I’m going to be showing you in this video Probably is not Mac Mini G4 specific would probably apply to almost any Mac whether it be Intel, G4, a laptop, or desktop, etc. I would also like to point out that there’s probably a lot of different ways to make a Mac Mini into a file server I’m just going to show you the way that I’m doing it and it may or may not even be the best way, but here you go Assuming you were going to use a G4, one of the things you’ll notice is that you only have two USB ports and one Firewire 400 port. You could use USB drives, but you’d need a USB hub in order to get them all connected. So for the G4, Firewire is definitely the way to go. Most of the newer drives are Firewire 800 which uses a different connector type. Fortunately, you can buy a 400 to 800 cable which will allow you to use the newer drives, but it will still be at the slower 400 speed. Don’t worry though, even Firewire 400 is still faster than USB 2.0 ports on this computer. I would just like to go on record and say something about the Firewire thing here, and even though I love Firewire, and I think it’s one of the best buses for connecting external drives, it is actually on its way out, and everybody in the industry is well aware of that. It’s been on its way out for the last couple of years and I think the USB 3.0 pretty much put the last nail in the coffin. So I would just Urge you to keep that in mind if you’re thinking about going out and buying a whole bunch of drives to use as a file server That would have firewire as the main connection. With Firewire I can daisy-chain one drive to another so that all four drives are working from that single Firewire port on the computer. When mounted, you should be able to see all of the drives on the desktop of the computer. In my case I have two primary drives named Storage01 and Storage02. I also have two backup drives named Backup01 and Backup02 – I’ll explain how the backups work later in the video. The first order of business would be to share the files that you want to share. With a Mac you can share files using four different protocols. You have AFP, or Apple Filing Protocol. This is the most common type of file sharing between two different Apple computers. You can also share with SMB, or Server Message Block. This is most commonly used with computers running Microsoft Windows. The third method is NFS, or Network File System, commonly used by Unix systems or Linux. Also, there is FTP, or File Transfer Protocol, and this is commonly used for transferring files over the internet. The easiest way to share your files is to go into the System Preferences and click Sharing. Look for the Checkbox for File Sharing and enable it. Once enabled, you can pick the drives or folders that you want to share, as well as who has access to them. By default, this shares folders using AFP. If you want to share for Windows computers or FTP, then click Options and you’ll have the choice to also share with FTP or SMB. If you want to share with NFS, you’ll have to do this from the terminal. So go to your Applications Folder, then Utilities, and find the terminal. Once opened, you’ll want to navigate to the ETC folder. Then you’ll edit a file called Exports. You’ll want to start by adding the path of the folder you want to share. In my case, I’m sharing a folder called Video, located on my external hard drive called Storage02. Then you’ll need to give an IP range and subnet mask that will be allowed to access this folder. I’m sorry I can’t explain this in more detail as would just take too long. Then hit Control-X to exit and save the file. You’ll need to make sure NFS File Sharing is enabled by typing sudo nfsd enable. In my case, it’s already running. You can type showmount -e in order to verify which folders are being shared. Okay, so if you’re still here, and you’re still following, I’m going to show you how to set up a script that will back up one drive to another. Now, I realize Apple provides Apple Time Machine which, I’m not real big fan of. I like to be able to have a little bit more control over what’s going on so I’m going to show you how I do it. Okay, So the first thing to do is double check the names of the hard drives you’re going to be working with. Type CD / to get to the root folder and then type LS to get a directory listing. You should see a folder called Volumes. Let’s go into that folder by typing CD Volumes. If you type LS here, you’ll see a list of all of the mounted drives on the system. There are five showing because one of them is my internal hard drive on the Mac Mini. The other four are the external drives. So let’s go back to the root folder and find a folder called Users. I’m going to go into dmurray since that’s my folder. At this point, I’m going to type sudo nano backupscript. Just to briefly explain what this means, you put sudo in front of a command if you want the command to have administrator privileges. Nano is the name of a great little text editor that you can run from the command line and is also very popular on Linux and other Unix systems. Backupscript is simply the name I am giving to the file that I’m creating, which is going to be a script for running my backup. I hope that clears things up. Notice that it asks for a password. This is because I used the sudo command. The password will not display but you’ll have to type the administrator password and press return. Okay, so I’m going to use the rsync command which will duplicate an entire folder from one location to another. -a stands for archive and progress tells it to show me what it’s doing as the command runs. Next I give it the path of the folder I want to copy on Storage01, and then I give it the path of where I want it to go on Backup01. In this case I’m copying a folder called pictures. I end with exit 0 to tell it to close the script when it’s done. Notice that if I browse to my personal folder, I will see the file I created here called backupscript. But it’s not yet executable so we need to fix that. So I’ll go back to the terminal and I’ll type sudo chmod +x backupscript You’ll notice the icon changed after I pressed enter. You’ll want to test the script. I opened up both hard drives on the screen together. You can see several folders on one and the other drive is empty. I’m going to double click the script to test it. If the script works, you should see the pictures folder begin to copy to the backup drive. Not only can you see the script running, but you can see the picture folder was created in the empty drive. Also you can see the lights flashing like crazy on the two drives that are working. The script obviously works. Ok so now that we’ve got a working script, what we need to do is set it so that that script runs by itself automatically every night. Now you can do this by setting up a Unix cron job, but I’m gonna make it a lot easier for you an show what I do. I actually downloaded and installed a free program called CronniX and it’ll set this up for you. Watch how it works. So, open CronniX, then click New. Click the Prepend button and add the full path to the script. In my case, that’s users/dmurray/backupscript Then click Simple to set up the time. Put a checkmark in Day of Month, Month, and Day of Week. This essentially means the script will run every day. I’m putting my hour slider at the 2, which means it will run at two o’clock in the morning. Then just click New and Save. Okay, now what I just showed you will work just fine and the script should run it at two o’clock in the morning. Now, The problem with this script is that it will leave a terminal window open in the morning when you turn on the monitor and look. Now that can be really annoying especially if you don’t use the computer very often, you may turn on the monitor in one morning and see 50 terminal windows up on your screen. Now I recommend doing it this way at least once just to make sure the script actually runs at 2:00 in the morning because you’ll be able to tell when you come in the next morning. Once you’re sure it’s working, you’re probably going to want to make it run silently so that you no longer see the terminal window coming up on the screen and here’s how you do that. I can edit your schedule again and change the command to /bin/sh and leave a space between that and the path of your script. Of course once you have all this working, you’ll need to add the rest of the folders to the script. In my case, I have quite a few here, as you can see. Alright, so I wanted to tell you just a little bit about the rsync command. Now, it’s actually very similar to the robocopy command that windows has, but rsync is very popular on Unix systems as well. Now, the way this works, and it’s really cool, is it checks to see if the file already exists on the other drive. The benefit of that is that when you have two enormous drives, like in this case I’m copying What? A whole terabyte drive to another whole terabyte drive, and I’m doing that twice over because I have four drives total. It would take forever if it had to copy every single file. So what it does is it actually checks to see if the file already exists on the other drive, and if the file, date, and the size, and everything is the same it just skips it. Which is great because that means if no changes were made It’s just gonna to go through every night, and it’s just going to check this file, this file, this file, this file, and if there’s no changes, it’s going to be done in like five or ten minutes. If there you know five or six files that are different, it’s going to copy those five or six files and again the script is only going to take just a few minutes to finish. And of course the very first time you run it it may take a day or two to finish the depending upon, you know, how much data is actually being copied. But once it’s done copying the bulk of it, it’s only just going to update as needed. Now, the way I have mine set, it does not do an exact clone. That is, it doesn’t delete files off the backup drive. Now You can add a command in there to make it do that, but I don’t like it to work that way and here’s the reason. If I accidentally delete a file off of my file server, then, if I don’t realize it, that night when the script runs, it’ll delete it off the backup drive too and then I’ve lost it. But if I if I don’t have it delete the files in the backup drive, then that means I can delete a file and then in four or five days later I can go “Oh man, where did that file go?” Then I can go over to my backup drive and there it is and I can copy it back. Now, the problem with that is though, is if you make a whole lot of changes you may end up with a whole lot of excess files over on your backup drive. So, pretty much the way I handle that is periodically once over a few months I pretty much just go in and erase the backup drive and let the script just run completely again and get a clean copy over to the backup drive. That may not necessarily be the best way to do things but that’s how I do it. Anyway I hope you enjoyed the video, hope didn’t melt your brain or anything. Hope it wasn’t too boring or complex or anything. I’ve been putting this video off for a while because I wasn’t entirely sure how to explain some of the stuff, so anyway, I hope you enjoyed it. Until next time. Thanks!