2021年3月11日 星期四

Change NAS password on Win10

 

win+R打開執行,輸入control userpasswords2,會變這樣


再按到進階,管理密碼,windows認證,就可以選要把哪條密碼清除了






 

2021年1月19日 星期二

Esxi increase hard drive size (Ubuntu none LVM)

1 Install parted if you don't have them using 

CI-Server:~$ sudo apt-get install cloud-guest-utils


2. Turn off swap. we gonna remove it's partition!
CI-Server:~$ sudo swapoff -a
CI-Server:~$ sudo parted
get partitions list with print all:
(parted) print all
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 752GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size    Type      File system     Flags
1      1049kB  528GB  528GB   primary   ext4            boot
2      528GB   537GB  8588MB  extended
5      528GB   537GB  8588MB  logical   linux-swap(v1)
remove none root partitions with rm (part-index):

(parted) rm 5
Warning: Partition /dev/vda5 is being used. Are you sure you want to continue?
Yes/No? yes
Error: Partition(s) 5 on /dev/vda have been written, but we have been unable to
inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? C
(parted) print all
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 752GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size    Type      File system  Flags
 1      1049kB  528GB  528GB   primary   ext4         boot
 2      528GB   537GB  8588MB  extended

(parted) rm 2
Error: Partition(s) 5 on /dev/vda have been written, but we have been unable to
inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? C
(parted) print all
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 752GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  528GB  528GB  primary  ext4         boot
The commands works on ubuntu 16.04 (NONE LVM) and machine is running on a kvm:

sudo growpart /dev/vda 1
sudo resize2fs /dev/vda1  


How to set /etc/issues to show the IP address of eth0


linux virtual machines with a bridge interface, and I want to display the machine's IP address after the machine is booted (in login, it usually shows the release and kernel).

This is just a text file...you write it in the same way you would send text to the file using any other shell script. Something like this will replace /etc/issue with your ip address:

  1. ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -f2 -d: > /etc/issue


Obviously, depending on the information you want in /etc/issue, you can make this more complex file at will.

You can write to this file using the local equivalent /etc/rc.d/rc.local (usually executed after all other startup scripts).


On CentOS 7 and Debian 8, just append the following line to /etc/issue

  1. My IP address: \4


This will resolve to the machine’s IPv4 address. If you have multiple network interfaces and want to select a specific network interface, you can use specify it

  1. My IP address: \4{eth0}


Check man getty for the list of escape sequences supported by your distribution.

This script will add/remove IP addresses to/from /etc/issue Submit files as needed:

  1. #!/bin/sh
  2. PREFIX="Local IP addresses:"
  3. IPADDRS=$(hostname -I | tr " " "\n" | grep -v "^$" | sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tr "\n" " ")
  4. perl -i -p -0777 -e "s/^$PREFIX[^\n]*\n\n//m; s/$/\n$PREFIX $IPADDRS\n/ if length('$IPADDRS')>6" /etc/issue

If you are using a Debian-based distribution, it is best to put the script in the following location:


  1. /etc/network/if-up.d/update-issue
  2. /etc/network/if-post-down.d/update-issue


In this way, the script will be executed whenever the interface appears or fails. Putting it in /etc/rc.d/rc.local has the disadvantage of only executing it once at startup.



 Ubuntu has a mechanism, that is, the installed network card (NIC) will be renamed to another name when the system is booted. Although there...