灌溉梦想,记录脚步

DD命令详解

1.命令简介
dd 的主要选项:

指定数字的地方若以下列字符结尾乘以相应的数字:

b=512, c=1, k=1024, w=2, xm=number m

if=file #输入文件名,缺省为标准输入。
of=file #输出文件名,缺省为标准输出。
ibs=bytes #一次读入 bytes 个字节(即一个块大小为 bytes 个字节)。
obs=bytes #一次写 bytes 个字节(即一个块大小为 bytes 个字节)。
bs=bytes #同时设置读写块的大小为 bytes ,可代替 ibs 和 obs 。
cbs=bytes #一次转换 bytes 个字节,即转换缓冲区大小。
skip=blocks #从输入文件开头跳过 blocks 个块后再开始复制。
继续阅读 »

linux启动过程

硬件读取引导扇区

加载LILO或者grub

加载内核

挂装根文件系统

启动/sbin/init ,一切进程的“祖父”

读取/etc/inittab文件

读取rc.sysinit文件

读取/etc/fstab文件

运行rcX.d下的文件(文件都是init.d下的符号链接)

其中有一个xinetd 的超级进程,调用/etc/xinetd.conf 配置文件,从配置文件中知道读/etc/xinetd.d 文件,结束后调用Miggetty

读取/etc/rc.d/rc.local文件

Oracle数据库常用基本命令

1、得到数据库名和创建日期

SELECT name, created, log_mode, open_mode FROM v$database;

2、ORACLE数据库的计算机的主机名,ORACLE数据库的实例名及ORACLE数据库管理系统的版本信息

SELECT host_name, instance_name, version FROM v$instance;

3、为了知道oracle数据库版本的一些特殊信息

select * from v$version;

4、获取控制文件名字

select * from v$controlfile;

继续阅读 »

Linux NFS Root and PXE-Boot

Linux kernel hacking and test running on the same machine becomes a major pain. This tutorial explains how to separate the two easily for a quick code-and-test loop. This tutorial explains how to setup a Linux thin client that boots using PXE by pulling a remote Linux kernel image and mounting a remote root file system over NFS. This is only possible if your client machine has a network card that supports this (do you remember seeing some type of option like press N to boot from network just after posting?). I am using Fedora Core 5 as my server, so some of the details may be specific to FC.

Most of the details of setting up the PXE boot server were found at Setting up a PXE-Boot Server.

1) yum install tftp-server dhcp
Make sure you have an NFS server.

2) create /etc/dhcpd.conf
继续阅读 »

PXELINUX

What is PXELINUX?

PXELINUX is a SYSLINUX derivative, for booting Linux off a network server, using a network ROM conforming to the Intel PXE (Pre-Execution Environment) specification. PXELINUX is not a program that is intended to be flashed or burned into a PROM on the network card; if you want that, check out Etherboot ( http://www.etherboot.org/).

If you want to create PXE-compliant boot PROM for your network card (to use with PXELINUX, for example), check out NetBoot (http://netboot.sourceforge.net/).

How do I Configure PXELINUX?

PXELINUX operates in many ways like SYSLINUX. If you are not familiar with SYSLINUX, read the SYSLINUX FAQ first, since this documentation only explains the differences.

继续阅读 »

Setting up a PXE-Boot Server

This documents how to setup a PXE boot server for Linux. This assumes that you’re using Redhat/FC as the PXE boot server. The vast majority of the information has been obtained from the following webpages:

http://dev.brantleyonline.com/wiki/index.php/General_Network_%28PXE%29_Booting
http://dev.brantleyonline.com/wiki/index.php/PXE_Booting_-_Fedora_Core

0) The first thing to note is that you need to setup your own mini-network that is completely disconnected from the network, since part of this process requires setting up a DHCP server which could conflict with the corporate DHCP server if they were both running on the same network simultaneously. So get yourself a switch from IT up front. You do *NOT* need the switch immediately, so just put it aside until I mention it again
later on.

1) The next step is to choose a box to be the PXE boot server. This can really be any box at all, as long as you have a NIC in it that works reliably under Linux. For the purposes of this documentation, I’m going to assume that you’ve loaded Fedora Core 4 on this box (do that now, if you’ve not already). Get this box onto the network with DHCP (just like a normal installation).
继续阅读 »

php读取mac地址

1. 
2.
3. class GetMacAddress {
4. var $return_array = array();
5. var $mac_addr;
6.
7. function _construct($os_type) {
8. switch (strtolower($os_type)) {
9. case "linux":
10. $this->forLinux();
11. break;
12. default:
13. $this->forWindows();
14. break;
15. }
16.
17. $temp_array = array();
18. foreach ($this->return_array as $value) {
19. if (preg_match(/[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-]20. .[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f]/i”, $value, $temp_array)) {
21. $this->mac_addr = $temp_array[0];
22. break;
23. }
24. }
25.
26. unset($temp_array);
27. return $this->mac_addr;
28. }
29.
30. function forWindows() {
31. @exec(”ipconfig /all”, $this->return_array);
32.
33. if ($this->return_array) {
34. return $this->return_array;
35. } else {
36. $ipconfig = $_SERVER["SystemRoot"].”\system32\ipconfig.exe”;
37. if (is_file($ipconfig)) {
38. @exec($ipconfig./all”, $this->return_array);
39. } else {
40. @exec($_SERVER["WINDIR"].”\system\ipconfig.exe /all”, $this->return_array);
41. }
42. return $this->return_array;
43. }
44. }
45.
46. function forLinux() {
47. @exec(”ifconfig -a”, $this->return_array);
48. return $this->return_array;
49. }
50. }
51.
52. $mac = new GetMacAddress(null);
53. echo $mac->mac_addr;
54.
55. ?>