So recently I was trying to set-up a php-fpm & Nginx based server (with PHP 7 if I recall) and it would not run, I tried everything I could think of, having set up a few of these for work recently but it would just not work.

Well after much Googling I discovered a post on the Nginx forums not completely related to my troubles but it had a handy tip for debugging:

stop fpm
strace -efile /path/to/php-fpm -i > /dev/null

That command completely saved my sanity, for those who don’t know what it is (if anyone else actually reads this that is, and this is a lamens explanation) strace shows what in this case php-fpm gets up to and what files it tries to open. This led me to discover it was trying to open a particular file which was giving a permissions error I believe where it couldn’t open the file and quite shortly afterwards I was able to solve it.

So very recently we needed to quickly get a new 3TB HDD set-up in Cent OS 7 as a backup server. We couldn’t afford the time to spend an age on it so when with the simple and powerful fdisk. I decided to write this so that I don’t forget how I did it, as is likely to happen.

Identify the device, we used fdisk -l and was able to identify the drive: /dev/sdb

Create the partition, fdisk /dev/sdb then use option p, n, and w (w is important as it actually makes the changes, otherwise they get lost when fdisk quits)

Make the ext4 filesystem on partition, mkfs -t ext4 /dev/sdb1 (the 1 refers to the partition)

Create a mount point, Simply just need to create a folder with which to mount the drive into, we used /mnt/backup_drive

Mount the partition (temporily), mount /dev/sdb1 /mnt/backup_drive – this let us know it all worked

Make the mount permanent, Edit fstab (I like to use nano but there are other ways to do this) nano /etc/fstab (you need to sudo for this to work) and enter a line like this: /dev/sdb1 /mnt/backup_drive ext4 defaults 0 0
You may see other lines similar to this, some systems refer to the drives using the UUID instead, admittedly I don’t know enough about that to comment other than I rememer reading that the UUID is very unique. When I discover more I shall post about it on here.