Press "Enter" to skip to content

Category: Linux运维

Linux,unix,mysql,database,oracle,mysql

获取China大陆IP段的范围

这里有几个网站提供了大陆的IP段范围。别问我要这个列表干什么,我也不知道。

http://www.ip2location.com/blockvisitorsbycountry.aspx
老牌网站,国内很多人应该都知道,可以选择任意一个国家的IP段,然后可以输出多种格式。

https://www.countryipblocks.net/country_selection.php
跟上面的那个一样,多一个备份。

http://www.ipdeny.com/ipblocks/
一样是列出了所有国家的IP段文件,提供下载。

1 Comment

删除文件以后,XFS分区的可用容量并未增加?

今天接到一同事报告,在分区里删除了一些大体积文件以后,使用df -hT看到该分区的Avail容量并未增加。我的第一反应就是肯定是XFS文件搞的鬼!经过谷歌以后证明了确实是XFS文件系统的问题。

XFS is designed to support highly parallel operation and massive dynamically expanding file system sizes. Both are supported by dynamic allocation of inodes.

XFS被设计为支持高度并行运算和海量动态扩展文件系统大小。两者都是由inode的动态分配支持。

XFS dynamically allocates space for inodes as they are created, this is different from many other filesystems where inode space is statically allocated at mkfs time. While inode space is dynamically allocated, it is never freed – up until now that is.

When ikeep is specified, XFS does not delete empty inode clusters and keeps them around on disk. When noikeep is specified, empty inode clusters are returned to the free space pool.

Leave a Comment

为Linux发行版安装开源字体软件

除了Ubuntu以外,大多数Linux发行版在字体渲染方面一直都不好,尤其是安装了中文字体以后,看起来模糊、发虚,简直无法直视。本文介绍了在Arch/Fedora/OpenSUSE/Debian系统下安装Infinality开源字体软件的方法。

1,为Arch Linux安装Infinality

$ sudo vim  /etc/pacman.conf:

[infinality-bundle]
Server = http://bohoomil.com/repo/$arch

[infinality-bundle-multilib]
Server = http://bohoomil.com/repo/multilib/$arch

[infinality-bundle-fonts]
Server = http://bohoomil.com/repo/fonts

$ sudo pacman -Syu

$ sudo pacman -S infinality-bundle infinality-bundle-multilib ibfonts-meta-extended  #64位系统
$ sudo pacman -S infinality-bundle ibfonts-meta-extended     #32位系统

然后重启系统即可。

Leave a Comment

Gnome3修改字体

获得系统已安装的字体列表

$ fc-list
$ fc-list :lang=zh
$ fc-list :lang=zh |  cut -d : -f 2 | cut -d, -f1 | sort | uniq -c

修改Gnome Shell字体

$ sudo vim /usr/share/gnome-shell/theme/gnome-shell.css  #修改如下内容

……
font-family: cantarell, sans-serif;
……

经过以上修改,重启后就会发现Gnome Shell字体变了。但是,(欢迎)登陆界面,字体仍未被修改,原因未知

修改系统字体

$ sudo apt-get install gnome-tweak-tool   #适用ubuntu/debian

$ yum install gnome-tweak-tool      #适用fedora

然后在应用程序列表里找到“优化工具”即可设置。

Leave a Comment

Linux系统下查看网卡列表

Linux系统下如果没有安装udev的话,网卡不会以eth0的方式存在于系统里,系统会直接使用BIOS传递过来的设备名作为网卡名称,例如em1之类的。那么如何查看所有网卡的名称呢?

$ cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
 bond0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
   em2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
   em4:    3587      18    0    0    0     0          0         2    11100      65    0    0    0     0       0          0
  p3p1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    lo:    3934      64    0    0    0     0          0         0     3934      64    0    0    0     0       0          0
   em1:   15196     117    0   18    0     0          0        19    15865     107    0    0    0     0       0          0
  p3p2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
   em3:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
 
$ netstat -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500 0         0      0      0 0             0      0      0      0 BMmU
em1        1500 0       193      0     33 0           144      0      0      0 BMRU
em2        1500 0         0      0      0 0             0      0      0      0 BMU
em3        1500 0         0      0      0 0             0      0      0      0 BMU
em4        1500 0        18      0      0 0            69      0      0      0 BMRU
lo        65536 0       119      0      0 0           119      0      0      0 LRU
p3p1       1500 0         0      0      0 0             0      0      0      0 BMsU
p3p2       1500 0         0      0      0 0             0      0      0      0 BMsU
Leave a Comment

解决XFS文件系统NFS输出Stale NFS file handle错误

公司有一台SAN存储,其中划出了26TB的容量通过open-iscsi输出到某台Ubuntu Server上,然后再在这台Ubuntu Server配置好NFS,将26TB共享至其它Clients上。一直使用的好好的,在某一天,客户端在挂载时,突然就出现了Stale NFS file handle的错误。经过无数次谷歌以后,找到了解决方案。这里记录一下。

一开始,以为是分区出现逻辑错误,准备尝试fsck一下(XFS文件系统不能使用fsck命令),于是有了以下过程

$ sudo xfs_check /dev/vg-15k/users
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed.  Mount the filesystem to replay the log, and unmount it before
re-running xfs_check.  If you are unable to mount the filesystem, then use
the xfs_repair -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.



$ sudo xfs_repair /dev/vg-15k/users
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed.  Mount the filesystem to replay the log, and unmount it before
re-running xfs_repair.  If you are unable to mount the filesystem, then use
the -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.



$ sudo xfs_repair -L /dev/vg-15k/users
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
ALERT: The filesystem has valuable metadata changes in a log which is being
destroyed because the -L option was used.
        - scan filesystem freespace and inode maps...
sb_icount 64, counted 4884352
sb_ifree 61, counted 15726
sb_fdblocks 2683832778, counted 1409694604
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
        - agno = 8
        - agno = 9
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 3
        - agno = 2
        - agno = 4
        - agno = 5
        - agno = 6
        - agno = 7
        - agno = 9
        - agno = 8
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done
Leave a Comment

Ubuntu重启网络服务

Ubuntu重启网络服务的命令总是那么另类。。

sudo stop network-manager
sudo service network-manager stop
sudo service network-interface restart INTERFACE=ethX
Leave a Comment