輕松解決Linux系統grub錯誤

Linux在現在已經很強大了,導致Linux系統越來越受到電腦用戶的歡迎,於是很多人開始學習Linux時,學習時妳可能會遇到Linux系統grub常見錯誤問題,這裏將介紹Linux系統grub常見錯誤問題的解決方法,讓大家了解壹下。

  1:Filenamemustbeeitheranabsolutefilenameorblocklist

  解釋:1號錯誤表示文件名格式錯誤。在GRUB中要麽是以絕對路徑給出文件

  例子:

  grub>kernelvmlinuzroot=label=/

  Error1:Filenamemustbeeitheranabsolutepathnameorblocklist

  grub>

  2:Badfileordirectorytype

  解釋:2號錯誤表示命令期望的是壹個普通文件,但相應文件名的對象是壹個符號鏈接、目錄、FIFO

  例子:

  grub>kernel/testdirroot=LABEL=/

  Error2:Badfileordirectorytype

  grub>

  3:Badorcorruptdatawhiledecompressingfile

  解釋:3號錯誤表示解壓文件時發生錯誤。可能是因為這個文件被損壞了

  4:Badorincompatibleheaderincompressedfile

  解釋:4號錯誤表示壓縮文件的頭部格式不被兼容或者錯誤

  5:Partitiontableinvalidorcorrupt

  解釋:5號錯誤表示分區表無效或者被破壞。這是壹個不好的預兆

  6:Mismatchedorcorruptversionofstage1/stage2

  解釋:6號錯誤表示install命令發現stage1和stage2的頒布號不被兼容

  7:Loadingbelow1MBisnotsupported

  解釋:Thiserrorisreturnedifthelowestaddressinakernelisbelow

  the1MBboundary.TheLinuxzImageformatisaspecialcaseand

  canbehandledsinceithasafixedloadingaddressandmaximumsize

  8:Kernelmustbeloadedbeforebooting

  解釋:8號錯誤表示執行boot命令之前沒有先執行kernel命令

  9:Unknownbootfailure

  解釋:9號錯誤表示未知的引導錯誤

  10:UnsupportedMultibootfeaturesrequested

  解釋:10號錯誤表示請求Multibootheader所要求功能不被GRUB所支持。

  11:Unrecognizeddevicestring

  解釋:11號錯誤表示無法識別的設備字符串。

  例子:

  grub>roothd0

  Error11:Unrecognizeddevicestring

  grub>

  12:Invaliddevicerequested

  解釋:12號錯誤表示請求的設備無效

  例子:

  grub>root(hd2)

  Error21:Selecteddiskdoesnotexist

  grub>kernel/grub/grub.confroot=LABEL=/

  Error12:Invaliddevicerequested

  grub>

  13:Invalidorunsupportedexecutableformat

  解釋:13號錯誤表示無效或者無法識別的可執行格式

  例子:

  grub>kernel/grub/grub.confroot=LABEL=/

  Error13:Invalidorunsupportedexecutableformat

  grub>

  14:Filesystemcompatibilityerror,cannotreadwholefile

  解釋:14號錯誤表示文件系統兼容性錯誤,無法讀取整個文件

  15:Filenotfound

  解釋:請求的文件無法找到

  例子:

  grub>find/grub-noexist/grub.conf

  Error15:Filenotfound

  grub>

  16:Inconsistentfilesystemstructure

  解釋:16號錯誤表示不壹致的文件系統結構。可能是文件系統結構被破壞了。

  17:Cannotmountselectedpartition

  解釋:17號錯誤表示無法掛載指定分區。例如swap分區

  例子:

  grub>root(hd0,2)這是壹個swap分區

  Filesystemtypeunknown,partitiontype0x82

  grub>kernel/vmlinuz

  Error17:Cannotmountselectedpartition

  grub>

詳細分析Linux du命令的使用

Linux du命令也是查看使用空間的,但是與df命令不同的是Linux du命令是對文件和目錄磁盤使用的空間的查看,還是和df命令有壹些區別的,這裏介紹Linux du命令。

  du:查詢檔案或目錄的磁盤使用空間

  a:顯示全部目錄和其次目錄下的每個檔案所占的磁盤空間

  b:大小用bytes來表示 (默認值為k bytes)

  c:最後再加上總計 (默認值)

  s:只顯示各檔案大小的總合

  x:只計算同屬同壹個檔案系統的檔案

  L:計算所有的檔案大小

  常用命令:du –a

  操作詳解

  引用

  指令 du 能以指定的目錄下的子目錄為單位,顯示每個目錄內所有檔案所占用的磁盤空間大小。例如:

  # du -h /etc

  104K /etc/defaults

  6.0K /etc/X11

  8.0K /etc/bluetooth

  4.0K /etc/gnats

  52K /etc/isdn

  388K /etc/mail

  68K /etc/mtree

  2.0K /etc/ntp

  38K /etc/pam.d

  44K /etc/periodic/daily

  6.0K /etc/periodic/monthly

  42K /etc/periodic/security

  16K /etc/periodic/weekly

  110K /etc/periodic

  6.0K /etc/ppp

  318K /etc/rc.d

  2.0K /etc/skel

  130K /etc/ssh

  10K /etc/ssl

  1.7M /etc

  我們目樣使用 -h 參數來顯示 human-readable 的格式。在應用時,我們可以使用 du 這個指令來查看哪個目錄占用最多的空間。不過,du 的輸出結果通常很長,我們可以加上 -s 參數來省略指定目錄下的子目錄,而只顯示該目錄的總合即可:

  # du -sh /etc

  1.7M /etc

  在查看目錄的使用情形時,我們可以將輸出結果導到 sort 指令進行排序,以了解哪個檔案用了最多的空間:

  # du /etc | sort -nr | more

  1746 /etc

  388 /etc/mail

  318 /etc/rc.d

  130 /etc/ssh

  110 /etc/periodic

  104 /etc/defaults

  68 /etc/mtree

  52 /etc/isdn

  44 /etc/periodic/daily

  42 /etc/periodic/security

  38 /etc/pam.d

  16 /etc/periodic/weekly

  10 /etc/ssl

  8 /etc/bluetooth

  6 /etc/ppp

  6 /etc/periodic/monthly

  6 /etc/X11

  4 /etc/gnats

  2 /etc/skel

  2 /etc/ntp

  sort 的參數 -nr 表示要以數字排序法進行反向排序,因為我們要對目錄大小做排序,所以不可以使用 human-readable 的大小輸出,不然目錄大小中會有 K、M 等字樣,會造成排序不正確。

  現在明了了Linux du命令和Linux df命令的不同之處了嗎。

Linux學習-Iterator叠代得到list中的值

Iterator叠代可以得到list中的數值。

  Iterator  iterator  =  list.iterator() ;

  While( iterator.hasNext()){

  String XX=(String)iterator.next();

  }

  註意在while循環中壹定要有iterator.next();且只能出現壹次,必須有是因為只有.next()才能得到下壹條數據,否則進入死循環,只能有壹次是因為,出現壹次得到嚇壹跳記錄,如果同時出現兩次,則是在以此循環中得到了兩個數據。