linux
ntp
chrony
apt update
apt install -y chrony
systemctl start chrony
systemctl enable chrony
root@ceph-mon-01:~# chronyc activity
200 OK
8 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address
vim /etc/chrony/chrony.conf
#pool ntp.ubuntu.com iburst maxsources 4
#pool 0.ubuntu.pool.ntp.org iburst maxsources 1
#pool 1.ubuntu.pool.ntp.org iburst maxsources 1
#pool 2.ubuntu.pool.ntp.org iburst maxsources 2
pool 0.oceania.pool.ntp.org iburst maxsources 2
pool 1.oceania.pool.ntp.org iburst maxsources 2
pool 2.oceania.pool.ntp.org iburst maxsources 2
pool 3.oceania.pool.ntp.org iburst maxsources 2
vim /etc/chrony/chrony.conf
allow 192.168.1.0/24
systemctl restart chrony
systemctl status chrony
apt update
apt install -y chrony
# Change default ntp pool to the Chrony NTP server
vim /etc/chrony/chrony.conf
#pool ntp.ubuntu.com iburst maxsources 4
#pool 0.ubuntu.pool.ntp.org iburst maxsources 1
#pool 1.ubuntu.pool.ntp.org iburst maxsources 1
#pool 2.ubuntu.pool.ntp.org iburst maxsources 2
server 192.168.1.1 prefer iburst
systemctl restart chrony
15 November 2020
logical volume manager (lvm)
PV - physical volume
VG - volume group
PE - physical extent
LV - logical volume
root@develop:/home/ycheng# lvmdiskscan
/dev/vda2 [ <20.00 GiB]
/dev/vdb [ 20.00 GiB]
/dev/vdc [ 20.00 GiB]
2 disks
1 partition
0 LVM physical volume whole disks
0 LVM physical volumes
# create PV
----------------------------------------------------------------
root@develop:/home/ycheng# pvcreate /dev/vdb
Physical volume "/dev/vdb" successfully created.
root@develop:/home/ycheng# pvcreate /dev/vdc
Physical volume "/dev/vdc" successfully created.
root@develop:/home/ycheng# lvmdiskscan
/dev/vda2 [ <20.00 GiB]
/dev/vdb [ 20.00 GiB] LVM physical volume
/dev/vdc [ 20.00 GiB] LVM physical volume
0 disks
1 partition
2 LVM physical volume whole disks
0 LVM physical volumes
root@develop:/home/ycheng# pvdisplay
"/dev/vdc" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/vdc
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID LraVsw-U2HV-e2nA-z7rc-qKtx-QVmr-YNk0dF
"/dev/vdb" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/vdb
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID o4dT1U-SkDI-lunc-2Q7n-60OJ-40TL-72zoFB
!!! remove PV
pvremove < PV Name >
# create VG
----------------------------------------------------------------
root@develop:/home/ycheng# vgcreate vg1 /dev/vdb /dev/vdc
Volume group "vg1" successfully created
root@develop:/home/ycheng# vgdisplay
--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.99 GiB
PE Size 4.00 MiB
Total PE 10238
Alloc PE / Size 0 / 0
Free PE / Size 10238 / 39.99 GiB
VG UUID OwIsAL-iQSB-FJb0-dGUG-O4ro-1iNK-sw7Baf
!!! create VG with PE size to 128MiB
vgcreate -s 128 vg1 /dev/vdb /dev/vdc
!!! remove VG
vgremove vg1
!!! maximum 65534 PEs.
# create LV
----------------------------------------------------------------
root@develop:/home/ycheng# lvcreate -L 8G -n lv1 vg1
Logical volume "lv1" created.
root@develop:/home/ycheng# lvcreate -l 100%FREE -n lv2 vg1
Logical volume "lv2" created.
root@develop:/home/ycheng# lvdisplay
--- Logical volume ---
LV Path /dev/vg1/lv1
LV Name lv1
VG Name vg1
LV UUID 03jsBD-3XKC-88oZ-XHwJ-uJHw-J92j-MtTGdL
LV Write Access read/write
LV Creation host, time develop, 2020-11-15 05:46:58 +0000
LV Status available
# open 0
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/vg1/lv2
LV Name lv2
VG Name vg1
LV UUID zMhcOs-Xpib-SSyA-fmeI-6puj-k3v8-NXAsb6
LV Write Access read/write
LV Creation host, time develop, 2020-11-15 05:47:59 +0000
LV Status available
# open 0
LV Size 31.99 GiB
Current LE 8190
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
!!! create "striped" allocation type LV 8GB
root@develop:/home/ycheng# lvcreate --type striped -i 2 -L 8G -n striped_lv1 vg1
Using default stripesize 64.00 KiB.
Logical volume "striped_lv1" created.
!!! allocate 100% free extends to create new LV. "-l < extends number >"
root@develop:/home/ycheng# lvcreate --type striped -i 2 -l 100%FREE -n striped_lv2 vg1
Using default stripesize 64.00 KiB.
Logical volume "striped_lv2" created.
!!! remove LV
lvremove /dev/vg1/striped_lv2
Create snapshot and merge (recovery)
----------------------------------------------------------------
root@develop:/home/ycheng# lvcreate -s -L 8G -n snap_striped_lv1 vg1/striped_lv1
Using default stripesize 64.00 KiB.
Logical volume "snap_striped_lv1" created.
root@develop:/home/ycheng# lvconvert --merge vg1/snap_striped_lv1
Merging of volume vg1/snap_striped_lv1 started.
vg1/striped_lv1: Merged: 100.00%
!!! remove snapshot
lvremove
Resize LV
----------------------------------------------------------------
root@develop:/home/ycheng# lvscan
ACTIVE '/dev/vg1/striped_lv1' [8.00 GiB] inherit
root@develop:/home/ycheng# lvresize -L +4G vg1/striped_lv1
Using stripesize of last segment 64.00 KiB
Size of logical volume vg1/striped_lv1 changed from 8.00 GiB (2048 extents) to 12.00 GiB (3072 extents).
Logical volume vg1/striped_lv1 successfully resized.
Remove PV from VG
----------------------------------------------------------------
pvmove /dev/vdc
vgreduce vg1 /dev/vdc
pvremove /dev/vdc
Rename VG
----------------------------------------------------------------
root@develop:/home/ycheng# vgscan
Reading volume groups from cache.
Found volume group "vg1" using metadata type lvm2
root@develop:/home/ycheng# vgrename vg1 new_vg1
Volume group "vg1" successfully renamed to "new_vg1"
root@develop:/home/ycheng# vgscan
Reading volume groups from cache.
Found volume group "new_vg1" using metadata type lvm2
Other commands
----------------------------------------------------------------
vgextend - add new PV to VG
vgchange - change VG attributes
lvextend - increase LV size
lvreduce - reduce LV size
Posted by Knowledge Base 2.0 at 17:29:00 No comments:
Chrony install and configure
[ Setup Chrony NTP server ]
# install and start chrony service
apt update
apt install -y chrony
systemctl start chrony
systemctl enable chrony
root@ceph-mon-01:~# chronyc activity
200 OK
8 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address
# edit config with nearest zone.
vim /etc/chrony/chrony.conf
#pool ntp.ubuntu.com iburst maxsources 4
#pool 0.ubuntu.pool.ntp.org iburst maxsources 1
#pool 1.ubuntu.pool.ntp.org iburst maxsources 1
#pool 2.ubuntu.pool.ntp.org iburst maxsources 2
pool 0.oceania.pool.ntp.org iburst maxsources 2
pool 1.oceania.pool.ntp.org iburst maxsources 2
pool 2.oceania.pool.ntp.org iburst maxsources 2
pool 3.oceania.pool.ntp.org iburst maxsources 2
# allow all client on the same local network
# change to your own IP/networks
vim /etc/chrony/chrony.conf
allow 192.168.1.0/24
systemctl restart chrony
systemctl status chrony
[ Setup NTP client wiht Chrony ]
apt update
apt install -y chrony
# Change default ntp pool to the Chrony NTP server
vim /etc/chrony/chrony.conf
#pool ntp.ubuntu.com iburst maxsources 4
#pool 0.ubuntu.pool.ntp.org iburst maxsources 1
#pool 1.ubuntu.pool.ntp.org iburst maxsources 1
#pool 2.ubuntu.pool.ntp.org iburst maxsources 2
server 192.168.1.1 prefer iburst
systemctl restart chrony
[ Check NTP server used by chronyd service ]
# check on both server or client.
root@ceph-mon-01:~# chronyc sources
210 Number of sources = 8
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^- time.cloudflare.com 3 6 377 47 +680us[ +680us] +/- 7331us
^- ns1.att.wlg.telesmart.co> 2 6 377 49 -2532us[-2532us] +/- 33ms
^- ns1.tdc.akl.telesmart.co> 2 6 377 47 +2926us[+2926us] +/- 20ms
^- ntp2.ds.network 4 6 377 46 +443us[ +443us] +/- 30ms
^* ntp.seby.io 2 6 377 51 -148us[ -198us] +/- 1896us
^- ns2.tdc.akl.telesmart.co> 2 6 377 46 -3574us[-3574us] +/- 23ms
^- ntp03.lagoon.nc 2 6 377 48 -498us[ -498us] +/- 75ms
^- warrane.connect.com.au 3 6 377 47 +750us[ +750us] +/- 129ms
root@ceph-osd-02:/home/ycheng# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.1.1 3 6 17 19 -7870ns[ -13us] +/- 1959us
root@ceph-osd-02:/home/ycheng# chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.1.1 3 6 17 44 -7870ns[ -13us] +/- 1959us
root@ceph-mon-01:~# chronyc clients
Hostname NTP Drop Int IntL Last Cmd Drop Int Last
===============================================================================
ceph-osd-02 6 0 5 - 62 0 0 - -
Setup master&slave DNS servers on Rocky 8.4
Oct 21, 2024Notes for couple useful actions and syntax.
Oct 10, 2024Use GPG for file encription and decryption and basic usage.
Mar 10, 2024last update: 2022-12-09
Nov 20, 2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up