顯示具有 Linux作業系統的奧義 標籤的文章。 顯示所有文章
顯示具有 Linux作業系統的奧義 標籤的文章。 顯示所有文章

2013年8月30日 星期五

Linux 磁碟與檔案系統管理

最近,本來是在想說要不要對硬碟重組.
但找不到其相關的功能,查了一下才發現其linux是不需要其功能地
其實,其"磁碟重組"中最主要是因為檔案資料離散.

系統管理員很重要的任務之一就是管理好自己的磁碟檔案系統,每個分割槽不可太大也不能太小, 太大會造成磁碟容量的浪費,太小則會產生檔案無法儲存的困擾。此外,我們在前面幾章談到的檔案權限與屬性中, 這些權限與屬性分別記錄在檔案系統的哪個區塊內?這就得要談到 filesystem 中的 inode 與 block 了。 在本章我們的重點在於如何製作檔案系統,包括分割、格式化與掛載等,是很重要的一個章節喔!


basic of pc BIOS

BIOS(base input output system)
目的:啟動元件,檢查硬体,分配資源,協助載入系統
名詞:北橋,南橋
      Flash memory
      CMOS,SMBIOS

北橋:負責 CPU,Memory
南橋:負責 PCI,PCI-E,USB,VGA,週邊設備且裡有儲存CMOS的設定
SMBIOS:當BIOS啟動後,會先確認cmos中資料是否正確。若正確後,則接下來會將
       之前使用者儲存的cmos資料,加上之前硬体資料,整合為一個表格並寫入memory

作用:
1。自動檢查及進行初始化動作:bios在開機的同時,會針對主皮上所有晶片做偵測,
   並通知  各晶片開始動作
2。記錄系統設定值:透過BIOS來改變各種設定
3。中斷㲃理:mainboard上所有資源,都是由bios所分配
4。載入偏業系統:由bios轉交開機軌,再由開機軌轉交各分割區
-------------
一,Power on :
   檢查mainboard上某硬体狀態及存放cmos的設定
二,post     :開機自我測試(power on self test)
   在post中會去檢查cpu,memory,vga card...是不己就緒,在完成後
   會將所有資訊顯示,並儲存在memory中的smbios(*2

硬碟的第零軌(MBR,master boot record)   
fig 1.

bios在完成動作後,將載入作業系統的主控權交給硬碟中的主啟動磁區,master boot record,也就是硬碟中的第0軌
1,進入後,bios將第一個磁區,載入memory中執行,再開始運作。
   bootloader:儲存開機管理程式:其偏用於1,載入磁區 2,指向kernel
fig 2.
fig 3.
a.載入磁區:
  mbr中,將disk分為多個分割區(以MBR中Partition table)而在分割後的各分割區中
  的第一個磁區便是開機磁區(就是放作業統統産生的bootloader)
b.載入kernel
  直接透過分割區及設定檔的資料,找到分割區中的指定kernel
fig.4




----------------------------------
ps:
*1)
在進入bios(在螢幕未反應)前為power on :
1.cpu 啓動
2,cpu找bios
3。bios在自己的flash memory執行自己的程序
4。bios動作開始,並載入南橋的資料
*2)
可以以#dmidecode 顯示

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: LENOVO
        Product Name: 7733B83
        Version: ThinkPad R61
        Serial Number: L3H0196
        UUID: B35E2601-4A97-11CB-B01E-E6563218FB95
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: ThinkPad R61
-----------
若鈖割區B
有獨自安裝GRUB
 (1).開機由GRUB1,並讀取Linux A的config
 (2).依據config 1,産生選單,使用者選擇後,再進入GRUB2中
 (3)。在GRUB2中,依其config 2産生選單
 (4)。選擇載入kernel
無獨立安裝GRUB
 (1)。由GRUB1開機
 (2)。透過config 1.選擇
Partition Table與 Magic Number
Partion Table:
  儲存硬碟分割表的地方,總大小為64byte。硬碟中分割區有多少,每一分割區的大小都紀錄
  在其中。因大小有所限制,故只能記錄4個主分割區(每個16byte)。如需第5個或以上之分
割區,就只能用掉一個分割區,並把它做為𨒂伸分割區

OPENCSL - 打開嵌入式系統操作大門的開放教材

這是一個說明如何開發嵌入式系統的操偏環境課程
共有8的章節
目前,我己實作了二個(環境建立;kernel的建立

 




 beagleboard


http://opencsl.openfoundry.org/

套件管理Rpm,tarball

RPM(8)                                                                  RPM(8)

NAME
       rpm - RPM Package Manager

SYNOPSIS
   QUERYING AND VERIFYING PACKAGES:
       rpm {-q|--query} [select-options] [query-options]

       rpm {-V|--verify} [select-options] [verify-options]

       rpm --import PUBKEY ...

       rpm {-K|--checksig} [--nosignature] [--nodigest]
           PACKAGE_FILE ...

   INSTALLING, UPGRADING, AND REMOVING PACKAGES:
       rpm {-i|--install} [install-options] PACKAGE_FILE ...

       rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

       rpm {-F|--freshen} [install-options] PACKAGE_FILE ...

       rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts]
           [--notriggers] [--test] PACKAGE_NAME ...

kernel

kernle基本上,即一個linux.提供了一個完整的作業系統當中最底層的硬体控制與資源管理的架構。
一個系統中組成元件(硬体,可支配管理硬体的核心,溝通使用者與核心的interface)
     user
-------------------------
使用者interface
(shell,KDE,application)
------------------------
   核心(kernel
------------------------
   硬体(hardware
----------------
Distribution
linux為一個kernel,而為了對不同的要求。許多人會其kernel中加入了許多
不同需支及調整的軟体。像是sendmail'wu-ftp'apache....
需許多公司就將一些需要的軟体套件加掛到linux核心程式中,並發行
此類即為稱為 “distribution”(完整安裝套件)
注名的有
red hat
mandrake
slackware
suse
openlinux
debian
linpus
及unbuntu



基本功能
system call interface:一些服務與kernel溝通之後,將硬体旳資源進一步的利用
process control:系統程序控制中心
memory managernent: 控制系統的記憶体管理
file system management:檔案系統的管理。(包含著I/O,linux中視各i/o為一個檔案
device drivers:硬体的管理是kernel的主要工作之一。裝置的驅動程式。(可載入模姐。將驅動程式編輯成模組,就不需要重新編譯核心。
目前的kernel版本
[root@localhost grub]# uname -ra
Linux localhost.localdomain 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 i686 i386 GNU/Linux


ps:
UNAME(1)                         User Commands                        UNAME(1)

NAME
       uname - print system information

SYNOPSIS
       uname [OPTION]...

DESCRIPTION
       Print certain system information.  With no OPTION, same as -s.

       -a, --all
              print all information, in the following order, except omit -p and -i if unknown:

       -s, --kernel-name
              print the kernel name

       -n, --nodename
              print the network node hostname

       -r, --kernel-release
              print the kernel release

       -v, --kernel-version
              print the kernel version

       -m, --machine
              print the machine hardware name

       -p, --processor
              print the processor type or "unknown"

-----------------------
kernel相關的網站
http://www.kernel.org/
http://archives.fedoraproject.org/pub/archive/fedora/
中文linux extend: http://cle.linux.org.tw/wp/  
台灣Fedora :http://fedora.tw/

2012年6月26日 星期二

The Linux Directory Structure Explained

在一開始使用Unix-like system時,對於其檔案系統架構。最為不了解,

 

The Filesystem Hierarchy Standard (FHS) defines the structure of file systems on Linux and other UNIX-like operating systems.


/ – The Root Directory
Everything on your Linux system is located under the / directory, known as the root directory.
/bin – Essential User Binaries
The /bin directory contains the essential user binaries (programs) that must be present when the system is mounted in single-user mode.
Applications such as Firefox are stored in /usr/bin, while important system programs and utilities such as the bash shell are located in /bin.
The /sbin directory is similar – it contains essential system administration binaries.
image
image
image
/boot – Static Boot Files
The /boot directory contains the files needed to boot the system – for example, the GRUB boot loader’s files and your Linux kernels are stored here. The boot loader’s configuration files aren’t located here, though – they’re in /etc with the other configuration files.
/cdrom – Historical Mount Point for CD-ROMs
It’s a temporary location for CD-ROMs inserted in the system. However, the standard location for temporary media is inside the /media directory.
/dev – Device Files
Linux exposes devices as files, and the /dev directory contains a number of special files that represent devices.
These are not actual files as we know them, but they appear as files – for example, /dev/sda represents the first SATA drive in the system.
image
/etc – Configuration Files
The /etc directory contains configuration files, which can generally be edited by hand in a text editor. Note that the /etc/ directory contains system-wide configuration files – user-specific configuration files are located in each user’s home directory.
image
/home – Home Folders
The /home directory contains a home folder for each user. For example, if your user name is bob, you have a home folder located at /home/bob. This home folder contains the user’s data files and user-specific configuration files.
/lib – Essential Shared Libraries
The /lib directory contains libraries needed by the essential binaries in the /bin and /sbin folder. Libraries needed by the binaries in the /usr/bin folder are located in /usr/lib.
/lost+found – Recovered Files
Each Linux file system has a lost+found directory. If the file system crashes, a file system check will be performed at next boot. Any corrupted files found will be placed in the lost+found directory, so you can attempt to recover as much data as possible.
/media – Removable Media
The /media directory contains subdirectories where removable media devices inserted into the computer are mounted.
For example, when you insert a CD into your Linux system, a directory will automatically be created inside the /media directory. You can access the contents of the CD inside this directory.
/mnt – Temporary Mount Points
Historically speaking, the /mnt directory is where system administrators mounted temporary file systems while using them. For example, if you’re mounting a Windows partition to perform some file recovery operations, you might mount it at /mnt/windows. However, you can mount other file systems anywhere on the system.
/opt – Optional Packages
The /opt directory contains subdirectories for optional software packages. It’s commonly used by proprietary software that doesn’t obey the standard file system hierarchy – for example, a proprietary program might dump its files in /opt/application when you install it.
/proc – Kernel & Process Files
The /proc directory similar to the /dev directory because it doesn’t contain standard files. It contains special files that represent system and process information.
image
/sbin – System Administration Binaries
The /sbin directory is similar to the /bin directory. It contains essential binaries that are generally intended to be run by the root user for system administration.
image
/selinux – SELinux Virtual File System
If your Linux distribution uses SELinux for security (Fedora and Red Hat, for example), the /selinux directory contains special files used by SELinux.
none.
/srv – Service Data
The /srv directory contains “data for services provided by the system.” If you were using the Apache HTTP server to serve a website, you’d likely store your website’s files in a directory inside the /srv directory.
image
/tmp – Temporary Files
Applications store temporary files in the /tmp directory. These files are generally deleted whenever your system is restarted and may be deleted at any time by utilities such as tmpwatch.
/usr – User Binaries & Read-Only Data
The /usr directory contains applications and files used by users, as opposed to applications and files used by the system. For example, non-essential applications are located inside the /usr/bin directory instead of the /bin directory and non-essential system administration binaries are located in the /usr/sbin directory instead of the /sbin directory
image
/var – Variable Data Files
The /var directory is the writable counterpart to the /usr directory, which must be read-only in normal operation. Log files and everything else that would normally be written to /usr during normal operation are written to the /var directory. For example, you’ll find log files in /var/log.
image

The Linux Directory Structure Explained



















2012年4月28日 星期六

The 16 Linux Shell Commands Every Desktop Linux User Should Know


1.Shell Basics
echo $SHELL
That $ sign? In Linux, the dollar sign stands for a shell variable.
在使用時,其大小寫必須注意.
另一個是要知道其shell中的command string可以合在一起的.


2011年5月5日 星期四

查看cpu information


~$ cat /proc/cpuinfo
即可

  • /proc - dynamic directory including information about and listing of processes
----------------------------------------------
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 22
model name : Intel(R) Celeron(R) CPU          540  @ 1.86GHz
stepping : 1
cpu MHz : 1861.591
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx lm constant_tsc up arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl tm2 ssse3 cx16 xtpr pdcm lahf_lm
bogomips : 3723.18
clflush size : 64
cache_alignment : 64
----------------------------------------
而在 /proc 中的
steven@steven-laptop:/proc$ ls
1      1326   1402  1704  332   8015       cmdline        mounts
10     1327   1413  1711  35    8017       cpuinfo        mtrr
10016  1333   1414  18    4     803        crypto         net
10034  1340   1420  1806  42    8046       devices        pagetypeinfo
1008   1342   1421  19    44    8049       diskstats      partitions
1011   1347   1422  2     47    8052       dma            sched_debug
1046   1354   1432  20    48    807        dri            schedstat
1049   1356   1434  21    49    8299       driver         scsi
10839  1357   1436  22    5     8393       execdomains    self
11     1358   1442  23    50    8440       fb             slabinfo
11140  1359   1451  238   51    8444       filesystems    softirqs
11162  1361   1452  239   52    882        fs             stat
1159   1363   1477  24    586   893        interrupts     swaps
1176   1364   1478  245   591   898        iomem          sys
1193   13808  1480  246   6     9          ioports        sysrq-trigger
1197   13809  1487  247   626   908        irq            sysvipc
12     1381   1488  251   650   909        kallsyms       timer_list
1201   13810  1496  27    656   913        kcore          timer_stats
1261   1385   1498  2742  696   915        key-users      tty
12643  1387   15    28    7     925        kmsg           uptime
12644  1389   1502  285   718   926        kpagecount     version
1267   1391   1551  286   734   945        kpageflags     version_signature
12807  1392   1589  287   787   978        latency_stats  vmallocinfo
1285   1394   1590  29    793   9963       loadavg        vmstat
13     1395   16    3     797   acpi       locks          zoneinfo
13005  1397   1602  30    799   asound     mdstat
13109  13974  1609  31    8     buddyinfo  meminfo
1316   14     1629  32    800   bus        misc
1323   1400   17    329   8012  cgroups    modules

可由此一目錄中查看出所有的相關硬体資訊

------------------------------
參考資料: 

2011年4月2日 星期六

screen blanking

前題:
因為,在我的Ubuntu下.雖然有選項可以鎖往螢幕.但其螢幕只是全黑.而非關閉螢幕.
前陣子,找到一篇在講在X下設定的文章.目前會先關閉螢幕,再由系統來進入鎖住的動作


2010年1月6日 星期三

Wine

前言:
 最近,想要把windows中常用的廣播軟体。搬到Fedora中使用。故我便朝此方向
而在搜尋中,看到好幾種的方式
1。安裝Virtual machian

2。wine

在目前我所使用的linux dri..中,它有一個“虛擬機器管理員”。但因為我還未使用
故,我是採用原始的。Wine來進行windows程序的轉移動作。

2009年12月24日 星期四

檔案/目錄管理

主要檔案種類
1.正規(regular file):一般的檔案類型
  ;純文字(ascii);二進位(binary)
2.目錄(directory)
3.連結(link)
4.設備(device)
  區塊:如硬碟;字元 :序列設備

使用者與群組,
在linux中,為多人多工的環境.故會針對使用者採取一些必要的管理.
那些檔案是何者可開啓,可寫入等
;而對於群組,則為為支援多人共用檔案時,所設計的功能.能夠區分出
單簡地對檔案以區分是那個群組可讀'寫的

2009年12月17日 星期四

sudo(超級使用者)

在管理多什使用的Linux,AIX,HP-UX'IRIX和Solaris系統時,系統管理者可以選擇直接給需要的人root的權限,或是進一步了解sudo的用法---以系統安全為前提下,規劃指令與檔案的使用權限。“sudo讓一般使用者擁有系統管理者的部份或全部權限,直接執行管理的指令”

sudo(superuser do)超級使用者,superuser即為root.但在sudo的功能設定下
,使用者並不是只能夠以superuser/root的身份執行指令,你也可以設定為以
其它的身份去偏。

2009年12月12日 星期六

在linux中使用rar

在linux中,其壓縮格式有許多
*.tar, *.tar.gz, *.tgz, *.gz, *.Z, *.bz2
*.Z         compress 程式壓縮的檔案;
*.gz        gzip 程式壓縮的檔案;
*.bz2       bzip2 程式壓縮的檔案;
*.tar       tar 程式打包的資料,並沒有壓縮過;
*.tar.gz    tar 程式打包的檔案,其中並且經過 gzip 的壓縮
*.tar.bz2   tar 程式打包的檔案,其中並且經過 bzip2 的壓縮
 

2009年12月10日 星期四

linux相關網站

http://www.rpmfind.net/linux/RPM/index.html  找rmp
中文linux extend: http://cle.linux.org.tw/wp/  
台灣Fedora :http://fedora.tw/   
study-area :http://www.study-area.org --各類文件**
鳥哥:http://linux.vbird.org/ --各類文件**
狼主:http://netlab.kh.edu.tw//index.htm --網路實驗室
臥龍:http://news.ols3.net/ --shell
大南:http://freebsd.lab.mlc.edu.tw/ --網站安裝及設定
台灣linux:http://www.linux.org.tw
大高雄linux:http://kalug.linux.org.tw/ 
LinuxQuestions :http://www.linuxquestions.org/ 
http://www.savs.hcc.edu.tw/~chuavv/lcmd/lcmd.htm 

2009年12月7日 星期一

GRUB(GRAND Unified Bootloader)

一部 Linux 電腦開機時, 大概要經過下列程序:
  1. BIOS 根據 boot priority 的設定, 挑選某顆硬碟或隨身碟
  2. 這顆碟的 MBR (Master Boot Record)
  3. 開機管理程式 boot loader
  4. 使用者從選單挑一個作業系統
  5. 開機管理員載入 Linux 核心 (通常檔名類似 vmlinuz) 及初始的檔案系統 (通常檔名類似 initrd.gz)
  6. 將根目錄切換至某個分割, 進入正常系統