ZFS vs XFS

I’ve found XFS more well suited to extremely large filesystems with possibly many large files. I’ve had a functioning 3.6TB XFS filesystem for over 2 years now with no problems. Definately works better than ext3, etc at that size (especially when dealing with many large files and lots of I/O). What you get with ZFS … Read more

SSL Certificate Location on UNIX/Linux

For system-wide use, OpenSSL should provide you /etc/ssl/certs and /etc/ssl/private. The latter of which will be restricted 700 to root:root. If you have an application that doesn’t perform initial privilege separation from root, then it might suit you to locate them somewhere local to the application with the relevantly restricted ownership and permissions.

LVM dangers and caveats

Summary Risks of using LVM: Vulnerable to write caching issues with SSD or VM hypervisor Harder to recover data due to more complex on-disk structures Harder to resize filesystems correctly Snapshots are hard to use, slow and buggy Requires some skill to configure correctly given these issues The first two LVM issues combine: if write … Read more

Creating folders in C++

I have recently started working in C++ and came across this situation when I have to create a directory while executing my code. The code is working fine when I have to create a single folder but it fails when I have to create another folder withing this newly created folder. Suppose, I am in … Read more

What’s the best way to check if a file exists in C?

Look up the access() function, found in unistd.h. You can replace your function with You can also use R_OK, W_OK, and X_OK in place of F_OK to check for read permission, write permission, and execute permission (respectively) rather than existence, and you can OR any of them together (i.e. check for both read and write permission using R_OK|W_OK) Update: Note that on Windows, you can’t use W_OK to reliably … Read more

How to copy files?

shutil has many methods you can use. One of which is: Copy the contents of the file named src to a file named dst. Both src and dst need to be the entire filename of the files, including path. The destination location must be writable; otherwise, an IOError exception will be raised. If dst already exists, it will be replaced. Special files such as character or block … Read more