openvz df show all mountpoint containers - openvz

Welcome,
After install openvz in debian whezzy, and create containers, df in node show all mountpoint :
root#lab:~# df -h   System plików
rozm. użyte dost. %uż. zamont. na udev
10M 0 10M 0% /dev tmpfs
786M 412K 785M 1% /run
/dev/disk/by-uuid/fa994ffe-9e83-4f5a-acbc-8cb9f1c1ac65 37G 1,1G
34G 4% / tmpfs
5,0M 0 5,0M 0% /run/lock tmpfs
3,9G 0 3,9G 0% /run/shm /dev/md2
411G 828M 389G 1% /vz /var/lib/vz/private/10
20G 324M 20G 2% /vz/root/10 tmpfs
3,9G 0 3,9G 0% /vz/root/10/sys/fs/cgroup devtmpfs
3,9G 0 3,9G 0% /vz/root/10/dev tmpfs
3,9G 0 3,9G 0% /vz/root/10/dev/shm tmpfs
3,9G 8,1M 3,9G 1% /vz/root/10/run tmpfs
3,9G 0 3,9G 0% /vz/root/10/run/lock none
3,9G 0 3,9G 0% /vz/root/10/run/shm tmpfs
3,9G 0 3,9G 0% /vz/root/10/tmp /var/lib/vz/private/20
2,0G 323M 1,7G 16% /vz/root/20 devtmpfs
128M 0 128M 0% /vz/root/20/dev tmpfs
128M 0 128M 0% /vz/root/20/dev/shm tmpfs
128M 4,1M 124M 4% /vz/root/20/run tmpfs
5,0M 0 5,0M 0% /vz/root/20/run/lock tmpfs
128M 0 128M 0% /vz/root/20/sys/fs/cgroup tmpfs
128M 0 128M 0% /vz/root/20/tmp none
128M 0 128M 0% /vz/root/20/run/shm
How to remove/delete visibe mountpoint all containers?

You have link from /etc/mtab to /proc/mounts. You can try removing this link, copy contents of /proc/mounts to /etc/mtab and remove all occurrences of /vz/root from the mtab. After that mount would keep correct contents of mtab without /vz/root

You don't. I guess you could pipe the output to grep with the -v option and filter out what you don't want to see.

Related

mount - can't find /dev/sdc in fstab error

I'm trying to mount xfs disk.
I prepared directories.
sudo mkdir /grid/;
sudo mkdir /grid/0;
then I tried
sudo mount -t xfs /dev/sdc /grid/0;
But I always receive
can't find /dev/sdc /grid/0 in /etc/fstab
My fstab looks like this
#
# /etc/fstab
# Created by anaconda on Tue Dec 18 11:05:19 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=xxx /boot xfs defaults 0 0
UUID=zzz /boot/efi vfat umask=0077,shortname=winnt 0 0
/dev/mapper/rhel-home /home xfs defaults 0 0
/dev/mapper/rhel-var_log /var/log xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
/dev/sdc /grid/0 xfs defaults,noatime 0 0
/dev/sdd /grid/1 xfs defaults,noatime 0 0
/dev/sde /grid/2 xfs defaults,noatime 0 0
/dev/sdf /grid/3 xfs defaults,noatime 0 0
/dev/sdg /grid/4 xfs defaults,noatime 0 0
/dev/sdh /grid/5 xfs defaults,noatime 0 0
/dev/sdi /grid/6 xfs defaults,noatime 0 0
/dev/sdj /grid/7 xfs defaults,noatime 0 0
is something wrong with my fstab ? I can't find what I did wrong.
edit: lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 447.1G 0 disk
\u251c\u2500sda1 8:1 0 200M 0 part /boot/efi
\u251c\u2500sda2 8:2 0 1G 0 part /boot
\u2514\u2500sda3 8:3 0 445.9G 0 part
\u251c\u2500rhel-root 253:0 0 361.9G 0 lvm /
\u251c\u2500rhel-swap 253:1 0 4G 0 lvm [SWAP]
\u251c\u2500rhel-home 253:2 0 50G 0 lvm /home
\u2514\u2500rhel-var_log 253:3 0 30G 0 lvm /var/log
sdc 8:32 0 3.7T 0 disk
sdd 8:48 0 3.7T 0 disk
sde 8:64 0 3.7T 0 disk
sdf 8:80 0 3.7T 0 disk
sdg 8:96 0 3.7T 0 disk
sdh 8:112 0 3.7T 0 disk
sdi 8:128 0 3.7T 0 disk
sdj 8:144 0 3.7T 0 disk
The issue was caused by non-breakable space which was mixed in fstab records and in mount command.
After converting text to ASCII and checking on "Show All Characters" in notepad++ I replaced all non-breakable space with ordinary space and command finished successfully.

Emacs regular freezes: How to identify cause?

I'm having regular freezes in Emacs (every 15 Seconds and then for 2 to 3 Seconds).
I stated the Profiler with CPU:
- ... 4588 44%
Automatic GC 4588 44%
+ redisplay_internal (C function) 3405 33%
+ command-execute 1887 18%
+ timer-event-handler 384 3%
+ flyspell-post-command-hook 18 0%
+ undo-auto--add-boundary 8 0%
+ internal-echo-keystrokes-prefix 8 0%
+ delete-selection-pre-hook 7 0%
+ eldoc-schedule-timer 3 0%
tooltip-hide 3 0%
internal-timer-start-idle 2 0%
+ gui-set-selection 2 0%
+ global-visual-line-mode-check-buffers 1 0%
+ deactivate-mark 1 0%
How can i proceed from here to identify the root cause.
This kind of freeze is annoying when typing longer code or text.
Any help is highly appreciated.
Thanks

What is the difference bewteen SWAP and Virtual mmeory in Linux

Why I am not seeing any SWAP usage in below scenario, even though the virtual memory is showing 20gig ?
Tasks: 186 total, 1 running, 185 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.2%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 32880880k total, 17555744k used, 15325136k free, 300268k buffers
Swap: 16383996k total, 0k used, 16383996k free, 2287700k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10314 abcuser 20 0 20.3g 6.8g 25m S 0.7 21.8 23:47.38 java
25119 abcuser 20 0 20.3g 6.7g 25m S 0.3 21.4 23:38.25 java
total used free shared buffers cached
Mem: 31 16 14 0 0 2
-/+ buffers/cache: 14 17
Swap: 15 0 15
Total: 46 16 30
Regards
Sanjeev

Postgres Out of Memory

I am setting up a new install of postgres 10.4 and during load testing I keep receiving an out of memory error.
Configuration:
$ cat /etc/security/limits.conf
postgres hard memlock 508559360
postgres soft memlock 508559360
$ cat /etc/sysctl.conf
vm.nr_hugepages = 248320
vm.hugetlb_shm_group = 118
vm.overcommit_memory=2
vm.swappiness=1
vm.vfs_cache_pressure=50
kernel.sem = 250 32000 32 128
System Specs:
$ cat /proc/cpuinfo | grep "core id" | wc -l
32
Each CPU is an Intel(R) Xeon(R) CPU E5-2695 v4 # 2.10GHz. 16 physical cores, 32 logical as shown above.
$ free -m
free -m
total used free shared buff/cache available
Mem: 510969 498048 2434 3098 10485 8343
Swap: 1071 1071 0
Note: we have the memlock set at approximately 485 GB dedicated directly to postgres which shows in the high "used" column.
$ df -h /dev/shm
Filesystem Size Used Avail Use% Mounted on
tmpfs 250G 64K 250G 1% /dev/shm
$ cat /proc/meminfo
MemTotal: 523232496 kB
MemFree: 1216648 kB
MemAvailable: 8348808 kB
Buffers: 65220 kB
Cached: 10211780 kB
SwapCached: 7620 kB
Active: 5556092 kB
Inactive: 5432428 kB
Active(anon): 2208064 kB
Inactive(anon): 1593084 kB
Active(file): 3348028 kB
Inactive(file): 3839344 kB
Unevictable: 24128 kB
Mlocked: 24128 kB
SwapTotal: 1097724 kB
SwapFree: 0 kB
Dirty: 52 kB
Writeback: 0 kB
AnonPages: 728044 kB
Mapped: 62904 kB
Shmem: 3085592 kB
Slab: 1454276 kB
SReclaimable: 1345008 kB
SUnreclaim: 109268 kB
KernelStack: 11984 kB
PageTables: 22856 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 15770860 kB
Committed_AS: 7920136 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 71680 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 248320
HugePages_Free: 245883
HugePages_Rsvd: 1800
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 329600 kB
DirectMap2M: 534444032 kB
Postgres Info:
SELECT version();
PostgreSQL 10.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609, 64-bit
max_connections=600
shared_buffers= '8192 MB'
work_mem = '20 MB'
maintenance_work_mem = 2GB
max_parallel_workers = 8
wal_buffers = 16MB
max_wal_size = 20GB
min_wal_size = 1GB
checkpoint_completion_target = 0.9
effective_cache_size = '364 GB'
default_statistics_target = 1000
log_timezone = 'US/Eastern'
track_activities = on
track_counts = on
track_io_timing = on
stats_temp_directory = 'pg_stat_tmp'
datestyle = 'iso, mdy'
timezone = 'US/Eastern'
default_text_search_config = 'pg_catalog.english'
transform_null_equals = on
shared_preload_libraries = 'pg_stat_statements'
track_activity_query_size = 16384
track_functions = all
track_io_timing = true
pg_stat_statements.track = all
session_preload_libraries = 'auto_explain'
auto_explain.log_min_duration = '3s'
auto_explain.log_nested_statements='on'
auto_explain.log_analyze=true
Note: I've started w/ work memory set as high as 250 MB and have slowly brought it down to 20 MB and still receive the errors. I've also verified that connections don't go higher than 120 connections. We use PGBouncer in front of the instance in session mode.
The errors are too large for stack overflow but here they are linked:
https://codepad.co/snippet/derPU4E8
The standout errors are:
2018-06-18 15:02:22 EDT,28197,mydb,ERROR: could not resize shared memory segment "/PostgreSQL.1552129380" to 192088 bytes: No space left on device
I don't understand what device its talking about. I don't have any that appear to be even close to OOM let alone the tiny 192088 bytes its talking about.
2018-06-18 15:02:22 EDT,19708,mydb,ERROR: out of memory
2018-06-18 15:02:22 EDT,19708,mydb,DETAIL: Failed on request of size 7232.
2018-06-18 15:02:22 EDT,16688,,LOG: could not fork worker process: Cannot allocate memory
2018-06-18 15:02:22 EDT,4555,,ERROR: out of memory
2018-06-18 15:02:22 EDT,4555,,DETAIL: Failed on request of size 78336.
2018-06-18 15:02:22 EDT,4552,,LOG: could not open directory "/usr/lib/postgresql/10/share/timezone": Cannot allocate memory
2018-06-18 15:02:22 EDT,19935,mydb,ERROR: could not load library "/usr/lib/postgresql/10/lib/auto_explain.so": /usr/lib/postgresql/10/lib/auto_explain.so: failed to map segment from shared object
2018-06-18 15:02:22 EDT,28193,mydb,ERROR: out of memory
2018-06-18 15:02:22 EDT,28193,mydb,DETAIL: Failed on request of size 8192.
2018-06-18 15:02:22 EDT,26927,mydb,ERROR: could not resize shared memory segment "/PostgreSQL.1101931262" to 192088 bytes: No space left on device
Question: How do I debug this issue and more importantly how can I resolve it?
I followed Laurenz advice and no longer run OOM.
vm.overcommit_ratio = 100.
Additionally, I removed the memlock and huge pages definition in sysctl/limits.
Check to see if your queries are so complicated that they need to consume a large amount of temporary tablespace.

Move last column title name and put to be on first column on all rows

Want to get the last column in the title in that example is "db5b", and to place in to the first column on every next row.
Output:
Filesystem utilization for db5b
/dev/hd4 3.00 2.87 5% 5728 1% /
/dev/hd2 7.00 2.79 61% 61845 9% /usr
/dev/hd9var 7.00 5.88 17% 861 1% /var
/dev/hd3 3.00 2.98 1% 205 1% /tmp
Expected result:
db5b 5% /
db5b 61% /usr
db5b 17% /var
db5b 1% /tmp
I use that but not able to figure out how to place db5b to be on the first column:
awk '{print $3, $7}'
I guess if want to finish the result with awk to use NF but not sure how to finish the command.
Like this, for example:
$ awk 'NR==1 {a=$NF} NR>1 && $0 {print a,$4,$7}' file
db5b 5% /
db5b 61% /usr
db5b 17% /var
db5b 1% /tmp
Explanation
NR==1 {a=$NF} on first line, save the last field into var a.
NR>1 && $0 {print a,$4,$7} on lines after the first with some data, print the value plus 4th and 7th fields.
And for an input like Vijay's:
$ awk '/Filesystem/ {a=$NF} /^\// {print a,$4,$7}' file
db5b 5% /
db5b 61% /usr
db5b 17% /var
db5b 1% /tmp
db6b 5% /
db6b 61% /usr
db6b 17% /var
db6b 1% /tmp
this one-liner gives what you wanted:
awk 'NR==1{t=$NF;next}$0{print t,$4,$NF}' file
EDIT
for different titles:
awk 'NF==4{t=$NF;next}$0{print t,$4,$NF}' file
awk '$4!~/%/ && NF>0{a=$NF;next}{print a,$4,$7}' your_file
Test:
> cat temp
Filesystem utilization for db5b
/dev/hd4 3.00 2.87 5% 5728 1% /
/dev/hd2 7.00 2.79 61% 61845 9% /usr
/dev/hd9var 7.00 5.88 17% 861 1% /var
/dev/hd3 3.00 2.98 1% 205 1% /tmp
Filesystem utilization for db6b
/dev/hd4 3.00 2.87 5% 5728 1% /
/dev/hd2 7.00 2.79 61% 61845 9% /usr
/dev/hd9var 7.00 5.88 17% 861 1% /var
/dev/hd3 3.00 2.98 1% 205 1% /tmp
> awk '$4!~/%/ && NF>0{a=$NF;next}{print a,$4,$7}' temp
db5b 5% /
db5b 61% /usr
db5b 17% /var
db5b 1% /tmp
db6b 5% /
db6b 61% /usr
db6b 17% /var
db6b 1% /tmp
>
If you wanted something non-awk:-
#!/usr/bin/env bash
set -x
while read -r
do
output=$(echo "${REPLY}" | tr -s ' ')
drive=$(echo "${output}" | cut -f7)
percent=$(echo "${output}" | cut -f4)
echo -e "db5b\t${percent}\t${drive}"
done < fs_utilisation
The -e switch to echo may be bash-only, and thus non-portable. I apologise if so; you will have to check. The reason why I used the -e switch is because it will interpret \t to give you tabs between your fields.