Archive

‘Linux’ 分类存档

CISCO WAE: wae-db dead but pid file exists

Introduction

If you found similar alarms, you can follow the guide and try to workaround the issue.

Problem

My customer found WAE REST API not workable, after checked, found wae-db have issue and report alarm, as follow.
And try to restart the WAE service and reload VM, not any useful.

[root@wae-auto wae-db]# service --status-all | grep wae
JAVA_EXECUTABLE or HSQLDB_JAR_PATH in '/etc/sysconfig/hsqldb' is set to a non-file.
wae-appenginecore is running OK, with PID=18606
wae-core is running OK, with PID=18163
wae-db dead but pid file exists  <<<<<<
wae-designapiserver is running OK, with PID=18847
wae-messaging is running OK, with PID=17874
wae-ni is running OK, with PID=17525
wae-osc is running OK, with PID=18369
wae-svcs-dashui is running OK, with PID=16652
wae-svcs-db is running OK, with PID=16277
wae-svcs-localrepo is not running
wae-svcs-log is running OK, with PID=16497
wae-svcs-logagent is running OK, with PID=16570
wae-svcs-metricsbkr is running OK, with PID=16716
wae-svcs-metricsd is running OK, with PID=16806
wae-svcs-mon is running OK, with PID=16138
wae-svcs-ui is running OK, with PID=16917
wae-system-server is running OK, with PID=16186
wae-web-server is running OK, with PID=17761

完整阅读

How to resize LVM on Centos7/Ubuntu14.04 ?

After install Centos7, found disk size less, so I need resize the disk, you can use some tools to achieve the function, e.g: GParted or disk-genius. But if your Server disk format is LVM, you can easy to manual adjust that. I don’t know how to resize LVM by Gparted or disk-genius. For this article, will discuss how to adjust Centos7/Ubuntu14.04 by LVM. That should same action/command in Centos and Ubuntu.

If you want to check steps in Ubuntu, can check this attachment: lvm-resize-ubuntu14.04

Follow disk info

Check system contents by “sudo df -H”, check all disk status by “sudo fdisk -l”.

[root@frank ~]# df -H
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/myvg-root  7.4G  7.4G  4.0M 100% /
devtmpfs               2.1G     0  2.1G   0% /dev
tmpfs                  2.1G  250k  2.1G   1% /dev/shm
tmpfs                  2.1G  9.5M  2.1G   1% /run
tmpfs                  2.1G     0  2.1G   0% /sys/fs/cgroup
/dev/mapper/myvg-home  731M  140M  591M  20% /home
/dev/sda1              521M  126M  396M  25% /boot
/dev/sr0               4.2G  4.2G     0 100% /run/media/root/CentOS 7 x86_64

Relationship for VG, PV and LV

LV only know how mapping to VG, not care PV; And VG build up by PV, so you can easy to extended PV to increased VG’s disk.

Check VG info that is collection by PV

[root@frank ~]# vgdisplay 
  --- Volume group ---
  VG Name               myvg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.52 GiB
  PE Size               4.00 MiB
  Total PE              1925
  Alloc PE / Size       1925 / 7.52 GiB
  Free  PE / Size       0 / 0   <<<
  VG UUID               0kMilm-TbT5-gs60-Vfl5-3obp-WybF-1BMwXA

Check PV that is virtual physical disk

[root@frank ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               myvg
  PV Size               7.52 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1925  <<<
  Free PE               0
  Allocated PE          1925  <<<
  PV UUID               whbkik-T1Ke-fLlF-ZBph-3pcd-loYG-yRweel

Check LV that is Partition in virtual disk

[root@frank ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/myvg/root
  LV Name                root
  VG Name                myvg
  LV UUID                K15Fr3-QNP3-a17k-IhNU-8qIV-LQAZ-iJ9bgV
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-09-23 14:38:07 +0800
  LV Status              available
  # open                 1
  LV Size                6.84 GiB
  Current LE             1750
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/myvg/home
  LV Name                home
  VG Name                myvg
  LV UUID                4nCfU9-5T2S-eKve-hMnc-Ao2l-So1o-lQwlU5
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-09-23 14:38:11 +0800
  LV Status              available
  # open                 1
  LV Size                700.00 MiB
  Current LE             175
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Set up a new LVM

[root@frank ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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
Disk identifier: 0x000a7fd0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    16803839     7888896   8e  Linux LVM
/dev/sda3        16803840    20899839     2048000   82  Linux swap / Solaris

Command (m for help): n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e): 
Using default response e
Selected partition 4
First sector (20899840-104857599, default 20899840): 
Using default value 20899840
Last sector, +sectors or +size{K,M,G} (20899840-104857599, default 104857599): 
Using default value 104857599
Partition 4 of type Extended and of size 40 GiB is set

Command (m for help): p

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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
Disk identifier: 0x000a7fd0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    16803839     7888896   8e  Linux LVM
/dev/sda3        16803840    20899839     2048000   82  Linux swap / Solaris
/dev/sda4        20899840   104857599    41978880    5  Extended

Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (20901888-104857599, default 20901888): 
Using default value 20901888
Last sector, +sectors or +size{K,M,G} (20901888-104857599, default 104857599): +7G
Partition 5 of type Linux and of size 7 GiB is set

Command (m for help): 
Command (m for help): p

Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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
Disk identifier: 0x000a7fd0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    16803839     7888896   8e  Linux LVM
/dev/sda3        16803840    20899839     2048000   82  Linux swap / Solaris
/dev/sda4        20899840   104857599    41978880    5  Extended
/dev/sda5        20901888    35581951     7340032   83  Linux

Command (m for help): t
Partition number (1-5, default 5): 
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

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.

[root@frank ~]# partx -a /dev/sda 
partx: /dev/sda: error adding partitions 1-3

[root@frank ~]# ll /dev/sda*
brw-rw---- 1 root disk 8, 0 Sep 24 22:12 /dev/sda
brw-rw---- 1 root disk 8, 1 Sep 24 17:43 /dev/sda1
brw-rw---- 1 root disk 8, 2 Sep 24 17:43 /dev/sda2
brw-rw---- 1 root disk 8, 3 Sep 24 17:43 /dev/sda3
brw-rw---- 1 root disk 8, 4 Sep 24 22:13 /dev/sda4
brw-rw---- 1 root disk 8, 5 Sep 24 22:13 /dev/sda5

[root@frank ~]# pvcreate /dev/sda5
  Physical volume "/dev/sda5" successfully created
[root@frank ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               myvg
  PV Size               7.52 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1925
  Free PE               0
  Allocated PE          1925
  PV UUID               whbkik-T1Ke-fLlF-ZBph-3pcd-loYG-yRweel

  "/dev/sda5" is a new physical volume of "7.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sda5
  VG Name                          <<< no config VG, so empty
  PV Size               7.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               WCKrXq-j2ZL-PoZ8-PcXd-fjb8-Riud-e5yl6m

Extend VG

[root@frank ~]# vg
vgcfgbackup    vgck           vgdisplay      vgimport       vgmknodes      vgrename       vgsplit        
vgcfgrestore   vgconvert      vgexport       vgimportclone  vgreduce       vgs            
vgchange       vgcreate       vgextend       vgmerge        vgremove       vgscan         
[root@frank ~]# vgextend 
  Please enter volume group name and physical volume(s)
  Run `vgextend --help' for more information.
[root@frank ~]# 
[root@frank ~]# vgextend myvg /dev/sda5
  Volume group "myvg" successfully extended
[root@frank ~]# 
[root@frank ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               myvg
  PV Size               7.52 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1925
  Free PE               0
  Allocated PE          1925
  PV UUID               whbkik-T1Ke-fLlF-ZBph-3pcd-loYG-yRweel

  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               myvg
  PV Size               7.00 GiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              1791
  Free PE               1791
  Allocated PE          0
  PV UUID               WCKrXq-j2ZL-PoZ8-PcXd-fjb8-Riud-e5yl6m

[root@frank ~]# vgdisplay 
  --- Volume group ---
  VG Name               myvg
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               14.52 GiB
  PE Size               4.00 MiB
  Total PE              3716
  Alloc PE / Size       1925 / 7.52 GiB
  Free  PE / Size       1791 / 7.00 GiB
  VG UUID               0kMilm-TbT5-gs60-Vfl5-3obp-WybF-1BMwXA

Extend LV

As above info, VG had increased, now we need add those VG to LC, you can add by G/MB/PE, suggest use PE that is more accurate, as follow:

[root@frank ~]# lvresize -l +1791 /dev/myvg/root
  Extending logical volume root to 13.83 GiB
  Logical volume root successfully resized
[root@frank ~]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/myvg/root
  LV Name                root
  VG Name                myvg
  LV UUID                K15Fr3-QNP3-a17k-IhNU-8qIV-LQAZ-iJ9bgV
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-09-23 14:38:07 +0800
  LV Status              available
  # open                 1
  LV Size                13.83 GiB
  Current LE             3541
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

Activate by “resize2fs”, but found command couldn’t use:

[root@frank ~]# resize2fs /dev/myvg/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/myvg/root
Couldn't find valid filesystem superblock.

After checked,that due to root system should xfs in Centos7/Ubuntu 14.04, “resize2fs” only support ext2, ext3 and ext4, so replaced “resize2fs” by “xfs_growfs”: Trying to resize2fs EB volume fails [closed]

[root@frank ~]# xfs_growfs /dev/myvg/root 
meta-data=/dev/mapper/myvg-root  isize=256    agcount=4, agsize=448000 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=1792000, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 1792000 to 3625984

[root@frank ~]# df -H
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/myvg-root   15G  7.4G  7.6G  50% /
devtmpfs               2.1G     0  2.1G   0% /dev
tmpfs                  2.1G  254k  2.1G   1% /dev/shm
tmpfs                  2.1G  9.4M  2.1G   1% /run
tmpfs                  2.1G     0  2.1G   0% /sys/fs/cgroup
/dev/mapper/myvg-home  731M  141M  591M  20% /home
/dev/sda1              521M  126M  396M  25% /boot
/dev/sr0               4.2G  4.2G     0 100% /run/media/root/CentOS 7 x86_64

更新:New NVME

After adding new NVME, you will find the disk but cannot use:

[root@gcspr-vxr pyvxr]# lsblk
NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                    8:0    0 894.3G  0 disk 
├─sda1                 8:1    0    63M  0 part /boot/efi
├─sda2                 8:2    0   500M  0 part /boot
├─sda3                 8:3    0     1M  0 part 
└─sda4                 8:4    0 893.7G  0 part 
  ├─xfs_vol-root     253:0    0  97.7G  0 lvm  /
  ├─xfs_vol-swap     253:1    0  23.6G  0 lvm  [SWAP]
  └─xfs_vol-nobackup 253:2    0 772.5G  0 lvm  /nobackup
nvme0n1              259:0    0   2.9T  0 disk <<<
nvme1n1              259:1    0   2.9T  0 disk <<<

Need to fdisk, format and mount, as follow:

[root@gcspr-vxr /]# fdisk /dev/nvme1n1 
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition number (1-128, default 1): 
First sector (34-6251233934, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-6251233934, default 6251233934): 
Created partition 1


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@gcspr-vxr /]# mkfs.ext4 /dev/nvme1n1p1
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
195354624 inodes, 781403985 blocks
39070199 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2929721344
23847 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done       

[root@gcspr-vxr /]# mkdir vxrbackup
[root@gcspr-vxr /]# mount /dev/nvme1n1p1 /vxrbackup
[root@gcspr-vxr /]# chmod 777 /vxrbackup/ -R
[root@gcspr-vxr /]# lsblk
NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                    8:0    0 894.3G  0 disk 
├─sda1                 8:1    0    63M  0 part /boot/efi
├─sda2                 8:2    0   500M  0 part /boot
├─sda3                 8:3    0     1M  0 part 
└─sda4                 8:4    0 893.7G  0 part 
  ├─xfs_vol-root     253:0    0  97.7G  0 lvm  /
  ├─xfs_vol-swap     253:1    0  23.6G  0 lvm  [SWAP]
  └─xfs_vol-nobackup 253:2    0 772.5G  0 lvm  /nobackup
nvme0n1              259:0    0   2.9T  0 disk 
└─nvme0n1p1          259:2    0   2.9T  0 part /vxr       <<<
nvme1n1              259:1    0   2.9T  0 disk 
└─nvme1n1p1          259:3    0   2.9T  0 part /vxrbackup <<<

Check type and add to fstab:

[root@gcspr-vxr vxr]# df -T
Filesystem                   Type      1K-blocks      Used  Available Use% Mounted on
......
/dev/nvme1n1p1               ext4     3076422524  75821596 2844303748   3% /vxrbackup
/dev/nvme0n1p1               ext4     3076422524 186183620 2733941724   7% /vxr
[root@gcspr-vxr vxr]# echo "/dev/nvme1n1p1 /vxrbackup ext4 defaults 0 0" >> /etc/fstab
[root@gcspr-vxr vxr]# echo "/dev/nvme0n1p1 /vxr ext4 defaults 0 0" >> /etc/fstab

Blog顺利完成搬家之Bandwagonhost VPS

搬家之前的一些感受

在Hostgator上顺利用了6年了,我是3年一续费,每次续费都贵一大截,这是欺负老客户么?!太蛋疼了,而且动态ip,什么功能都没有,真是心灰意冷:

痛定思痛,弃用Hostgator!经同事推荐,Bandwagonhost 速度不错,便宜,稳定,而且还是VPS,自由度很大,最好的是每年续费不涨钱:-) 所以我买了他们比较便宜的那款,年费在29美金/year(CN2),比 Hostgator便宜,速度还快!

完整阅读

Linux操作系统虚拟机(ESXi、VMware Workstation等)MAC地址变化后网卡无法启动-转

原始文章:
http://iknow.lenovo.com/detail/dc_148601.html

虚拟机MAC改变后,无法启动,并报错:“Device eth0 does not seem to be present”
出现该问题,是由于MAC地址变更后,操作系统仍然保留原来MAC地址作为eth0,并且将新的MAC地址识别为新的网卡导致的,可以删除文件“/etc/udev/rules.d/70-persistent-net.rule”中老MAC的信息,并把新MAC中的eth1改成eth0,通过start_udev重新加载udev,然后重启网卡恢复:“service network restart”

Deploy Samba on OpenWRT

买了linksys wrt1200ac很久了,之前只是装了一个openwrt+默认配置,也没启用什么特别功能,感觉还算稳定。不过现在想听一些下载下来的广播,但又不想总是开着PC,所以突然想把这些音频挪到没用的u盘里,并挂在openwrt中,这样任何设备都可以访问了,还剩资源:)

定制OpenWRT

1. 安装中文包

root@OpenWrt:~# opkg update <<< 每次重启后需要缓存安装包列表,这样才能search到所有可用的包
root@OpenWrt:~# opkg list |grep zh-cn <<< 学会如何查找相应的包
root@OpenWrt:~# opkg install luci-i18n-base-zh-cn <<< 安装中文包

2.安装luci的主题

默认只有一种,在默认更新源里,加上默认的一共有4个,最后我还是选择了默认的 -_-

root@OpenWrt:~# opkg list |grep -i theme
luci - git-16.018.33482-3201903-1 - Standard OpenWrt set including full admin with ppp support and the default Bootstrap theme
luci-theme-bootstrap - git-16.018.33482-3201903-1 - Bootstrap Theme (default)
luci-theme-freifunk-bno - git-16.018.33482-3201903-1 - Freifunk Berlin Nordost Theme
luci-theme-freifunk-generic - git-16.018.33482-3201903-1 - Freifunk Generic Theme
luci-theme-openwrt - git-16.018.33482-3201903-1 - LuCI OpenWrt.org theme
 完整阅读
blonde teen swallows load.xxx videos