ng build --prod --base-href .
new version
ng build --configuration=production --baseHref=.
Linux Tutorial and something else…..
I don't know what's the matter with people: they don't learn by understanding, they learn by some other way — by rote or something. Their knowledge is so fragile! (Feynman)
ng build --prod --base-href .
new version
ng build --configuration=production --baseHref=.
1. Shut down the VM from Hypervisor
2. Expand the disk capacity from settings with your desired value. Here we choose to expand the VHD with additional 60 GB space.
3. Start the VM from the hypervisor.
4. Login to virtual machine console as root.
5. Execute below command to check the disk space.
fdisk -l
6. Now execute this below command to initialize the expanded space and mount it.
fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').
7. After this enter ‘n’ in the next line for creating new partition.
Command action e extended p primary partition (1-4) p
8. Then assign the partition number you wish based on your existing partition numbering.If you have to expand existing linux space you have in anycase create a new partition /dev/sda3 or /dev/sda4 if was already created before.
Partition number (1-4): 3
Partition number (1-4): 3 Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM)
9. In the next line choose code ‘8e’ for select the LINUX OS
Hex code (type L to list codes): 8e
Hex code (type L to list codes): 8e Changed system type of partition 3 to 8e (Linux LVM)
10. Next enter ‘w’ to proceed further.
Command (m for help): w
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
11. Reboot the system.
12. Now we need to create physical & logical volumes execute below command to create physical volume.
pvcreate /dev/sda3
13. Execute below command to get the name of current Volume Group
vgdisplay
14. Execute below command to extend the Volume Group with /dev/sda3
vgextend VolGroup /dev/sda3
15. Execute below command to get Logical Volume path.
lvdisplay
16. Execute below command to extend the Logical Volume with /dev/sda3
lvextend /dev/VolGroup/lv_root /dev/sda3
or
lvextend -l+100%FREE /dev/VolGroup/lv_root
17. Execute below command to update the Logical Volume
xfs_growfs /dev/VolGroup/lv_root
18. Check for the new disk space.
>df -h
19. Your Disk space is now successfully increased with 60 GB.
Real example of increasing space :
Status disk before the physical space extension with fdisk /dev/sda > p
Disk /dev/sda: 182.5 GB, 182536110080 bytes, 356515840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Identificativo disco: 0x000d7440
Dispositivo Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 167772159 82836480 8e Linux LVM
/dev/sda3 167772160 209715199 20971520 83 Linux
/dev/sda4 209715200 356515839 73400320 8e Linux LVM
Disk /dev/mapper/centos-root: 150.3 GB, 150319661056 bytes, 293593088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 29.0 GB, 28982640640 bytes, 56606720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Status disk after the physical space extension with fdisk /dev/sda > p
Disk /dev/sda: 236.2 GB, 236223201280 bytes, 461373440 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Identificativo disco: 0x000d7440
Dispositivo Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 167772159 82836480 8e Linux LVM
/dev/sda3 167772160 209715199 20971520 83 Linux
/dev/sda4 209715200 356515839 73400320 8e Linux LVM
Disk /dev/mapper/centos-root: 150.3 GB, 150319661056 bytes, 293593088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 29.0 GB, 28982640640 bytes, 56606720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
The technical steps
First step extend last partition thats means delete and recreate the primary partition in my case sda4:
(snapshot done)
fdisk /dev/sda
p > take note of beginning of sda4 just in case
d > 4
n > p > 4 (default) > >
t > 4 > 8e (to mark it as LVM partition)
w
reboot
Resize the lvm :
pvscan > to make sure we have free space
[root@foras ~]# pvscan
PV /dev/sda2 VG centos lvm2 [<79,00 GiB / 0 free]
PV /dev/sda3 VG centos lvm2 [<20,00 GiB / 0 free]
PV /dev/sda4 VG centos lvm2 [<70,00 GiB / 0 free]
Total: 3 [<168,99 GiB] / in use: 3 [<168,99 GiB] / in no VG: 0 [0 ]
[root@foras ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 220G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 79G 0 part
│ ├─centos-root 253:0 0 140G 0 lvm /
│ ├─centos-swap 253:1 0 2G 0 lvm [SWAP]
│ └─centos-home 253:2 0 27G 0 lvm /home
├─sda3 8:3 0 20G 0 part
│ └─centos-root 253:0 0 140G 0 lvm /
└─sda4 8:4 0 120G 0 part
└─centos-root 253:0 0 140G 0 lvm /
sr0 11:0 1 1024M 0 rom
[root@foras ~]# pvdisplay
— Physical volume —
PV Name /dev/sda2
VG Name centos
PV Size <79,00 GiB / not usable 3,00 MiB
Allocatable yes (but full)
PE Size 4,00 MiB
Total PE 20223
Free PE 0
Allocated PE 20223
PV UUID 1p8aba-7K7p-KAyB-5GFX-zVFX-gxM8-71BlqX
— Physical volume —
PV Name /dev/sda3
VG Name centos
PV Size 20,00 GiB / not usable 4,00 MiB
Allocatable yes (but full)
PE Size 4,00 MiB
Total PE 5119
Free PE 0
Allocated PE 5119
PV UUID 3Vu6jg-Nime-AMmf-6Cby-3QDS-Pn6X-Pb5Tzn
— Physical volume —
PV Name /dev/sda4
VG Name centos
PV Size <70,00 GiB / not usable 3,00 MiB
Allocatable yes (but full)
PE Size 4,00 MiB
Total PE 17919
Free PE 0
Allocated PE 17919
PV UUID 5PExzl-pOWJ-Tyki-v47t-dh7z-erCO-IgSzP0
pvresize /dev/sda4
lvscan > to take note of lv path
lvextend -l +100%FREE /dev/centos/root
[root@foras ~]# pvresize /dev/sda4
Physical volume “/dev/sda4” changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
[root@foras ~]# lvscan
ACTIVE ‘/dev/centos/swap’ [2,00 GiB] inherit
ACTIVE ‘/dev/centos/home’ [26,99 GiB] inherit
ACTIVE ‘/dev/centos/root’ [<140,00 GiB] inherit
[root@foras ~]# lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from <140,00 GiB (35839 extents) to <190,00 GiB (48639 extents).
xfs_growfs /
[root@foras ~]# xfs_growfs /
meta-data=/dev/mapper/centos-root isize=512 agcount=12, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=36699136, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 36699136 to 49806336
[root@foras ~]# pvscan
PV /dev/sda2 VG centos lvm2 [<79,00 GiB / 0 free]
PV /dev/sda3 VG centos lvm2 [<20,00 GiB / 0 free]
PV /dev/sda4 VG centos lvm2 [<120,00 GiB / 0 free]
Total: 3 [<218,99 GiB] / in use: 3 [<218,99 GiB] / in no VG: 0 [0 ]
history
1001 df -ha
1002 vgdisplay
1003 lvdisplay
1004 vgdisplay
1005 vgextend centos /dev/sda4
1006 lvdisplay
1007 lvextend -l+100%FREE /dev/centos/root
1008 df -ha
1009 df -h
1010 xfs_growfs centos
1011 df -h
1012 pvcreate /dev/sda4
1013 vgdispaly
1014 vgdisplay
1015 vgextend centos /dev/sda4
1016 resize2fs /dev/centos/root
1017 fsadm resize /dev/centos/root
1018 df -ha
1019 pvscan
1020 fdisk /dev/sda
1021 htop
1022 pvcreate /dev/sda4
1023 lsblk
1024 pvcreate /dev/sda4
1025 pvcreate –force /dev/sda4
1026 htop
1027 pvcreate –force –force /dev/sda4
1028 umount /dev/sda4
1029 lvchange -an /dev/centos/root
1030 pvcreate –force /dev/sda4
1031 wipefs -a /dev/sda4
1032 pvcreate –force /dev/sda4
1033 lsof /dev/sda4
1034 mount | grep /dev/sda4
1035 lvdisplay
1036 lvchange -an /dev/centos/root
1037 dmsetup remove /dev/sda4
1038 wipefs -a /dev/sda4
1039 blkid /dev/sda4
1040 partprobe /dev/sda
1041 dmsetup ls
1042 vgreduce centos /dev/sda4
1043 pvscan
1044 lvextend -l +100%FREE /dev/centos/root
1045 lsblk
1046 pvdisplay
1047 pvresize /dev/sda4
1048 lvscan
1049 lvextend -l +100%FREE /dev/centos/root
1050 df -ha
1051 xfs_growfs /
1052 df -ha
1053 history
1054 pvscan
I needed to do this on the VPS and none of the provided solutions worked for me,
this answer did the trick
so, it is about reading random data from the drive and assessing the time.
time for i in `seq 1 1000`; do
dd bs=4k if=/dev/sda count=1 skip=$(( $RANDOM * 128 )) >/dev/null 2>&1;
done
here are my results for SSD
real 0m1.375s
user 0m0.285s
sys 0m0.944s
and HDD
real 0m14.249s
user 0m0.752s
sys 0m6.284s
The /proc/cpuinfo file contains details about individual cpu cores. Output its contents with less or cat.
$ less /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz stepping : 10 microcode : 0xa07 cpu MHz : 1998.000 cache size : 2048 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dtherm tpr_shadow vnmi flexpriority bogomips : 5303.14 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:
Every processor or core is listed separately the various details about speed, cache size and model name are included in the description.
To count the number of processing units use grep with wc
$ cat /proc/cpuinfo | grep processor | wc -l 4
The number of processors shown by /proc/cpuinfo might not be the actual number of cores on the processor. For example a processor with 2 cores and hyperthreading would be reported as a processor with 4 cores.
To get the actual number of cores, check the core id for unique values
$ cat /proc/cpuinfo | grep 'core id' core id : 0 core id : 2 core id : 1 core id : 3
So there are 4 different core ids. This indicates that there are 4 actual cores.
lscpu is a small and quick command that does not need any options. It would simply print the cpu hardware details in a user-friendly format.
$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 23 Stepping: 10 CPU MHz: 1998.000 BogoMIPS: 5303.14 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 2048K NUMA node0 CPU(s): 0-3
Hardinfo is a gtk based gui tool that generates reports about various hardware components. But it can also run from the command line only if there is no gui display available.
$ hardinfo | less
It would produce a large report about many hardware parts, by reading files from the /proc directory. The cpu information is towards the beginning of the report. The report can also be written to a text file.
Hardinfo also performs a few benchmark tests taking a few minutes before the report is displayed.
The lshw command can display limited information about the cpu. lshw by default shows information about various hardware parts, and the ‘-class’ option can be used to pickup information about a specific hardware part.
$ sudo lshw -class processor *-cpu description: CPU product: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz vendor: Intel Corp. physical id: 0 bus info: cpu@0 version: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz slot: LGA 775 size: 1998MHz capacity: 4GHz width: 64 bits clock: 333MHz capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx x86-64 constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dtherm tpr_shadow vnmi flexpriority cpufreq
The vendor, model and speed of the processor are being shown correctly. However it is not possible to deduce the number of cores on the processor from the above output.
The nproc command just prints out the number of processing units available. Note that the number of processing units might not always be the same as number of cores.
$ nproc 4
The dmidecode command displays some information about the cpu, which includes the socket type, vendor name and various flags.
$ sudo dmidecode -t 4 # dmidecode 2.12 SMBIOS 2.4 present. Handle 0x0000, DMI type 4, 35 bytes Processor Information Socket Designation: LGA 775 Type: Central Processor Family: Pentium D Manufacturer: Intel(R) Corporation ID: 7A 06 01 00 FF FB EB BF Signature: Type 0, Family 6, Model 23, Stepping 10 Flags: FPU (Floating-point unit on-chip) VME (Virtual mode extension) DE (Debugging extension) PSE (Page size extension) TSC (Time stamp counter) MSR (Model specific registers) PAE (Physical address extension) MCE (Machine check exception) CX8 (CMPXCHG8 instruction supported) APIC (On-chip APIC hardware supported) SEP (Fast system call) MTRR (Memory type range registers) PGE (Page global enable) MCA (Machine check architecture) CMOV (Conditional move instruction supported) PAT (Page attribute table) PSE-36 (36-bit page size extension) CLFSH (CLFLUSH instruction supported) DS (Debug store) ACPI (ACPI supported) MMX (MMX technology supported) FXSR (FXSAVE and FXSTOR instructions supported) SSE (Streaming SIMD extensions) SSE2 (Streaming SIMD extensions 2) SS (Self-snoop) HTT (Multi-threading) TM (Thermal monitor supported) PBE (Pending break enabled) Version: Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz Voltage: 1.6 V External Clock: 333 MHz Max Speed: 4000 MHz Current Speed: 2666 MHz Status: Populated, Enabled Upgrade: Socket LGA775 L1 Cache Handle: 0x0003 L2 Cache Handle: 0x0001 L3 Cache Handle: Not Provided Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified
The cpuid command fetches CPUID information about Intel and AMD x86 processors.
The program can be installed with apt on ubuntu
$ sudo apt-get install cpuid
And here is sample output
$ cpuid ..... Vendor ID: "GenuineIntel"; CPUID level 13 Intel-specific functions: Version 0001067a: Type 0 - Original OEM Family 6 - Pentium Pro Model 7 - Pentium III/Pentium III Xeon - external L2 cache Stepping 10 Reserved 4 Extended brand string: "Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz" CLFLUSH instruction cache line size: 8 Initial APIC ID: 2 Hyper threading siblings: 4 Feature flags bfebfbff: FPU Floating Point Unit VME Virtual 8086 Mode Enhancements DE Debugging Extensions PSE Page Size Extensions TSC Time Stamp Counter MSR Model Specific Registers PAE Physical Address Extension MCE Machine Check Exception CX8 COMPXCHG8B Instruction APIC On-chip Advanced Programmable Interrupt Controller present and enabled SEP Fast System Call MTRR Memory Type Range Registers PGE PTE Global Flag MCA Machine Check Architecture CMOV Conditional Move and Compare Instructions FGPAT Page Attribute Table PSE-36 36-bit Page Size Extension CLFSH CFLUSH instruction DS Debug store ACPI Thermal Monitor and Clock Ctrl MMX MMX instruction set FXSR Fast FP/MMX Streaming SIMD Extensions save/restore SSE Streaming SIMD Extensions instruction set SSE2 SSE2 extensions SS Self Snoop HT Hyper Threading TM Thermal monitor 31 reserved .....
Inxi is a script that uses other programs to generate a well structured easy to read report about various hardware components on the system. Check out the full tutorial on inxi.
$ sudo apt-get install inxi
Print out cpu/processor related information
$ inxi -C CPU: Quad core Intel Core2 Quad CPU Q8400 (-MCP-) cache: 2048 KB flags: (lm nx sse sse2 sse3 sse4_1 ssse3 vmx) Clock Speeds: 1: 1998.00 MHz 2: 1998.00 MHz 3: 1998.00 MHz 4: 1998.00 MHz
After the pg installation I tried to reset the pgadmin password but i had this problem:
[error] [pid 12033] mod_wsgi.c(1631): [client SMTPRecipientsRefused: {u’info@xxxx.xx’: (450, ‘4.1.8 <no-reply@localhost>: Sender address
rejected: Domain not found’)}
i solved in this way:
vim /usr/lib/python2.7/site-packages/pgadmin4-web/config.py
MAIL_SERVER = ‘localhost’
MAIL_PORT = 25
MAIL_USE_SSL = False
MAIL_USE_TLS = False
MAIL_USERNAME = ”
MAIL_PASSWORD = ”
MAIL_DEBUG = False
# Flask-Security overrides Flask-Mail’s MAIL_DEFAULT_SENDER setting, so
# that should be set as such:
SECURITY_EMAIL_SENDER = ‘no-reply@localhost‘
I changed the SECURITY_EMAIL_SENDER into a my valid email
Restart httpd!