yum install gcc gcc-c++ autoconf automake
Monthly Archives: October 2013
git clone repo
Clone the repository
git clone <repository_url>
List all branches
git branch -a
Checkout the branch that you want
git checkout <name_of_branch>
linux – get list superbocks from ext partition
mke2fs -n /dev/sda2
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
91037696 inodes, 364121856 blocks
18206092 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
11113 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
linux – fallocate vs dd
fallocate -l 8g /tmp/8gb
dd if=/dev/zero of=/tmp/8gb bs=1m count=8000
linux – e2fsck out of memory
create a /etc/e2fsck.conf
[scratch_files] directory = /var/cache/e2fsck
linux – create a swap file
dd if=/dev/zero of=/10g.img bs=1000 count=0 seek=$[1000*1000*10]
mkswap /10g.img
swapon /10g.img
/10g.img swap swap defaults 0 0
linux – run e2fsck on a partition (fsck)
e2fsck is used to check the ext2/ext3/ext4 family of file systems.
sudo e2fsck -C0 -p -f -v /dev/sdb1
if errors:
sudo e2fsck -f -y -v /dev/sdb1
-C0 This option causes e2fsck to write completion information to the specified file descriptor
-p Automatically repair (“preen”) the file system.
-f Force checking even if the file system seems clean.
-v Verbose mode.
linux – copy partition table
Save:
sfdisk -d /dev/sda > part
Restore:
sfdisk /dev/sdb < part
linux – clone disk with dd and progress bar
dd if=/dev/sda bs=4096 conv=notrunc,noerror,sync | pv | gzip -c -9 > /root/sda.gz
linux align command output
Sometimes some commands can give you not aligned output like this:
procs ———–memory———- —swap– —–io—- –system– —–cpu—–
r b swpd free buff cache si so bi bo in cs us sy id wa st
12 0 7406848 361600 215560 7777776 0 0 38 83 0 0 20 7 65 8 0
25 0 7406848 366428 215560 7778240 0 0 24 28 9946 6872 52 19 28 1 0
24 0 7406848 371024 215568 7778736 0 0 36 396 10088 5820 65 19 15 0 0
37 0 7406844 374752 215568 7779248 0 0 0 88 10317 6669 59 15 25 0 0
29 2 7406844 377488 215568 7779804 0 0 152 712 10984 6304 59 18 21 1 0
what to do?
Percona can suggest some perl based tools:
wget percona.com/get/pt-align && chmod +x pt-align && \cp ./pt-align /usr/bin/al
Now:
vmstat 1 5 | al
centos – current keyboard layout
cat /etc/sysconfig/keyboard
KEYTABLE=”uk”
MODEL=”pc105″
LAYOUT=”gb”
KEYBOARDTYPE=”pc”
you can use this tool also system-config-keyboard if Debian dpkg-reconfigure locales
device eth0 has different mac address than expected – CENTOS
When you see this message you should check 2 places:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/udev/rules.d/70-persistent-net.rules
you don’t need restart server, but not in this way: udevadm control –reload-rules
if you are using Centos OS;
start_udev && service network restart
linux – print statistics about users connect time
ac -p
linux dentry
A dentry is the glue that holds inodes and files together by relating inode numbers to file names. Dentries also play a role in directory caching which, ideally, keeps the most frequently used files on-hand for faster access. File system traversal is another aspect of the dentry as it maintains a relationship between directories and their files.
The differences between dentry and inode are that dentry is used to facilitate directory-specific operations, inode is just a collection of metadata about files and directories. Superblock is the abstraction of filesystem.
kernel slab cache
Linux has tons of frequently used objects in the kernel such as buffer heads, inodes, dentries, etc. and have their own cache. The file /proc/slabinfo (less /proc/slabinfo) gives statistics.