expand vmware esxi disk and lvm disk

Identifying the partition type

As this method focuses on working with LVM, we will first confirm that our partition type is actually Linux LVM by running the below command.

fdisk -l
fdisk

As you can see in the above image /dev/sda5 is listed as “Linux LVM” and it has the ID of 8e. The 8e hex code shows that it is a Linux LVM, while 83 shows a Linux native partition. Now that we have confirmed we are working with an LVM we can continue. For increasing the size of a Linux native partition (hex code 83) see this article.

disk free

Below is the disk information showing that our initial setup only has the one 20gb disk currently, which is under the logical volume named /dev/mapper/Mega-root – this is what we will be expanding with the new disk.

Note that /dev/mapper/Mega-root is the volume made up from /dev/sda5 currently – this is what we will be expanding.

Increasing the virtual hard disk

First off we increase the allocated disk space on the virtual machine itself. This is done by right clicking the virtual machine in vSphere, selecting edit settings, and then selecting the hard disk. In the below image I have changed the previously set hard disk of 20gb to 30gb while the virtual machine is up and running. Once complete click OK, this is all that needs to be done in VMware for this process.

vSphere settings

If you are not able to modify the size of the disk, the provisioned size setting is greyed out. This can happen if the virtual machine has a snapshot in place, these will need to be removed prior to making the changes to the disk. Alternatively you may need to shut down the virtual machine if it does not allow you to add or increase disks on the fly, if this is the case make the change then power it back on.

Detect the new disk space

Once the physical disk has been increased at the hardware level, we need to get into the operating system and create a new partition that makes use of this space to proceed.

Before we can do this we need to check that the new unallocated disk space is detected by the server, you can use “fdisk -l” to list the primary disk. You will most likely see that the disk space is still showing as the same original size, at this point you can either reboot the server and it will detect the changes on boot or you can rescan your devices to avoid rebooting by running the below command. Note you may need to change host0 depending on your setup.

echo "- - -" > /sys/class/scsi_host/host0/scan

Below is an image after performing this and confirming that the new space is displaying.

fdisk

Partition the new disk space

As outlined in my previous images the disk in my example that I am working with is /dev/sda, so we use fdisk to create a new primary partition to make use of the new expanded disk space. Note that we do not have 4 primary partitions already in place, making this method possible.

fdisk /dev/sda

We are now using fdisk to create a new partition, the inputs I have entered in are shown below in bold. Note that you can press ‘m’ to get a full listing of the fdisk commands.

‘n’ was selected for adding a new partition.

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').

Command (m for help): n

‘p’ is then selected as we are making a primary partition.

Command action
   l   logical (5 or over)
   p   primary partition (1-4)
p

As I already have /dev/sda1 and /dev/sda2 as shown in previous images, I have gone with using ‘3’ for this new partition which will be created as /dev/sda3

Partition number (1-4): 3

We just press enter twice above as by default the first and last cylinders of the unallocated space should be correct. After this the partition is then ready.

First cylinder (2611-3916, default 2611): "enter"
Using default value 2611
Last cylinder, +cylinders or +size{K,M,G} (2611-3916, default 3916): "enter"
Using default value 3916

‘t’ is selected to change to a partition’s system ID, in this case we change to ‘3’ which is the one we just created.

Command (m for help): t
Partition number (1-5): 3

The hex code ‘8e’ was entered as this is the code for a Linux LVM which is what we want this partition to be, as we will be joining it with the original /dev/sda5 Linux LVM.

Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

‘w’ is used to write the table to disk and exit, basically all the changes that have been done will be saved and then you will be exited from fdisk.

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.

You will see a warning which basically means in order to use the new table with the changes a system reboot is required. If you can not see the new partition using “fdisk -l” you may be able to run “partprobe -s” to rescan the partitions. In my test I did not require either of those things at this stage (I do a reboot later on), straight after pressing ‘w’ in fdisk I was able to see the new /dev/sda3 partition of my 10gb of space as displayed in the below image.

For CentOS/RHEL run a “partx -a /dev/sda3” to avoid rebooting later on.

fdisk

That’s all for partitioning, we now have a new partition which is making use of the previously unallocated disk space from the increase in VMware.

Increasing the logical volume

We use the pvcreate command which creates a physical volume for later use by the logical volume manager (LVM). In this case the physical volume will be our new /dev/sda3 partition.

root@Mega:~# pvcreate /dev/sda3
  Device /dev/sda3 not found (or ignored by filtering).

In order to get around this you can either reboot, or use partprobe/partx as previously mentioned to avoid a reboot, as in this instance the disk does not appear to be there correctly despite showing in “fdisk -l”. After a reboot or partprobe/partx use the same command which will succeed.

root@Mega:~# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created

Next we need to confirm the name of the current volume group using the vgdisplay command. The name will vary depending on your setup, for me it is the name of my test server. vgdisplay provides lots of information on the volume group, I have only shown the name and the current size of it for this example.

root@Mega:~# vgdisplay
  --- Volume group ---
  VG Name               Mega
...
VG Size               19.76 GiB

Now we extend the ‘Mega’ volume group by adding in the physical volume of /dev/sda3 which we created using the pvcreate command earlier.

root@Mega:~# vgextend Mega /dev/sda3
  Volume group "Mega" successfully extended

Using the pvscan command we scan all disks for physical volumes, this should confirm the original /dev/sda5 partition and the newly created physical volume /dev/sda3

root@Mega:~# pvscan
  PV /dev/sda5   VG Mega   lvm2 [19.76 GiB / 0    free]
  PV /dev/sda3   VG Mega   lvm2 [10.00 GiB / 10.00 GiB free]
  Total: 2 [29.75 GiB] / in use: 2 [29.75 GiB] / in no VG: 0 [0   ]

Next we need to increase the logical volume (rather than the physical volume) which basically means we will be taking our original logical volume and extending it over our new partition/physical volume of /dev/sda3.

Firstly confirm the path of the logical volume using lvdisplay. This path name will vary depending on your setup.

root@Mega:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/Mega/root

The logical volume is then extended using the lvextend command.

root@Mega:~# lvextend /dev/Mega/root /dev/sda3
  Extending logical volume root to 28.90 GiB
  Logical volume root successfully resized

There is then one final step which is to resize the file system so that it can take advantage of this additional space, this is done using the resize2fs command for ext based file systems. Note that this may take some time to complete, it took about 30 seconds for my additional space.

root@Mega:~# resize2fs /dev/Mega/root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/Mega/root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 2
Performing an on-line resize of /dev/Mega/root to 7576576 (4k) blocks.
The filesystem on /dev/Mega/root is now 7576576 blocks long.

Alternatively if you’re running the XFS file system (default as of RedHat/CentOS 7) you can grow the file system with “xfs_growfs /dev/Mega/root”.

That’s it, now with the ‘df’ command we can see that the total available disk space has been increased.

disk free after expansion

Summary

With this method we have increased the virtual disk drive through VMware, created a new partition out of this newly unallocated space within the guest OS, turned it into a physical volume, extended the volume group, and then finally extended the original logical volume over the newer physical volume resulting in overall disk space being increased successfully.

ffmpeg change fps

With re-encoding:

ffmpeg -y -i seeing_noaudio.mp4 -vf "setpts=1.25*PTS" -r 24 seeing.mp4

Without re-encoding:

First step – extract video to raw bitstream

ffmpeg -y -i seeing_noaudio.mp4 -c copy -f h264 seeing_noaudio.h264

Remux with new framerate

ffmpeg -y -r 24 -i seeing_noaudio.h264 -c copy seeing.mp4

ubuntu static ip

sudo nano /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.17.11
netmask 255.255.255.0
network 192.168.17.0
gateway 192.168.17.254
dns-nameservers 192.168.17.254
dns-domain zeddal.com
dns-search zeddal.com

How to Limit Nginx download Speed

In my case, I used this options inside a location block… among other configurations, the main directives added are these two:

location ^~ /videos/ {

limit_rate_after 1m;
limit_rate 150k;

}
The fist one, limits the connection rate after the size you specify, in my case I wanted to have 1mb for the initial video buffering, and then after users reach 1mb, set the limit_rate to 150k per second, which is about 1.5MBits.

Be aware that this solution limits nginx download speed per connection, so, if one user opens multiple video files, it will be able to download 150k x the number of times he connected to the video files. If you need to set a limit to the connections, you should be able to do it with limit_zone and limit_conn directives. Example:

Inside your server block configuration:

limit_rate 128K; limit_zone one $binary_remote_addr 10m;
Inside your location block configuration:

limit_conn one 10;
In this example, it would allow 10 connections per IP with 1 Mbit each.

打卡流程

## 小孩学习流程

### 文档目的
明确学习流程,打到内部共识

### 详细描述(时间轴)

#### 首次使用,第一课
家长用自己的手机打开微信,通过广告页进入购买,完成后导航到产品首页(产品首页前有个集中loading页面不过不是很重要)。小孩开始学习第一课,家长会在边上看着,指导小孩使用(是否需要告知家长第一次需要指导?)。根据小孩回答问题到程度,我们可以让他过了第一课,或者选择让他重新学习第一课。我们可以设定一个指标(比如需要回答对90%的题目或者需要全部做对)达到了就让他解锁第二课,没有达到不解锁并且提示他需要重新学习。这里要设计一个页面很遗憾地告诉他你这次差一点点没有通过,再来一次吧。

#### 第二次使用,第二课 或者 如果第一课没有过,重复第一课

– 第二课
这里和第一课打卡过程类似,但是家长可以选择只观察全部让小孩自己操作。出现问题才指点。第二课也是需要达到预设的通过指标(比如需要回答对90%的题目或者需要全部做对),否则算没有过。

– 重复第一课
简单重复第一课,达到指标才能解锁第二课。

#### 重复这个过程直到解锁小测试一

简述可能的过程如下,这个过程看似复杂,其实都是我们自己算法,从小孩来看其实并不难follow

– 第一天:小孩做第一课(第一次没过),重复做第一课(还是没过),继续重复,这次过了,解锁第二课。
– 第二天:做第二课第一次没过,重复做第二课过了,解锁第三课。
– 第三天:做第三课第一次没过,重复,解锁第四课。
– 第四天:做第四课第一次没过,重复,解锁第五课。
– 第五天: 类似,最后解锁单元测试。单元测试我们会设定一个阀值。过了才算整个1-5过了。否则的话还是没过,需要提示小盆友去重复1-5课的学习过程,再来做单元测试。比如单元测试里面题一他没有做对,那我们需要记录下来,然后汇总,然后我们知道他需要再去做1-5题中的那些部份,比如他需要重新做第一课,第三课。这个时候单元测试的结算页面就会显示,很抱歉你没有通过(但是更婉转),你可以前往学习第一课第三课,立刻前往补充知识。同时这个单元测试点击被关闭他如果再次点击则显示他需要去重新复习第一课第三课。只有他过了第一课第三课。这个单元测试才能被重新激活,他才可以重新再来挑战单元测试。

#### 通过小测验一,继续下面几个单元的学习
后面其实类似单元一。不需要重复描述。

### 所需修改

– 设计课程打卡失败的界面 (目前没有)
– 制定失败的标准(比如是全部都做对才可以,还是说是一个比例,比如90%做对就可以)
– 流程重新组织页面过程,增加跳转流程判断等等

tellable nonce with 8 chars and 57 potential chars

allowed chars abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ23456789
yTjJvXRY
srZsEimN
9LAdapXK
FYu5p4kY
KYMGXcDn
PHMu8ziB
BjXb5XiG
UYfcySFF
2Qs3Htn3
BksiT5Rk
MUxZEz86
KyFucCLE
F6DpZ8ir
BzR6rgCm
p4EbJYxt
Kt5GmVY8
xNgZeZzq
WFM55gXP
jQNkSTHY
aZB74VJk
Q8eyCk57
wjIYJ6sJ
ELu36wr9
f7IJUiWg
9LHgWGcL
9jMIQUHT
uCg5CWr9
UIPe5Wge
LgXpUT5G
WBv4KZdk
Rtd3v67u
D4HJHhAG
29jjQ2rt
qVmyJpr6
qdwnrnmj
quQDugWY
CLuIkcTr
jZ7EN85n
yMeEPfTd
gcHTkMsX
s7iUXuDg
TymvJjhZ
Tq9NcfKT
mnxTqMzj
rmMd7gbb
cncipGmV
XDvAxn6i
pXgPMvQI
2ZW2iAa2
BkPwEK8p
jxEMdUcZ
PCUwCL8T
DSSB92NA
c6HVq582
j3v5BiQA
bBQHn9rc
qjHTVdkt
DhYFLP5t
88A43K9U
q7pmsb9G
WHffqsnU
ZNtBw2Et
CadSIIMg
e7phNPhN
ks5qbrDm
YR82vbit
E5ke3Atn
kNFpr2Pm
HYSigRpQ
RDEfx2Rp
KyIeBCMM
CFK6sNm3
wuqFegwj
cMWfcKsW
kVxSSsgM
ebNwxwrb
nbCr7XIc
wkuC6Ju9
YWmpv2HZ
zHF4AB99
FXQRATfN
JDifdfaS
4XDIBfi2
UjgGQpTM
pz2mKsps
7Vz3iHk4
acjkUn4S
ks29Cvhs
2BTuV4iz
t3z2zKEY
dtHX9ubx
JmywyrbQ
4LuUuzc6
Nh6iWkJQ
6gQRcpjn
yvVHKQKC
ByUsiWFe
3mm3TMmv
RAZJRzzf
cQWfPag2