ls與du的問題 - Linux

Regina avatar
By Regina
at 2011-05-24T19:03

Table of Contents


各位好

今天小弟在CentOS上使用了virt-machine 建立了一個image

(有勾選一個選項 是不allocate全部的file size)

這個image size的大小使用du和ls看的並不相同

ls 的大小是在建立image的時候 所設定的,如設定20GB, ls所出現的size會約20GB

但是使用du看的話,真正的size是約6~7GB


不過真正在傳輸檔案的時候,仍然會是20GB的這個size (所以傳送的時間還是很久…)

不知道有沒有什麼辦法可以把真正有使用到的那些資料取出來呢

(雖然ls是20GB的檔案,取出來的是6GB的檔案這樣)


不過小弟也想偷偷問一下 du和ls為什麼顯示出來的size會不相同…

謝謝各位版大 <(_ _)>


--
Tags: Linux

All Comments

Isla avatar
By Isla
at 2011-05-25T20:00
du 是 disk usage of each FILE
Hedwig avatar
By Hedwig
at 2011-05-27T05:20
ls 可以用 --block-size 或 -k 來看
Ethan avatar
By Ethan
at 2011-05-28T23:00
應該是 image 中的 / 和 swap 兩個partition的hole造成
google lseek hole
Kama avatar
By Kama
at 2011-05-29T11:44
忘了第1個問題.先gzip傳檔後gunzip,或許可以快一點.
Zora avatar
By Zora
at 2011-05-31T13:47
哦~ 原來不是我想的那麼簡單啊~ sorry ~
Victoria avatar
By Victoria
at 2011-06-03T17:40
今天我有試過要壓縮這個file,不過是使用tar 壓了半個多
小時 就放棄了 QQ
Charlotte avatar
By Charlotte
at 2011-06-04T03:25
你傳檔用什麼協定? LAN or Internet?
Leila avatar
By Leila
at 2011-06-08T20:04
rsync好像有compress
Irma avatar
By Irma
at 2011-06-11T16:47
傳檔是使用WinSCP 直接連到那台機器上抓下來 是LAN
Leila avatar
By Leila
at 2011-06-14T15:36
ssh就算是0000000000也是要加密的啊~
Kelly avatar
By Kelly
at 2011-06-16T23:59
目前我有找到好像是 sparse file的關係 明天我再來解看看
如果有找到原因和解法的話,再向大家回報 <(_ _)>
Eden avatar
By Eden
at 2011-06-21T23:51
是sparse file沒錯啊, 都是0的地方實際上沒存起來
George avatar
By George
at 2011-06-23T11:50
以下方法我自己沒試過,假設你Windows是用NTFS,可以下載
Emma avatar
By Emma
at 2011-06-24T05:07
(sourceforge的) win32 rsync, 用 -S 參數, 或許有效

UNIX工作站 .tshrc怎麼開啟...

Candice avatar
By Candice
at 2011-05-24T13:36
想修改tcshrc裡面的內容,但不知道怎樣開啟更改。 在$home/.tshrc 下指令後會跑出一串東西 但要怎樣修改tshrc裡的內容呢。 - ...

筆電合上螢幕待機

Freda avatar
By Freda
at 2011-05-24T12:23
※ 引述《sppmg (sppmg)》之銘言: : 請問筆電合上螢幕時的動作要如何設定呢? : 包括進入待機或是只關螢幕不待機。 : 之前記得很常見這個討論, : 原先不怎在意,(我的筆電原本就可以在合上螢幕時進入待機) : 後來自己真的遇到時,反而找不到相關文章.... 試試看這個: gconftool- ...

取得固定時間內檔案被存取的次數

Noah avatar
By Noah
at 2011-05-24T11:11
我想要去監看某台伺服器下的/data的資料夾 每五分鐘內 在這個資料夾裡面的每個檔案被存取的次數 不知道該怎麼得到這個值呢? 謝謝解惑:) - ...

筆電合上螢幕待機

Andy avatar
By Andy
at 2011-05-23T23:08
請問筆電合上螢幕時的動作要如何設定呢? 包括進入待機或是只關螢幕不待機。 之前記得很常見這個討論, 原先不怎在意,(我的筆電原本就可以在合上螢幕時進入待機) 後來自己真的遇到時,反而找不到相關文章.... - ...

chomd

Gary avatar
By Gary
at 2011-05-23T20:38
各位大大 今天小弟做了一件腦殘的事情 chmod 000 -R / 於是...Server就不能用了 連登入都無法 我後來用安全模式進入想要改回來 輸入chmod 777 -R / 出現 chmod: /root:Read-only file system 想懇請各位幫忙 有沒有不用重灌可以救 ...