记一次阿里云 ECS 服务器数据盘无损扩容

原数据盘 20G 扩容至 25G,购买后通过 SSH 登陆实例进行操作;

操作步骤完全参考阿里云帮助即可:https://help.aliyun.com/document_detail/25452.html

[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   15G   23G  39% /
tmpfs           939M     0  939M   0% /dev/shm
/dev/vdb1        20G   13G  6.7G  65% /home/wwwroot
[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# umount /dev/vdb1
[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   15G   23G  39% /
tmpfs           939M     0  939M   0% /dev/shm
[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00020f03

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           1        5222    41940992   83  Linux

Disk /dev/vdb: 26.8 GB, 26843545600 bytes
16 heads, 63 sectors/track, 52012 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x78d92770

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1       41610    20971408+  83  Linux
[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# fdisk /dev/vdb

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): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-52012, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-52012, default 52012): 
Using default value 52012

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# e2fsck -f /dev/vdb1
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vdb1: 95741/1310720 files (0.8% non-contiguous), 3228283/5242852 blocks
[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# resize2fs /dev/vdb1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/vdb1 to 6553504 (4k) blocks.
The filesystem on /dev/vdb1 is now 6553504 blocks long.

[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# mount /dev/vdb1 /home/wwwroot
[root@iZ2ze4knyxhkgpnbo7brn7Z ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   15G   23G  39% /
tmpfs           939M     0  939M   0% /dev/shm
/dev/vdb1        25G   13G   12G  52% /home/wwwroot

值得注意的点是 fdisk 命令操作时, 是使用 fdisk /dev/vdb 而不是 fdisk /dev/vdb1,这里没仔细看坑了我好长时间,一直扩容失败;

扩容成功。

解决 Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ 错误

安装完 MySQL ,进行运行测试,报 Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ 错误,

[root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe
131206 22:42:51 mysqld_safe Logging to ‘/var/log/mysqld.log’.
131206 22:42:51 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data
131206 22:42:57 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
[root@localhost mysql]# /usr/local/mysql/bin/mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

检查一下 MySQL 的运行状态

[root@localhost mysql]# ps -ef | grep mysql
root     32092  2108  0 22:43 pts/0    00:00:00 grep mysql

查看 /tmp 文件夹的确没有 mysql.sock 文件,

通过 find 命令查找

[root@localhost /]# find / -name mysql.sock
/var/lib/mysql/mysql.sock

原来安装到 /var/lib/mysql/mysql.sock 这个位置啦,我们需要修改 my.cnf 文件

[root@localhost /]# vi /usr/local/mysql/my.cnf

[client]
character-set-server = utf8
port    = 3306
socket  = /var/lib/mysql/mysql.sock
……

保存之后即出,重新启动 MySQL 。

via: http://www.chenruixuan.com/archives/517.html

解决: Homestead 环境下, yarn install –no-bin-links, NPM run dev, 命令报错

执行以下命令:

  • 1 $ rm -rf node_modules
  • 2 $ yarn config set registry http://registry.cnpmjs.org
  • 3 $ yarn install --no-bin-links
  • 4 接下来打开 pakage.json 修改, 去掉 package.json 中的四处 cross-env
"scripts": {
    "dev": "npm run development",
    "development": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
  • 5.执行 $ npm run watch-poll 或者 npm run dev
  • 6.完成

via: https://laravel-china.org/topics/3570/yarn-install-error-learning-laravel-entry-manual-encounter-problems-to-help

error Received malformed response from registry for undefined. The registry may be down.

Laravel 学习中

https://laravel-china.org/courses/laravel-essential-training-5.5/569/style-beautification

执行下列代码时报错

$ yarn install --no-bin-links
$ yarn add cross-env

error Received malformed response from registry for undefined. The registry may be down. Continue reading error Received malformed response from registry for undefined. The registry may be down.

解决 WordPress 后台主题中只显示一个主题不显示其他主题的问题

出现 WordPress 主题无法识别问题的原因:服务器环境禁用了 scandir 函数,导致 WordPress 无法正常扫描主题。

解决方法:

  • 找到 php.ini,一般在服务器的 /usr/local/php/etc 目录下;
  • 打开 php.ini,查找其中的 “disable_functions” 字样,找到并删除紧随其后的 “scandir” ,最后保存该文件;
  • 重启服务器的 php 服务。

 

网站 ald 安装的一些记录

Call to undefined function Think\Session\Driver\mysql_connect()

Conf/common.php 的 SESSION_TYPE 留空,如写 db 则以 mysql 为驱动,会报上述错误

nginx 引入文件 include vhost/other/osv2_nginx.conf;

nginx 主要配置项 重写 thinkphp index.php 文件,取消引入 php7 的 pathinfo.php,引入 osv2_nginx.conf 重写文件

删除 .user.ini 文件,可能造成 No input file specified