Linux file system for SQL Server DBAs
With Microsoft releasing SQL Server on Linux and a lot of SQL Server DBAs coming from a predominantly Windows background, this post is going to arm the DBA with the fundamental knowledge of the Linux file system. If you come from a Windows background and are expecting to see the traditional c:\, d:\ etc on Linux, you will be mistaken. Installing SQL on Linux is as easy as running a couple of commands: see here. The Linux operating system at its core is a set of files in a file system. Although the folder structure differs from distribution to distribution, there are a couple of core folders that every administrator should be aware of in all of the distributions. Before we dig into each of the folders, we should talk about general partitioning of the file system. A typical install will have three partitions normally spread across different disks.
- Root (/) - Everything is stored under root. The operating system files, the home directory, media files, literally everything. Typically, root is on separate drives to home and swap partitions for performance reasons. This is similar to the c:/ in windows.
- Home (/home/user) - Each user has is own home folder under the home directory and this is where all user data and application settings specific to the user are stored. This is similar to the user folder in Windows.
- Swap partition (/dev/"SwapFile") - This is similar to the page file in Windows and is a file that the OS can use when needing to flush files from memory to disk.
/This is the root directory of the system and as mentioned above, all folders and files are stored under this folder. The closest comparison to this on Windows is the root of the c:/.
/binThis is the binaries folder. This folder contains base executables which are required for the Linux operating system to work. Software and application files are stored in here and are executed at runtime. Executables in this folder can be run by anyone. Some example programs that are installed by default are the "ls" command and various commands for manipulating files such as "cp"."rm","mv" etc. The comparison to this on Windows would be the c:\Windows folder.
/bootThis is the folder where all the files are stored that are needed for the Linux kernel to boot the machine. This folder should never be modified by a user as it can cause severe issues with starting the machine. The closest comparison to this would be the Windows boot loader or master boot record.
/devThis is the folder where all the devices are stored. Remember that everything in Linux is a file? Well, that includes devices, too. Any attached devices will show up in this folder. Some examples are hard disk drives (sda,sdb,sdc etc), webcams, printers, etc. The closest Windows comparison here is the entries in the My Computer section of Windows or, on newer versions of Windows, the Devices section under control panel.
/etcThis folder contains most, if not all, of the system-wide configuration files. Some examples of this are the fstab file for configuring your file system table on boot. I remember this folder as "everything to configure" as it contains all the configuration files. There is no comparison to this in Windows, as configurations are stored differently depending on the application installed.
/home/home is where you will find your users' personal directories and files. On my system, I have three folders here:
- /home/daniel - My home folder
- /home/bobby - My son's folder
- /home/guest - A guest folder in case someone needs to borrow my computer