Posts

Showing posts with the label linux

Logical Volume Management

Image
Logical Volume Management Table of Contents What is LVM? Conceptions How to create PV create VG create LV 1 What is LVM? LVM stands for Logical Volume Management, which is one kind of virtual disk partition. In the traditional way, We need to separate a disk into multiple partitions, then format that partition with a filesystem. Once you write the partition table to the disk, rewrite this table will lose all your disk data. But, LVM gave more scalable and dynamic options, we can adjust and re-create partitions without reboot and re-mount process. 2 Conceptions VG:   Volume Groups PV:  Physical Volumes LV:   Logical Volumes Volume Groups is a collection of Logical volumes, and it is created on top of physical volumes, Physical Volumes are physical disk partitions with LVM header. Logical Volumes are the final partitions that we can format with our favorite filesystem. Topology of these concepts: one Volume Group can include more...

Install Software RAID in Linux System

Image
Install Software RAID in Linux System Table of Contents Benefit Prepare install and configure mdadm finished 1 Benefit RAID can provide stable, speed and security for your data access, but not at the same time. We need different performance at a different scenario, and the above three traits that I mentioned, are trade-off factors in real apply, some time we sacrifice one to achieve another. In my desktop work station, what I really need is the speed all the time. That's the RAID-0. Here is my disks, one SSD as the system disk for ubuntu, and two additional 1T disks to be an RAID-0 array. 2 Prepare Plug two disks into the motherboard first, then erase the disk's format use fdisk tool and build one partition for each one with the same size. In my case, I got two devices, /dev/sdb, /dev/sdc. sudo fdisk /dev/sdb # d .... delete all partition in the hard driver # n create one partition for the whole disk # t choice fd (linux raid disk) ...

RAID learning

Image
RAID learning Table of Contents RAID's benefit RAID's types type 0 type 1 type 10 type 2, 3, 4 type 5 type 6 RAID's limitation 1 RAID's benefit So, what the RAID is? RAID is short for Redundant Array of Independent Disks. In the storage industry, the speed, redundancy, and cost are the three factors that the market cares about. I/O speed: hard drive's I/O performance is limited by the physical law, if we continue to use magnetic storage materials. redundancy: the fault of a subset disks in an array can't damage the whole data stored in them. cost: the density of data per dollar. RAID is a common solution to face that. 2 RAID's types 2.1 type 0 parallel multi disks together, with the highest disk write/read IO performance, but none data security. split the data into n pieces, n equals to the array size of the disks. And both the write and read are parallel to improve the speed, but one disk's damage c...

How to setup a NAT server?

Image
How to setup an NAT server? Table of Contents What is NAT? How to setup NAT host? a shell script from vbird's book 1 What is NAT? NAT stands for Network Address Transition, which is the basic function of gateway host. I try to hack Bluetooth tethering module in android this week, it include the Bluetooth Pan profile and the NAT setup process, which means in order to implement the Bluetooth tethering, first, two devices must be connected by Bluetooth Pan profile, and then the server part device acted as gateway host to supply the network forward service. In other words, after Bluetooth Pan profile connected, the server must to setup its NAT rules to forward the IP packages. So how to setup NAT rules? 2 How to setup NAT host? My memory is still fresh that at the start of my Linux journey, I setup my Linux desktop as an NAT host to provide Internet services for my lab's classmates. During the days as a programmer, I once did a job to hacking android...

Install GTK+-3.8.7 into Ubuntu 12.04 from scratch

Image
Install Gtk+-3.8.7 into Ubuntu 12.04 from scratch Table of Contents Preparation How the compile the source code from the beginning? 1 Preparation The first step is alway to download the needed package. I give the following shopping list: software package Download URL glib-2.36.4 http://ftp.gnome.org/pub/gnome/sources/glib/2.36/ gdk-pixbuf-2.28.2 http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.28/ atk-2.8.0 http://ftp.gnome.org/pub/gnome/sources/atk/2.8/ fontconfig-2.11.0 http://www.freedesktop.org/software/fontconfig/release/ harfbuzz-0.9.24 http://www.freedesktop.org/software/harfbuzz/release/ pango-1.34.1 http://ftp.gnome.org/pub/gnome/sources/pango/1.34/ libatk-bridge2.0 http://packages.ubuntu.com/zh-cn/quantal/libatk-bridge2.0-0 libatk-bridge2.0-dev http://packages.ubuntu.com/zh-cn/quantal/libatk-bridge2.0-dev gtk+-3.8.7 http://ftp.gnome.org/pub/gnome/sources/gtk+/3.8/ My operating system is Ubuntu 12.04 ...

Use readline library to built command line tools

Image
Use readline library to built command line tools Table of Contents 1 Why readline library? 2 How to use it? 1 Why readline library? As a Linux programmer, I always need to write some command line tools, with the help of GNU Readline library , this mission can be a snap. So what's the readline library gives for us, according to its official document? It provides a set of functions which allow users to edit command lines as they typed in. What's more, it also supports history recording and auto-completion. It is GNU software and is distributed under the terms of GPL license. 2 How to use it? I upload my source code, using the readline library, which implemented a silly command line tools with only two command inside – help and quit, but I can add another command easily in its framework. It support history recoding, which means you can browser the your command history by up/down keys, but it still cann't support command auto-completion(I will ad...

Which storage cloud to choose?

Image
Dropbox, Box, Google driver, Ubuntu one or icloud ? Table of Contents 1 Storage in cloud products 2 My working environment 3 How Storage cloud improved my life? 4 Which product I like the most? 1 Storage in cloud products Now I wanna too share some good storage cloud products that I used in my daily work. A good storage cloud tool can offer you so much convenient in daily life and increase your productivity and efficiency at work. Here is my own experience with some cloud products. So, What is the storage cloud products? It is a services that can store your data into cloud and can share it everywhere. Here is the storage cloud services that I already used. free size OS compatibility GFW compatibility Dropbox 5G Linux, Mac, Windows OK Box 50G Mac, Windows OK Google Driver 15G Mac, Windows Need to fuck GFW ubuntu one 5G Linux(ubuntu), Mac, Windows OK icloud 5G Mac, Windows OK 2 My working environment Before to illustrate this question, I ...

Suspend my laptop by Command

Image
Suspend my laptop by Command Suspend my laptop by Command I upgrade my fedora desktop to fedora18, and get some trouble after upgrade. One of them is that my old script to suspend my laptop do not works anymore(I like to suspend my laptop without close its screen lid.) . My old script to suspend the PC: # !/bin/ bash dbus-send --system --print-reply --dest=org.freedesktop.Hal \ /org/freedesktop/Hal/devices/computer \ org.freedesktop.Hal.Device.SystemPowerManagement.Suspend \ int32:0 Table of Contents 1 Why HAL dbus interface did not works 2 Two ways to Suspend/Hibernate the Laptop 1 Why HAL dbus interface did not works The reason is that HAL(Hardware Abstraction layer) is now deprecated on freedesktop environment, and it is emerged into udev package. In HAL's offical website, It declared that HAL is in maintenance mode, all future development focus in udisks and upower. So I guess upower maybe provide some power ma...

Linux Share Memory

Linux Share Memory Linux Share Memory Table of Contents 1 Introduction 2 tmpfs .vs. shm_open 3 shmget .vs. shm_open 1 Introduction Shared memory is one kinds of mechanism to do effective IPC. There are three kinds of API to share memory among different processes: shmget shm_open tmpfs 2 tmpfs .vs. shm_open df -h This command can list the mounted file systems. In general, there will be a record:   tmpfs 1.9G 748K 1.9G 1% /dev/shm tmpfs is one kinds of file system which store the file data in virtual memory instead of hard disk. It can speed up the program which needs temp storage. Because of its file store in virtual memory, It can be used as a shared memory facility. While according to shm_open's manual, the name parameter of shm_open is actually an object name, not a file path. So I read glibc's source code and find the definition the shm_open, It just concatenate tmpfs path name with the ...

daily operations of rpm

+查询验证操作 rpm -qpl xxxx.i386.rpm 查询软件包所有文件详细的安装位置 rpm -qpi xxxx.i386.rpm 查看软件包的详细资料信息 rpm -qp xxxx.i386.rpm 查看RPM包对应的软件包 rpm -qs xxxx 查询软件包对应的所有文件的状态 rpm -qa | grep xxxx 仅知道软件包名的关键字,查看有哪些相应软件包已经安装 rpm -qf xxxx 快速定位文件属于哪个软件包 rpm -Va xxxx 误操作后,查看什么文件缺失或者损坏 +安装/升级/移除操作 rpm -ivh xxxx.i386.rpm 普通安装 rpm -Uvh xxxx.i386.rpm 升级安装(软件包若不存在,相当于普通安装) rpm -e xxxx 软件包名必须精确,可以先查询后卸载

自制T恤,为开源软件作宣传

Image
五一期间没有事做,干什么呢?自制做个T恤,宣传linux吧!毛主席说过自己动手丰衣足食吗,更何况这也符合linux的精神。 选择目标:在linuxsir上得到启发,做个opensuse的logo,因为比较简单,而且自己用suse也有一年了,作个纪念吧。 行动:丙烯颜料(黄,青)两管,水粉笔(5号)一支,勾线用的小笔一支,白色圆领T恤一件,总共35元。 (其中T恤25元,其它各2.5元),还有用实验室的美工刀,和打印机打印了一张suse的logo。 最后效果还行,不过第一次做细节的掌握还不行,涂料弄得不均匀,但不仔细看观察不出来。 准备过几天热了,穿出去拉拉风!