How to Add New Hard disk to Linux Machine

How to Add New Hard disk to Linux Machine  I am going to divide each part as follows 1. Plan the layout of the filesystem with the new drive 2. Partition the new hard drive 3. Format the new partitions 4. Test the new space 5. Copy data from old to new partition (optional) 6. Edit /etc/fstab 7. Reboot 8. Remove old data (optional) Here is the details about each one. 1. Plan the new filesystem. Where would you like to use the new space? Do df to print a summary of free/used space on each of the existing mounted partitions. Do du on selected directories to find their size. For example, I would consider using new hard drive space in...

Delete Files Older Than x Days on Linux

Delete Files Older Than x Days on Linux The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.   Command Syntax
find /path/to/files* -mtime +5 -exec rm {} \;
Note that there are spaces between rm, {}, and \; Explanation
  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
  • The second argument, -mtime, is used to specify the number of days...