最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在Linux中刪除超大(100-200GB)文件的實(shí)現(xiàn)方式

 更新時間:2024年04月11日 09:57:50   作者:CN-FuWei  
這篇文章主要介紹了在Linux中刪除超大(100-200GB)文件的實(shí)現(xiàn)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教

一、IO調(diào)度策略

1.1、idle

空閑磁盤調(diào)度;

該調(diào)度策略是在當(dāng)前系統(tǒng)沒有其他進(jìn)程需要進(jìn)行磁盤IO時,才能進(jìn)行磁盤;

因此該策略對當(dāng)前系統(tǒng)的影響基本為0;

當(dāng)然,該調(diào)度策略不能帶有任何優(yōu)先級參數(shù);

1.2、Best effort

是缺省的磁盤IO調(diào)度策略;   

(1)該調(diào)度策略可以指定優(yōu)先級參數(shù)(范圍是0~7,數(shù)值越小,優(yōu)先級越高);   

(2)針對處于同一優(yōu)先級的程序?qū)⒉蓃ound-robin方式;   

(3)對于best effort調(diào)度策略,8個優(yōu)先級等級可以說明在給定的一個調(diào)度窗口中時間片的大??;   

(4)目前,普調(diào)用戶(非root用戶)是可以使用該調(diào)度策略;   

(5)在內(nèi)核2.6.26之前,沒有設(shè)置IO優(yōu)先級的進(jìn)程會使用“none”作為調(diào)度策略,但是這種策略使得進(jìn)程看起來像是采用了best effort調(diào)度策略,因為其優(yōu)先級是通過關(guān)于   cpu nice有關(guān)的公式計算得到的:io_priority = (cpu_nice + 20) /5   

(6)在內(nèi)核2.6.26之后,如果當(dāng)前系統(tǒng)使用的是CFQ調(diào)度器,那么如果進(jìn)程沒有設(shè)置IO優(yōu)先級級別,將采用與內(nèi)核2.6.26之前版本同樣的方式,推到出io優(yōu)先級級別;

1.3、Real time

實(shí)時調(diào)度策略,如果設(shè)置了該磁盤IO調(diào)度策略,則立即訪問磁盤,不管系統(tǒng)中其他進(jìn)程是否有IO。

因此使用實(shí)時調(diào)度策略,需要注意的是,該訪問策略可能會使得其他進(jìn)程處于等待狀態(tài);

二、ionice命令-設(shè)置排程優(yōu)先級

2.1、安裝

[root@docker][19:43:12][OK] ~ 
#yum provides */ionice
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirror.01link.hk
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
epel/x86_64/filelists_db                                                                                                     |  12 MB  00:00:08     
extras/7/x86_64/filelists_db                                                                                                 | 276 kB  00:00:01     
updates/7/x86_64/filelists_db                                                                                                |  10 MB  00:00:42     
util-linux-2.23.2-65.el7.i686 : A collection of basic system utilities
Repo        : base
Matched from:
Filename    : /usr/bin/ionice
Filename    : /usr/share/bash-completion/completions/ionice
 
 
 
util-linux-2.23.2-65.el7.x86_64 : A collection of basic system utilities
Repo        : base
Matched from:
Filename    : /usr/bin/ionice
Filename    : /usr/share/bash-completion/completions/ionice
 
 
 
util-linux-2.23.2-65.el7_9.1.i686 : A collection of basic system utilities
Repo        : updates
Matched from:
Filename    : /usr/bin/ionice
Filename    : /usr/share/bash-completion/completions/ionice
 
 
 
util-linux-2.23.2-65.el7_9.1.x86_64 : A collection of basic system utilities
Repo        : updates
Matched from:
Filename    : /usr/bin/ionice
Filename    : /usr/share/bash-completion/completions/ionice
 
 
 
util-linux-2.23.2-65.el7.x86_64 : A collection of basic system utilities
Repo        : @anaconda
Matched from:
Filename    : /usr/bin/ionice
Filename    : /usr/share/bash-completion/completions/ionice

安裝

yum install util-linux-2.23.2-65.el7_9.1.x86_64 -y

2.2、用法

[root@docker][19:35:01][OK] ~ 
#ionice --help
 
ionice - sets or gets process io scheduling class and priority.
 
Usage:
  ionice [OPTION] -p PID [PID...]
  ionice [OPTION] COMMAND
 
Options:
  -c, --class <class>   scheduling class name or number
                           0: none, 1: realtime, 2: best-effort, 3: idle
  -n, --classdata <num> scheduling class data
                           0-7 for realtime and best-effort classes
  -p, --pid=PID         view or modify already running process
  -t, --ignore          ignore failures
  -V, --version         output version information and exit
  -h, --help            display this help and exit

2.3、示例

—- Deleting Huge Files in Linux —–
# ionice -c 3 rm /var/logs/syslog
# ionice -c 3 rm -rf /var/log/apache

注意:要使用安全的方法刪除大檔案,我們可以使 shred、wipe 以及 secure-deletion 工具包中的不同工具,而不是 rm 命令。

三、Shred -覆蓋文件以隱藏內(nèi)容

3.1、安裝軟件包

yum install coreutils-8.22-24.el7_9.2.x86_64 -y

3.2、命令及參數(shù)選項

[root@192_168_209_128 ~]# shred --help
Usage: shred [OPTION]... FILE...
Overwrite the specified FILE(s) repeatedly, in order to make it harder
for even very expensive hardware probing to recover the data.
Mandatory arguments to long options are mandatory for short options too.
  -f, --force    change permissions to allow writing if necessary
  -n, --iterations=N  overwrite N times instead of the default (3)
      --random-source=FILE  get random bytes from FILE
  -s, --size=N   shred this many bytes (suffixes like K, M, G accepted)
  -u, --remove[=HOW]  truncate and remove file after overwriting; See below
  -v, --verbose  show progress
  -x, --exact    do not round file sizes up to the next full block;
                   this is the default for non-regular files
  -z, --zero     add a final overwrite with zeros to hide shredding
      --help     display this help and exit
      --version  output version information and exit

選項說明:

  • -z- 添加一個帶有零的最終覆蓋以隱藏切碎。
  • -v– 可以顯示操作進(jìn)度。
  • -u- 覆蓋后截斷和刪除文件。
  • -n– 指定覆蓋文件內(nèi)容的次數(shù)(默認(rèn)為 3)。

3.3、示例

shred覆蓋文件以隱藏其內(nèi)容,也可以選擇刪除它。

[root@docker][19:51:03][OK] ~ 
#shred -zvu -n 5 cuttingLog_bak 
shred: cuttingLog_bak: pass 1/6 (random)...
shred: cuttingLog_bak: pass 2/6 (ffffff)...
shred: cuttingLog_bak: pass 3/6 (random)...
shred: cuttingLog_bak: pass 4/6 (000000)...
shred: cuttingLog_bak: pass 5/6 (random)...
shred: cuttingLog_bak: pass 6/6 (000000)...
shred: cuttingLog_bak: removing
shred: cuttingLog_bak: renamed to 00000000000000
shred: 00000000000000: renamed to 0000000000000
shred: 0000000000000: renamed to 000000000000
shred: 000000000000: renamed to 00000000000
shred: 00000000000: renamed to 0000000000
shred: 0000000000: renamed to 000000000
shred: 000000000: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: cuttingLog_bak: removed

四、Wipe —在 Linux 中安全擦除文件

介紹:Linux wipe命令可以安全地從磁存儲器中擦除文件,從而無法恢復(fù)。

4.1、安裝軟件包

rpm -ivh wipe-2.2.0-1.2.el7.rf.x86_64.rpm

4.2、命令及參數(shù)選項

[root@docker][19:58:11][OK] ~ 
#wipe -h
Wipe v2.2.0 - released January 10, 2004
by Tom Vier <nester@users.sf.net>
 
Usage is wipe [options] [file-list]
 
Options:         Default: wipe -ZdntVAkO -S512 -C4096 -l1 -x8 -p1
 
-h          --   help - display this screen
-u          --   usage
-c          --   show copyright and license
-w          --   show warranty information
-i  and  -I --   enable (-i) or disable (-I) interaction - overrides force
-f          --   force file wiping and override interaction
-r  and  -R --   recursion - traverse subdirectories
-s          --   silent - disable percentage and error reporting
-v          --   force verbose - always show percentage
-V          --   verbose - show percentage if file is >= 25K
-d  and  -D --   delete (-d) or keep (-D) after wiping
-n  and  -N --   delete (-n) or skip (-N) special files
-k  and  -K --   lock (-k) or don't lock (-K) files
-z          --   zero-out file - single pass of zeroes
-Z          --   perform normal wipe passes
-t  and  -T --   enable (-t) or disable (-T) static passes
-a  and  -A --   write until out of space (-a) or don't (-A)
-o[size] -O --   write to stdout (-o) or use files (-O)
-B(count)   --   block device sector count
-S(size)    --   block device sector size - default 512 bytes
                 or stdout write length when used with -A
-C(size)    --   chunk size - maximum file buffer size in kilobytes (2^10)
-l[0-2]     --   sets wipe secure level
-x[1-32] -X --   sets number of random passes per wipe or disables
-p(1-32)    --   wipe file x number of times
-b(0-255)   --   overwrite file with this value byte

4.3、示例

[root@docker][19:59:50][OK] ~ 
#wipe -fi cuttingLog_bak 
wipe: destroy file `cuttingLog_bak'? y

五、Linux 安全刪除工具包

Secure-delete是一個安全文件刪除工具的集合,其中包含srm (secure_deletion) 工具,用于安全刪除文件。

5.1、安裝軟件包

yum -y install srm-1.2.15-1.el7.x86_64

5.2、命令及參數(shù)選項

[root@docker][20:05:39][OK] ~ 
#srm --help
Usage: srm [OPTION]... [FILE]...
Overwrite and remove (unlink) the files. By default use the 35-pass Gutmann
method to overwrite files.
 
  -d, --directory       ignored (for compatability with rm(1))
  -f, --force           ignore nonexistant files, never prompt
  -i, --interactive     prompt before any removal
  -x, --one-file-system do not cross file system boundaries
  -s, --simple          overwrite with single pass using 0x00 (default)
  -P, --openbsd         overwrite with three passes like OpenBSD rm
  -D, --dod             overwrite with 7 US DoD compliant passes
  -E, --doe             overwrite with 3 US DoE compliant passes
  -G, --gutmann         overwrite with 35-pass Gutmann method
  -C, --rcmp            overwrite with Royal Canadian Mounted Police passes
  -r, -R, --recursive   remove the contents of directories
  -v, --verbose         explain what is being done
  -h, --help            display this help and exit
  -V, --version         display version information and exit

5.3、示例

#srm -vf cuttingLog_bal 
srm: removing cuttingLog_bal

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • ubuntu vi編輯器修改文件的基本操作指令詳解

    ubuntu vi編輯器修改文件的基本操作指令詳解

    Vi編輯器是命令行文本編輯器,具有豐富的功能,但也可能對初學(xué)者有一定的學(xué)習(xí)曲線,以下是一些基本操作指令:打開文件、保存文件、退出Vi編輯器、保存并退出、插入文本、刪除文本、復(fù)制和粘貼文本、移動光標(biāo)、搜索文本、替換文本,Vi還有更多功能和快捷鍵,需要一些時間來熟悉
    2026-01-01
  • .htaccess綁定域名到子目錄的方法

    .htaccess綁定域名到子目錄的方法

    首先用控制面版的域名綁定功能綁定了域名, 然后用.htaccess
    2008-07-07
  • Centos6安裝中文字體的方法

    Centos6安裝中文字體的方法

    這篇文章主要介紹了Centos6安裝中文字體的方法,本文給大家介紹的非常詳細(xì)具有參考借鑒價值,需要的朋友可以參考下
    2016-10-10
  • 在Linux系統(tǒng)中設(shè)置系統(tǒng)時間的操作方法

    在Linux系統(tǒng)中設(shè)置系統(tǒng)時間的操作方法

    本文介紹了在CentOS系統(tǒng)中設(shè)置和同步系統(tǒng)時間的方法,首先,通過查看系統(tǒng)時間和時區(qū),發(fā)現(xiàn)與當(dāng)?shù)貢r間不一致,然后,通過設(shè)置正確的時區(qū),將系統(tǒng)時間調(diào)整為北京時間,最后,通過開啟NTP服務(wù),確保系統(tǒng)時間與網(wǎng)絡(luò)時間同步,避免誤差,需要的朋友可以參考下
    2026-02-02
  • 使用 Linux seq 命令生成數(shù)字序列(推薦)

    使用 Linux seq 命令生成數(shù)字序列(推薦)

    seq命令用于以指定增量從首數(shù)開始打印數(shù)字到尾數(shù),即產(chǎn)生從某個數(shù)到另外一個數(shù)之間的所有整數(shù),并且可以對整數(shù)的格式、寬度、分割符號進(jìn)行控制。這篇文章主要介紹了使用 Linux seq 命令生成數(shù)字序列,需要的朋友可以參考下
    2020-01-01
  • Apache 安全配置方法

    Apache 安全配置方法

    在本文中,筆者將為你提供10個技巧,借此你可以保護(hù)自己的Apache Web服務(wù)器免于受到許多攻擊。不過,必須謹(jǐn)記,你需要仔細(xì)地評估每一個技巧,以確保其適合于你的組織。
    2010-12-12
  • Linux線程同步/互斥過程詳解

    Linux線程同步/互斥過程詳解

    文章講解多線程并發(fā)訪問導(dǎo)致競態(tài)條件,需通過互斥鎖、原子操作和條件變量實(shí)現(xiàn)線程安全與同步,分析死鎖條件及避免方法,并介紹RAII封裝技術(shù)提升資源管理效率
    2025-08-08
  • Linux系統(tǒng)下使用U盤的方法

    Linux系統(tǒng)下使用U盤的方法

    在linux系統(tǒng)之中, 一切設(shè)備皆文件, 所以我們的U盤也是一個文件.磁盤設(shè)備被抽象成sda文件, U盤設(shè)備被抽象成sdb文件。這篇文章主要介紹了Linux系統(tǒng)下使用U盤的方法,需要的朋友可以參考下
    2016-10-10
  • Linux中的awk數(shù)組的基本使用方法

    Linux中的awk數(shù)組的基本使用方法

    這篇文章主要介紹了Linux中的awk數(shù)組的基本使用方法,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下
    2018-08-08
  • Linux-Redhat系統(tǒng)啟動讀取文件方式

    Linux-Redhat系統(tǒng)啟動讀取文件方式

    文章詳細(xì)描述了RHEL系統(tǒng)從啟動到登錄的整個過程,包括讀取關(guān)鍵配置文件、加載內(nèi)核、掛載文件系統(tǒng)、啟動初始化系統(tǒng)以及進(jìn)入用戶界面的步驟
    2026-02-02

最新評論

加查县| 连江县| 通州区| 平潭县| 巢湖市| 康保县| 甘洛县| 鞍山市| 海口市| 交城县| 桑植县| 芦溪县| 武功县| 盱眙县| 邵阳市| 深州市| 德化县| 赤水市| 和林格尔县| 富川| 宁化县| 宣威市| 庆城县| 仪征市| 陆河县| 香格里拉县| 安达市| 含山县| 东海县| 阜南县| 厦门市| 沛县| 泗洪县| 通化市| 太和县| 仪征市| 正蓝旗| 视频| 莎车县| 石屏县| 天峨县|