2019年5月

# fdisk -lu /dev/vdb

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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
# blkid /dev/vdb
/dev/vdb: UUID="047ad20b-3e2d-41d3-ba4d-72d22d5407d8" TYPE="ext3"
# e2fsck -n /dev/vdb
e2fsck 1.42.9 (28-Dec-2013)
Warning!  /dev/vdb is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
/dev/vdb: clean, 11/6553600 files, 459382/26214400 blocks
# df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       41151808  8534880  30503496  22% /
devtmpfs         1931336        0   1931336   0% /dev
tmpfs            1940844        0   1940844   0% /dev/shm
tmpfs            1940844      448   1940396   1% /run
tmpfs            1940844        0   1940844   0% /sys/fs/cgroup
tmpfs             388172        0    388172   0% /run/user/0
/dev/vdb       103081248 97838368         0 100% /home/wwwroot
# umount /dev/vdb
umount: /home/wwwroot: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
# fuser -m /home/wwwroot
/home/wwwroot:       24402
# kill 24402
# umount /dev/vdb
# fdisk -lu /dev/vdb

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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
# fdisk -u /dev/vdb
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x56c34f1c.

Command (m for help): p

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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: 0x56c34f1c

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): d
No partition is defined yet!

Command (m for help): p

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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: 0x56c34f1c

   Device Boot      Start         End      Blocks   Id  System

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

Calling ioctl() to re-read partition table.
Syncing disks.
# fdisk /dev/vdb
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xe00c1f00.

Command (m for help): d
No partition is defined yet!

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): p

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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: 0xe00c1f00

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048   209715199   104856576   83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
# lsblk /dev/vdb
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vdb    253:16   0  100G  0 disk
└─vdb1 253:17   0  100G  0 part
# e2fsck -n /dev/vdb1
e2fsck 1.42.9 (28-Dec-2013)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/vdb1

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
# partprobe /dev/vdb
# resize2fs /dev/vdb1
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/vdb1
Couldn't find valid filesystem superblock.
# resize2fs /dev/vdb
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vdb is mounted on /home/wwwroot; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 13
The filesystem on /dev/vdb is now 52428800 blocks long.
# df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G  8.2G   30G  22% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G  340K  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vdb        197G   94G   95G  50% /home/wwwroot
tmpfs           380M     0  380M   0% /run/user/0

字段宽度

名称示例值正常尺寸小尺寸大尺寸
日期时间2019-01-01 00:00:00160142
日期时间2019-01-01...118
日期2019-01-0110692
文字名字5854
文字处理中7368
文字王者荣耀8678
文字超级马里奥 90
按钮编辑6563
按钮编辑 删除115100
按钮编辑 删除 日志158132
按钮编辑 删除 日志 详情 158
数字13888888888118105
数字99999.99 82
数字999999 72
数字999.9 62

内容

<div class="layui-fluid">
    <div class="layui-card">
        <form class="layui-form layui-card-header layuiadmin-card-header-auto search">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <input type="number" name="id" value="" placeholder="请输入预约ID" class="layui-input">
                </div>
                <div class="layui-inline">
                    <input type="number" name="user_id" value="" placeholder="请输入用户ID" class="layui-input">
                </div>
                <div class="layui-inline">
                    <input type="text" name="name" value="" placeholder="请输入姓名" class="layui-input">
                </div>
                <div class="layui-inline">
                    <input type="text" name="tel" value="" placeholder="请输入电话号码" class="layui-input">
                </div>
                <div class="layui-inline">
                    <input type="text" name="area" value="" placeholder="请输入安装地区" class="layui-input">
                </div>
                <div class="layui-inline">
                    <input type="text" name="address" value="" placeholder="请输入详细地址" class="layui-input">
                </div>
                <div class="layui-inline">
                    <select name="product_id" lay-search>
                        <option value="">请选择产品</option>
                    </select>
                </div>
                <div class="layui-inline">
                    <select name="status">
                        <option value="">请选择状态</option>
                        <option value="0">已取消</option>
                        <option value="1">待派单</option>
                        <option value="2">已接单</option>
                        <option value="3">已安装</option>
                    </select>
                </div>
            </div>
        </form>
        <div class="layui-card-body">
            <table class="layui-hide" id="table" lay-filter="table"></table>
        </div>
    </div>
</div>

内容模板

<script type="text/html" id="status">
    {{#  switch(d.status){ case 0:}}
    删除
    {{#  break; case 1:}}
    <span style="color: #1E9FFF"><i class="layui-icon layui-icon-friends"></i>&nbsp;在籍</span>
    {{#  break; case 2:}}
    <span style="color: #999999"><i class="layui-icon layui-icon-friends"></i>&nbsp;退学</span>
    {{#  break; case 3:}}
    转校
    {{#  break; case 4:}}
    <span style="color: #FF5722"><i class="layui-icon layui-icon-friends"></i>&nbsp;毕业</span>
    {{#  } }}
</script>
<script type="text/html" id="toolbar">
    <a class="layui-btn layui-btn-xs" lay-event="view">查看</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
</script>

JavaScript

layui.use(['table', 'jquery', 'layer', 'form'], function(){
    let table   = layui.table,
        $       = layui.jquery,
        form    = layui.form;

    // 获取数据并渲染表格
    table.render({
        elem: '#table'
        ,url: location.href
        ,method: 'post'
        ,id: 'table'
        ,toolbar: false
        ,cols: [[
            {type: 'checkbox', fixed: 'left'}
            ,{field:'id', title: 'ID', width:68}
            ,{field:'user_id', title: '用户', width:168, templet: '#user_id'}
            ,{field:'name', title: '姓名', width:86}
            ,{field:'tel', title: '手机号码', width:120}
            ,{field:'area', title: '安装地区', width:138}
            ,{field:'address', title: '详细地址', width:138}
            ,{field:'install_date', title: '安装日期', width:138}
            ,{field:'product_id', title: '产品', width:138}
            ,{field:'birthday', title: '出生年月日', width:106}
            ,{field:'create_time', title: '时间', width:160}
            ,{field:'status', title: '状态', width:80, templet: '#status'}
            ,{field:'options', title: '操作', width:118, toolbar: '#toolbar', fixed: 'right'}
        ]]
        ,where: getSearchWhere('form')
        ,page: true
        ,height: 'auto'
    });

    table.on('tool(table)', function(obj){
        switch (obj.event) {
            case 'view':
                layer.open({
                    type: 2
                    ,title: '查看内容'
                    ,content: "{:url('merchant/Feedback/view')}?id=" + obj.data.id
                    ,area: ['600px', '500px']
                    ,btn: ''
                    ,end: function () {
                        // 重载表格
                        table.reload('table');
                    }
                });
                break;
            case 'delete':
                layer.confirm('确定要删除 ' + obj.data.id + ' ?', function(index){
                    $.post("{:url('merchant/Feedback/delete')}", {id: obj.data.id}, function (data) {
                        layer.msg(data.msg);

                        if (data.code == 0) {
                            // 重载表格
                            table.reload('table');
                        }
                    });

                    layer.close(index);
                });

                break;
            case 'icon':
                layer.photos({
                    photos: {
                        "title": "预览",
                        "data": [
                            {"src": obj.data.icon,}
                        ]
                    }
                });
                break;
        }
    });

    $('#search').click(function () {
        table.reload('table', {
            where: getSearchWhere('form')
        });
    });

    form.on('select(search)', function(){
        table.reload('table', {
            where: getSearchWhere('.search')
        });
    });
    $('.search input').change(function () {
        table.reload('table', {
            where: getSearchWhere('.search')
        });
    });

    function getSearchWhere(form_ele) {
        let data = {};
        $.each($(form_ele).serializeArray(), function (key, value) {
            data[value.name] = value.value;
        });

        return data;
    }
});

最近因为需要在公司内部搭建内部服务器,但设备有限,需要安装VM虚拟机来解决问题。
但安装VM虚拟机时,一直都安装不上,就算安装上了用不了。
出现这个错误的原因,主要就是以前安装了VM虚拟机,但是没有卸载或卸载不干净,导致再次安装失败。

Step1: Uninstall VMware Workstation

Step2: Delete all files under %TEMP% directory

Step3: Open "cmd" as administrator, and execute "sc stop vmx86 & sc delete vmx86"

Step4: Open "cmd" as administrator, and execute "sc stop vstor2-mntapi20-shared & sc delete vstor2-mntapi20-shared"

Step5: Delete these files if have -- "C:\Windows\System32\drivers\vmx86.sys" "C:\Windows\SysWOW64\drivers\vstor2-mntapi20-shared.sys" and "C:\Windows\SysWOW64\drivers\vstor2-x64.sys"

Step6: Go to c:\windows\system32\drvstore, delete folder which prefix by "vmx86", general the folder name should be vmx86_{guid}

Step7: Reboot host and then install Workstation again

一、检查是否已安装

# svnserve --version

如果出现下列提示,则代表没有安装

-bash: svnserve: command not found

如果出现下列提示,则代表已经安装了,直接跳到四步

svnserve, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28

Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

二、安装

# yum install -y subversion

三、再次检查是否已安装

# svnserve --version

四、创建并进入到储存版本库的目录

# mkdir /data/svn-repository
# cd /data/svn-repository

五、创建一个版本库(项目)
test为版本库的名称

# svnadmin create test

六、显示版本库目录的文件列表

# ls test
名称类型说明
conf目录配置文件目录
conf/authz文件负责账号权限的管理,控制账号是否读写权限
conf/passwd文件负责账号和密码的用户名单管理
conf/svnserve.conf文件版本库配置文件
db目录版本数据存储目录
hooks目录版本库钩子脚本文件目录
locks目录db锁文件和db_logs锁文件的目录,用来追踪存取文件库的客户端
format文件存储一个整数的文件,此整数代表库层次结构版本
README.txt文件说明文件

七、设置全局配置
默认情况下,都是使用版本库目录下conf目录的配置,一两个项目还没问他,但是项目一多,管理就很麻烦了。
先把配置目录复制出来,作为全局配置

# cp -R test/conf conf

八、新增该版本库的用户
打开passwd文件

# vi conf/passwd

在文件末新增一行,输入用户名jwj和密码123456

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
jwj = qq2254

九、设置版本库用户的权限
打开authz文件

# vi conf/authz

jwj用户赋予test版本库根目录的读写权限

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[test:/]
jwj = rw

当然,还有更多权限的写法,下面列出部分,想详细了解的话,请查阅其他资料

十、设置svn服务开机自启

#vi /etc/init.d/svn

然后输入以下内容

#!/bin/sh
# chkconfig: 2345 85 85
# processname: svn

svn_bin=/bin
svn_port=3690
svn_home=/mnt/svn-repository
svn_config=/mnt/svn-repository/conf/svnserve.conf

if [ ! -f "$svn_bin/svnserve" ]
then
    echo "svnserver startup: cannot start"
exit
fi

case "$1" in
    start)
        echo "Starting svnserve..."
        $svn_bin/svnserve -d -r $svn_home --config-file $svn_config --listen-port $svn_port
        echo "Successfully!"
    ;;
    stop)
        echo "Stoping svnserve..."
        killall svnserve
        echo "Successfully!"
    ;;
    restart)
        $0 stop
        $0 start
    ;;
    *)
        echo "Usage: svn { start | stop | restart } "
        exit 1
    ;;
esac

给文件添加可执行权限

# chmod +x /etc/init.d/svn

开启开机自启动

# chkconfig svn on

十一、启动svn

# service svn start