Linux reconfigure timezone
To change the timezone in Linux
Ubuntu
Method 1
dpkg-reconfigure tzdata
Method 2
timedatectl list-timezones
timedatectl set-timezone <timezone>
To change the timezone in Linux
dpkg-reconfigure tzdata
timedatectl list-timezones
timedatectl set-timezone <timezone>
To copy one LV to another VG using LV mirror method. This method can not be performed on-line because of vgsplit
command.
Note: RHEL doesn't have cplv
command.
vgcreate vg01 /dev/vdb
lvcreate -L 1G -n test1 vg01
vgextend vg01 /dev/vdc
lvconvert --type raid1 --mirrors 1 /dev/vg01/test1 /dev/vdc
lvdisplay -m vg01/test1
lvconvert --splitmirrors 1 --name test2 /dev/vg01/test1
lvdisplay -m vg01/test1
lvdisplay -m vg01/test2
vgchange -a n vg01
vgsplit -t -v /dev/vg01 /dev/vg02 /dev/vdc
vgsplit -v /dev/vg01 /dev/vg02 /dev/vdc
lvs
vgchange -a y vg01
vgchange -a y vg02
How to move / copy logical volume (lv) to another volume group (vg)?
To resize btrfs filesystem, run following command
btrfs filesystem resize max /app
dnsmasq
serverWhen doing nslookup, dnsmasq server could not reply the DNS with DOMAIN, but able to reply short dns name only. Following message may appear.
# nslookup www
....
dnsmasq server can't find www.example.com: NXDOMAIN
The reason is that DNS entries in dnsmasq host file (default is banner_add_hosts
) has no domain name
192.168.1.1 www
In dnsmasq.conf
file
Following lines are required. The expand-hosts
option allows appending the domain name defined in domain
line to short hostname in host file
domain=example.com,192.168.1.0/24
expand-hosts
In order to input %
character as command parameter in cron task, it needs to be escaped using backslash ().
man (5) crontab:
Percent-signs (%) in the command, unless escaped with backslash (\),
will be changed into newline characters, and all data after the
first % will be sent to the command as standard input.
rmlint
To exclude files, using find
command, then pass the parameter -
to rmlint
as folder name
$ find /target/dir -type f ! -name '*.nib' ! -name '*.icon' ! -name '*.plist' | rmlint [options] -
For only search specific type of file, can use following command:
find /mm -iname "*.DFF" -type f | rmlint -T df --config=sh:handler=hardlink -
How do I exclude/ignore specific file types/extensions with rmlint?
This is to describe how to convert Oracle Linux 7.9 to Proxmox.
Following hardware options can be considered
sata0
to be considered for disk)disk_image_file
<mac_address>
(This is default for VMware, can use other type too)Convert the VMware disk to Proxmox disk and attach the disk to new VM
qm importdisk 121 oracle18c.vmdk pool240ssd --format qcow2
Attach the disk as sata0.
Select item Oracle Linux Server (0-rescue-ed95572bd80641d79f83cd91e03c0283 with Linux) 7.9
from Grub menu to boot into rescue mode.
Note: Tried other option, all got error and unable to boot
Login as valid user, then find out the kernel to be used
rpm -q -a | grep kernel | sort
Got following list
kernel-3.10.0-1160.25.1.el7.x86_64
kernel-3.10.0-1160.36.2.el7.x86_64
kernel-3.10.0-1160.el7.x86_64
kernel-tools-3.10.0-1160.36.2.el7.x86_64
kernel-tools-libs-3.10.0-1160.36.2.el7.x86_64
kernel-uek-5.4.17-2102.203.6.el7uek.x86_64
kernel-uek-5.4.17-2102.204.4.2.el7uek.x86_64
kernel-uek-5.4.17-2102.204.4.4.el7uek.x86_64
Choose the latest one, which is also Unbreakable Enterprise Kernel
Find scripts in Kernel package
rpm -q kernel-uek-5.4.17-2102.204.4.4.el7uek.x86_64 --scripts
Following posttrans scriptlet shown
...
posttrans scriptlet (using /bin/sh):
/usr/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update 5.4.17-2102.204.4.4.el7uek.x86_64 || exit $?
/usr/sbin/new-kernel-pkg --package kernel --rpmposttrans 5.4.17-2102.204.4.4.el7uek.x86_64 || exit $?
...
Run above commands to rebuild Grub files, then reboot the system to the menu with kernel recreated.
Note: The error Unable to open file: /etc/keys/x509_ima.der (-2)
can be ignored
You can reconfigure network interface the same as VMware, this is to avoid reconfiguration of network settings
Check VMWare vmx
file to find disk type, then set the same in Proxmox
ethernet0.virtualDev = "vmxnet3"
You can change Mac Address using the value in VMWare configuration
ethernet0.generatedAddress = "00:11c:22:33:44:55"
Find out the interface in /etc/sysconfig/network-scripts
as below.
/etc/sysconfig/network-scripts/ifcfg-ens192
The interface name is ifcfg-ens192
Create the file /etc/udev/rules.d/70-custom-ifnames.rules
with the following contents:
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="00:11:22:33:44:55",ATTR{type}=="1",NAME="ens192"
Then reboot the server, then check the Interface and IP address using ip a
command.
In order to start a tmux session background, following command can be used
tmux new-session -d [-s <session_name>]
To remove duplicated hard link files using following command. The hard link files could be created by rmlint
deduplication.
find . -type f -links +1 -printf '%i %n %p\n' -exec rm '{}' \;