Manager NFS volumes on Esxi

I. Method 1:

- Run this command to list the mounted datastores:

esxcli storage filesystem list 

 - Run this command to unmount the NFS datastore:

Unmount the datastore by running this command:

esxcli storage filesystem unmount [-u UUID | -l label | -p path ]

For example, use one of these commands to unmount the LUN01 datastore:

esxcli storage filesystem unmount -l LUN01
esxcli storage filesystem unmount -u 4e414917-a8d75514-6bae-0019b9f1ecf4
esxcli storage filesystem unmount -p /vmfs/volumes/4e414917-a8d75514-6bae-0019b9f1ecf4

II. Method 2:

- Run this command to list the mounted datastores:

esxcli storage nfs list  

- Run this command to unmount the NFS datastore:

esxcli storage nfs remove -v NFS1

exam: NFS1 is datastore

After running the esxcli storage nfs remove -v NFS1 command and it fails with this error similar to:

Unable to complete Sysinfo operation. Please see the VMkernel log file for more details.: Sysinfo error: BusySee VMkernel log for details.

- To resolve this issue: 

Isolate the UUID of the NFS mount by running this command:

vmkfstools -Ph -v10 /vmfs/volumes/NFS1

Example: 

vmkfstools -Ph -v10 /vmfs/volumes/NFS1/ 
 
 

NFS-1.00 (Raw Major Version: 0) file system spanning 1 partitions.
File system label (if any): NFS1
Mode: public
Capacity 86.5 GB, 86.5 GB available, file block size 4 KB, max supported file size 16777216 TB
Disk Block Size: 512/512/0
UUID: 003e96eb-9f51034a-0000-000000000000
Logical device: 192.168.10.120 /mnt/Prod/NFS1
Partitions spanned (on "notDCS"):
        nfs:003e96eb-9f51034a -----> UUID 
NAS VAAI Supported: NO
Is Native Snapshot Capable: NO
OBJLIB-LIB: ObjLib cleanup done.
WORKER: asyncOps=0 maxActiveOps=0 maxPending=0 maxCompleted=0

  1. List out the open files under this UUID by running this command:

    lsof | grep 003e96eb-9f51034a

    Example:

    lsof | grep 003e96eb-9f51034a
    2101956     sh                    cwd                        -1   

     
  2. Stop the process by running this command:

    kill -9 PID

    Example:

    kill -9 2101956
     
  3. You should now be able to remove the NFS mount successfully.

  

Đọc thêm..

Mysql Making a Differential or Incremental Backup

Mysql Making a Differential or Incremental Backup

https://dev.mysql.com/doc/mysql-enterprise-backup/8.0/en/mysqlbackup.incremental.html

https://snapshooter.com/learn/mysql/mysql-incremental-backup

https://www.cloudpanel.io/tutorial/how-to-set-up-mysql-incremental-backups/

 

Note: mysql 8

 

Đọc thêm..

Auto generate css

Auto generate css

 https://animista.net/play/basic

Đọc thêm..

Backup Proxmox Server add NFS share

 fstab in PBS VM:

Code:
#NFS PBS
192.168.49.4:/mnt/HDDpool/VeryLongDatasetName/VLT/NRM/PBS /mnt/pbs  nfs      defaults,nfsvers=3    0       0

datastore.cfg:
Code:
cat /etc/proxmox-backup/datastore.cfg
datastore: PBS_DS1
        comment for weekly and manual stop backups
        gc-schedule sun 07:00
        path /mnt/pbs
 
note: 
- Create .chunks folder in mount point.
- Grant permission on mount point
- User on PBS is backup 
Đọc thêm..

Send desktop notifications and reminders from Linux terminal

 

Sending notifications from the Linux terminal

To send notifications from the Linux terminal, use the notify-send command. It's often already installed as a part of your desktop, but you can run which notify-send to confirm. If it's not installed yet, install it with your package manager of choice.

On Fedora and similar distributions, type:

$ sudo dnf install libnotify

On Debian-based distributions, type:

$ sudo apt install notify-send

A few examples of simple notifications:

$ notify-send "Dinner ready!"
$ notify-send "Tip of the Day" "How about a nap?"

You can customize the notification with options such as urgency level, custom icon, and so on. Find out more with man notify-send. You can use a small set of HTML tags in the notification body to give your messages a nice touch. On top of that, URLs are rendered as clickable. For example:

$ notify-send -u critical \
  "Build failed!" \
  "There were <b>123</b> errors. Click here to see the results: http://buildserver/latest

Sent notifications are picked up by the desktop environment and displayed just like any other notification. They will have the same consistent look, feel, and behavior.

Combine notify-send with at

Cron is commonly used to schedule commands at regular intervals. The at command schedules the single execution of a command at a specified time. If you run it like this, it starts in interactive mode, where you can enter commands to execute at a given time:

$ at 12:00

This isn't useful for scripts. Luckily, at accepts parameters from standard input so that we can use it this way:

$ echo "npm run build" | at now + 1 minute $ echo "backup-db" | at 13:00

There are many ways of specifying time. From absolute time, such as 10:00 through relative time, such as now + 2 hours, to special times such as noon or midnight. We can combine it with notify-send to show ourselves reminders at some time in the future. For example:

$ echo "notify-send 'Stop it and go home now?' 'Enough work for today.' -u
critical" | at now

The remind command

Now, build a custom Bash command for sending yourself reminders. How about something as simple and human-friendly as:

$ remind "I'm still here" now $ remind "Time to wake up!" in 5 minutes $ remind "Dinner" in 1 hour $ remind "Take a break" at noon $ remind "It's Friday pints time!" at 17:00

See the code below. It defines a shell function called remind, which supports the above syntax. The actual work is done in the last two lines. The rest is responsible for help, parameter validation, etc., which roughly matches the proportion of useful code vs. necessary white-noise in any large application.

Save the code somewhere, for example, in the ~/bin/remind file, and source the function in your .bashrc profile so that it's loaded when you log in:

$ source ~/bin/remind

Reload the terminal, then type remind to see the syntax. Enjoy!

#!/usr/bin/env bash
function remind () {
  local COUNT="$#"
  local COMMAND="$1"
  local MESSAGE="$1"
  local OP="$2"
  shift 2
  local WHEN="$@"
  # Display help if no parameters or help command
  if [[ $COUNT -eq 0 || "$COMMAND" == "help" || "$COMMAND" == "--help" || "$COMMAND" == "-h" ]]; then
    echo "COMMAND"
    echo "    remind <message> <time>"
    echo "    remind <command>"
    echo
    echo "DESCRIPTION"
    echo "    Displays notification at specified time"
    echo
    echo "EXAMPLES"
    echo '    remind "Hi there" now'
    echo '    remind "Time to wake up" in 5 minutes'
    echo '    remind "Dinner" in 1 hour'
    echo '    remind "Take a break" at noon'
    echo '    remind "Are you ready?" at 13:00'
    echo '    remind list'
    echo '    remind clear'
    echo '    remind help'
    echo
    return
  fi
  # Check presence of AT command
  if ! which at >/dev/null; then
    echo "remind: AT utility is required but not installed on your system. Install it with your package manager of choice, for example 'sudo apt install at'."
    return
  fi
  # Run commands: list, clear
  if [[ $COUNT -eq 1 ]]; then
    if [[ "$COMMAND" == "list" ]]; then
      at -l
    elif [[ "$COMMAND" == "clear" ]]; then
      at -r $(atq | cut -f1)
    else
      echo "remind: unknown command $COMMAND. Type 'remind' without any parameters to see syntax."
    fi
    return
  fi
  # Determine time of notification
  if [[ "$OP" == "in" ]]; then
    local TIME="now + $WHEN"
  elif [[ "$OP" == "at" ]]; then
    local TIME="$WHEN"
  elif [[ "$OP" == "now" ]]; then
    local TIME="now"
  else
    echo "remind: invalid time operator $OP"
    return
  fi
  # Schedule the notification
  echo "notify-send '$MESSAGE' 'Reminder' -u critical" | at $TIME 2>/dev/null
  echo "Notification scheduled at $TIME"
}

Easy notifications

Đọc thêm..

Fix – MySQL ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

Fix – MySQL ERROR 1819 (HY000): Your password does not satisfy the current policy requirements.


As you might have noticed, you will be prompted to enable VALIDATE PASSWORD component while setting up password for MySQL root user. If enabled, the Validate Password component will automatically check the strength of the given password and enforce the users to set only the passwords that are secure enough. If you provide a weak password, you will encounter with an error like this - ERROR 1819 (HY000): Your password does not satisfy the current policy requirements.

Technically speaking, it is not actually an error. This is a built-in security mechanism that forces the users to provide only the strong passwords based on the current password policy requirements.

Let me show you an example. I log in to MySQL server as root user using command:

$ mysql -u root -p

Create a database user with a weak password:

mysql> create user 'ostechnix'@'localhost' identified by 'mypassword';

And I encounter with the following error:

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
 

See? The Validate Password component doesn't allow me to create a user with a weak password (i.e. mypassword in this case).

You will keep getting this error until the password meets the requirements of the current password policy or you disable the Validate Password component. We will see how to do it in the following section.

Fix - MySQL ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

There are three levels of password validation policy enforced when Validate Password plugin is enabled:

  • LOW Length >= 8 characters.
  • MEDIUM Length >= 8, numeric, mixed case, and special characters.
  • STRONG Length >= 8, numeric, mixed case, special characters and dictionary file.

Based on these policy levels, you need to set an appropriate password. For example, if the password validation policy is set to Medium, you must set a password that has at least 8 characters including a number, lowercase, uppercase and special characters.

First we need to  find the current password policy level. To do so, run the following command to show Password Validation Plugin system variables:

mysql> SHOW VARIABLES LIKE 'validate_password%';

Sample output:

+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password.check_user_name    | ON     |
| validate_password.dictionary_file    |        |
| validate_password.length             | 8      |
| validate_password.mixed_case_count   | 1      |
| validate_password.number_count       | 1      |
| validate_password.policy             | MEDIUM |
| validate_password.special_char_count | 1      |
+--------------------------------------+--------+
7 rows in set (0.09 sec)

As you can see, the currently enforced password level is Medium. So our password should be 8  characters long with a number, mixed case and special characters.

I am going to set this password - Password123#@! using command:

mysql> create user 'ostechnix'@'localhost' identified by 'Password123#@!'; Query OK, 0 rows affected (0.36 sec)

 

See? It works now! So, in order to fix the "ERROR 1819 (HY000)..." error, you need to enter a password as per the current password validation policy.

Change password validation policy in MySQL

You can also solve the "ERROR 1819 (HY000)..." by setting up a lower level password policy.

To do so, run the following command from the mysql prompt:

mysql> SET GLOBAL validate_password.policy = 0;

Or,

mysql> SET GLOBAL validate_password.policy=LOW;

Then check if the password validation policy has been changed to low:

mysql> SHOW VARIABLES LIKE 'validate_password%';

Sample output:

+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password.check_user_name    | ON    |
| validate_password.dictionary_file    |       |
| validate_password.length             | 8     |
| validate_password.mixed_case_count   | 1     |
| validate_password.number_count       | 1     |
| validate_password.policy             | LOW   |
| validate_password.special_char_count | 1     |
+--------------------------------------+-------+
7 rows in set (0.00 sec)

Now you can create a user with a weak password like below:

mysql> create user 'senthil'@'localhost' identified by 'password';

To revert back to MEDIUM level policy, simply run this command from mysql prompt:

mysql> SET GLOBAL validate_password.policy=MEDIUM;

If the password policy doesn't change, exit from the mysql prompt and restart mysql service from your Terminal window:

$ sudo systemctl restart mysql

Now it should work.

Heads Up: One of our reader has pointed out that there is typo in the following command:

mysql> SET GLOBAL validate_password.policy=LOW;

It should be:

mysql> SET GLOBAL validate_password_policy=LOW;

Note the underscore in the above command. Since I have deleted the setup, I have no way of verifying this command. But I assume the command has been changed in the newer versions of MySQL.

Disable password validation policy

If you like to create users with weak password, simply disable the Validate Password component altogether and re-enable it back after creating the users.

Log in to the MySQL server:

$ mysql -u root -p

To temporarily disable Validate Password component, run the following command from MySQL prompt:

mysql> UNINSTALL COMPONENT "file://component_validate_password";

Create the users with any password of your choice:

mysql> create user 'kumar'@'localhost' identified by '123456';

Finally, enable Validate Password component:

mysql> INSTALL COMPONENT "file://component_validate_password";
 

 

 

 

 

 

Đọc thêm..