Linux ϵÄddÃüÁîʹÓÃÏê½â
Ò»¡¢ddÃüÁîµÄ½âÊÍ
dd£ºÓÃÖ¸¶¨´óСµÄ¿é¿½±´Ò»¸öÎļþ£¬²¢ÔÚ¿½±´µÄͬʱ½øÐÐÖ¸¶¨µÄת»»¡£
×¢Ò⣺ָ¶¨Êý×ֵĵط½ÈôÒÔÏÂÁÐ×Ö·û½á⣬Ôò³ËÒÔÏàÓ¦µÄÊý×Ö£ºb=512£»c=1£»k=1024£»w=2
²ÎÊý×¢ÊÍ£º
1. if=ÎļþÃû£ºÊäÈëÎļþÃû£¬È±Ê¡Îª±ê×¼ÊäÈë¡£¼´Ö¸¶¨Ô´Îļþ¡£< if=input file >
2. of=ÎļþÃû£ºÊä³öÎļþÃû£¬È±Ê¡Îª±ê×¼Êä³ö¡£¼´Ö¸¶¨Ä¿µÄÎļþ¡£< of=output file >
3. ibs=bytes£ºÒ»´Î¶ÁÈëbytes¸ö×Ö½Ú£¬¼´Ö¸¶¨Ò»¸ö¿é´óСΪbytes¸ö×Ö½Ú¡£
obs=bytes£ºÒ»´ÎÊä³öbytes¸ö×Ö½Ú£¬¼´Ö¸¶¨Ò»¸ö¿é´óСΪbytes¸ö×Ö½Ú¡£
bs=bytes£ºÍ¬Ê±ÉèÖöÁÈë/Êä³öµÄ¿é´óСΪbytes¸ö×Ö½Ú¡£
4. cbs=bytes£ºÒ»´Îת»»bytes¸ö×Ö½Ú£¬¼´Ö¸¶¨×ª»»»º³åÇø´óС¡£
5. skip=blocks£º´ÓÊäÈëÎļþ¿ªÍ·Ìø¹ýblocks¸ö¿éºóÔÙ¿ªÊ¼¸´ÖÆ¡£
6. seek=blocks£º´ÓÊä³öÎļþ¿ªÍ·Ìø¹ýblocks¸ö¿éºóÔÙ¿ªÊ¼¸´ÖÆ¡£
×¢Ò⣺ͨ³£Ö»Óõ±Êä³öÎļþÊÇ´ÅÅÌ»ò´Å´øʱ²ÅÓÐЧ£¬¼´±¸·Ýµ½´ÅÅÌ»ò´Å´øʱ²ÅÓÐЧ¡£
7. count=blocks£º½ö¿½±´blocks¸ö¿é£¬¿é´óСµÈÓÚibsÖ¸¶¨µÄ×Ö½ÚÊý¡£
8. conv=conversion£ºÓÃÖ¸¶¨µÄ²ÎÊýת»»Îļþ¡£
ascii£º×ª»»ebcdicΪascii
ebcdic£º×ª»»asciiΪebcdic
ibm£º×ª»»asciiΪalternate ebcdic
block£º°ÑÿһÐÐת»»Îª³¤¶ÈΪcbs£¬²»×㲿·ÖÓÿոñÌî³ä
unblock£ºÊ¹Ã¿Ò»Ðеij¤¶È¶¼Îªcbs£¬²»×㲿·ÖÓÿոñÌî³ä
lcase£º°Ñ´óд×Ö·ûת»»ÎªÐ¡Ð´×Ö·û
ucase£º°ÑСд×Ö·ûת»»Îª´óд×Ö·û
swab£º½»»»ÊäÈëµÄÿ¶Ô×Ö½Ú
noerror£º³ö´íʱ²»Í£Ö¹
notrunc£º²»½Ø¶ÌÊä³öÎļþ
sync£º½«Ã¿¸öÊäÈë¿éÌî³äµ½ibs¸ö×Ö½Ú£¬²»×㲿·ÖÓÿգ¨NUL£©×Ö·û²¹Æë¡£
¶þ¡¢ddÓ¦ÓÃʵÀý
1.½«±¾µØµÄ/dev/hdbÕûÅ̱¸·Ýµ½/dev/hdd
#dd if=/dev/hdb of=/dev/hdd
2.½«/dev/hdbÈ«ÅÌÊý¾Ý±¸·Ýµ½Ö¸¶¨Â·¾¶µÄimageÎļþ
#dd if=/dev/hdb of=/root/image
3.½«±¸·ÝÎļþ»Ö¸´µ½Ö¸¶¨ÅÌ
#dd if=/root/image of=/dev/hdb
4.±¸·Ý/dev/hdbÈ«ÅÌÊý¾Ý£¬²¢ÀûÓÃgzip¹¤¾ß½øÐÐѹËõ£¬±£´æµ½Ö¸¶¨Â·¾¶
#dd if=/dev/hdb | gzip > /root/image.gz
5.½«Ñ¹ËõµÄ±¸·ÝÎļþ»Ö¸´µ½Ö¸¶¨ÅÌ
#gzip -dc /root/image.gz | dd of=/dev/hdb
6.±¸·ÝÓë»Ö¸´MBR
±¸·Ý´ÅÅÌ¿ªÊ¼µÄ512¸ö×Ö½Ú´óСµÄMBRÐÅÏ¢µ½Ö¸¶¨Îļþ£º
#dd if=/dev/hda of=/root/image count=1 bs=512
count=1Ö¸½ö¿½±´Ò»¸ö¿é£»bs=512Ö¸¿é´óСΪ512¸ö×Ö½Ú¡£
»Ö¸´£º
#dd if=/root/image of=/dev/had
½«±¸·ÝµÄMBRÐÅϢдµ½´ÅÅÌ¿ªÊ¼²¿·Ö
7.±¸·ÝÈíÅÌ
#dd if=/dev/fd0 of=disk.img count=1 bs=1440k (¼´¿é´óСΪ1.44M)
8.¿½±´ÄÚ´æÄÚÈݵ½Ó²ÅÌ
#dd if=/dev/mem of=/root/mem.bin bs=1024 (Ö¸¶¨¿é´óСΪ1k)
9.¿½±´¹âÅÌÄÚÈݵ½Ö¸¶¨Îļþ¼Ð£¬²¢±£´æΪcd.isoÎļþ
#dd if=/dev/cdrom(hdc) of=/root/cd.iso
10.Ôö¼Óswap·ÖÇøÎļþ´óС
µÚÒ»²½£º´´½¨Ò»¸ö´óСΪ256MµÄÎļþ£º
#dd if=/dev/zero of=/swapfile bs=1024 count=262144
µÚ¶þ²½£º°ÑÕâ¸öÎļþ±ä³ÉswapÎļþ£º
#mkswap /swapfile
µÚÈý²½£ºÆôÓÃÕâ¸öswapÎļþ£º
#swapon /swapfile
µÚËIJ½£º±à¼/etc/fstabÎļþ£¬Ê¹ÔÚÿ´Î¿ª»úʱ×Ô¶¯¼ÓÔØswapÎļþ£º
/swapfile swap swap default 0 0
11.Ïú»Ù´ÅÅÌÊý¾Ý
#dd if=/dev/urandom of=/dev/hda1
×¢Ò⣺ÀûÓÃËæ»úµÄÊý¾ÝÌî³äÓ²ÅÌ£¬ÔÚijЩ±ØÒªµÄ³¡ºÏ¿ÉÒÔÓÃÀ´Ïú»ÙÊý¾Ý¡£
12.²âÊÔÓ²Å̵ĶÁдËÙ¶È
#dd if=/dev/zero bs=1024 count=1000000 of=/root/1Gb.file
#dd if=/root/1Gb.file bs=64k | dd of=/dev/null
ͨ¹ýÒÔÉÏÁ½¸öÃüÁîÊä³öµÄÃüÁîÖ´ÐÐʱ¼ä£¬¿ÉÒÔ¼ÆËã³öÓ²Å̵ĶÁ¡¢Ð´Ëٶȡ£
13.È·¶¨Ó²Å̵Ä×î¼Ñ¿é´óС£º
#dd if=/dev/zero bs=1024 count=1000000 of=/root/1Gb.file
#dd if=/dev/zero bs=2048 count=500000 of=/root/1Gb.file
#dd if=/dev/zero bs=4096 count=250000 of=/root/1Gb.file
#dd if=/dev/zero bs=8192 count=125000 of=/root/1Gb.file
ͨ¹ý±È½ÏÒÔÉÏÃüÁîÊä³öÖÐËùÏÔʾµÄÃüÁîÖ´ÐÐʱ¼ä£¬¼´¿ÉÈ·¶¨ÏµÍ³×î¼ÑµÄ¿é´óС¡£
14.ÐÞ¸´Ó²ÅÌ£º
#dd if=/dev/sda of=/dev/sda »òdd if=/dev/hda of=/dev/hda
µ±Ó²Å̽ϳ¤Ê±¼ä(Ò»ÄêÒÔÉÏ)·ÅÖò»Ê¹Óú󣬴ÅÅÌÉÏ»á²úÉúmagnetic flux point£¬µ±´ÅÍ·¶Áµ½ÕâЩÇøÓòʱ»áÓöµ½À§ÄÑ£¬²¢¿ÉÄܵ¼ÖÂI/O´íÎó¡£µ±ÕâÖÖÇé¿öÓ°Ïìµ½Ó²Å̵ĵÚÒ»¸öÉÈÇøʱ£¬¿ÉÄܵ¼ÖÂÓ²Å̱¨·Ï¡£ÉϱߵÄÃüÁîÓпÉÄÜʹÕâЩÊý ¾ÝÆðËÀ»ØÉú¡£²¢ÇÒÕâ¸ö¹ý³ÌÊÇ°²È«¡¢¸ßЧµÄ¡£
15.ÀûÓÃnetcatÔ¶³Ì±¸·Ý
#dd if=/dev/hda bs=16065b | netcat < targethost-IP > 1234
ÔÚÔ´Ö÷»úÉÏÖ´ÐдËÃüÁ·Ý/dev/hda
#netcat -l -p 1234 | dd of=/dev/hdc bs=16065b
ÔÚÄ¿µÄÖ÷»úÉÏÖ´ÐдËÃüÁîÀ´½ÓÊÕÊý¾Ý²¢Ð´Èë/dev/hdc
#netcat -l -p 1234 | bzip2 > partition.img
#netcat -l -p 1234 | gzip > partition.img
ÒÔÉÏÁ½ÌõÖ¸ÁîÊÇÄ¿µÄÖ÷»úÖ¸ÁîµÄ±ä»¯·Ö±ð²ÉÓÃbzip2¡¢gzip¶ÔÊý¾Ý½øÐÐѹËõ£¬²¢½«±¸·ÝÎļþ±£´æÔÚµ±Ç°Ä¿Â¼¡£
16.½«Ò»¸ö´óÊÓƵÎļþµÄµÚi¸ö×Ö½ÚµÄÖµ¸Ä³É0x41£¨´óд×ÖĸAµÄASCIIÖµ£©
#echo A | dd of=bigfile seek=$i bs=1 count=1 conv=notrunc
17.½¨Á¢linuxÐéÄâÅÌ£¬ÓÃÎļþÄ£Äâ´ÅÅÌ
ÔÚ½øÐÐlinuxµÄʵÑéÖУ¬Èç¹ûûÓжàÓàµÄÓ²ÅÌÀ´×ö²âÊÔ¡£Ôò¿ÉÒÔÔÚlinuxÏÂʹÓÃÎļþÀ´Ä£Äâ´ÅÅÌ£¬ÒÔ¹©²âÊÔÄ¿µÄ¡£
ÆäÄ£Äâ¹ý³ÌÈçÏÂËùʾ£¬ÕªÂ¼×Ô¡¶OracleÊý¾Ý¿âºËÐļ¼ÊõÓëʵÎñÏê½â£½ÌÄãÈçºÎ³ÉΪOracle 10g OCP¡·Ò»Êé¡£
1)ÒÔrootÓû§´´½¨Ò»¸öASM´ÅÅÌËùÔÚµÄĿ¼¡£
# mkdir ¨Cp /u01/asmdisks
2)ͨ¹ýddÃüÁî´´½¨6¸ö400M´óСµÄÎļþ£¬Ã¿¸öÎļþ´ú±íÒ»¿é´ÅÅÌ¡£
[root@book u01]# cd asmdisks
[root@book asmdisks]# dd if=/dev/zero of=asm_disk1 bs=1024k count=400
[root@book asmdisks]# dd if=/dev/zero of=asm_disk2 bs=1024k count=400
[root@book asmdisks]# dd if=/dev/zero of=asm_disk3 bs=1024k count=400
[root@book asmdisks]# dd if=/dev/zero of=asm_disk4 bs=1024k count=400
[root@book asmdisks]# dd if=/dev/zero of=asm_disk5 bs=1024k count=400
[root@book asmdisks]# dd if=/dev/zero of=asm_disk6 bs=1024k count=400
3)½«ÕâЩÎļþÓëÂãÉ豸¹ØÁª¡£
[root@book asmdisks]# chmod 777 asm_disk*
[root@book asmdisks]# losetup /dev/loop1 asm_disk1
[root@book asmdisks]# losetup /dev/loop2 asm_disk2
[root@book asmdisks]# losetup /dev/loop3 asm_disk3
[root@book asmdisks]# losetup /dev/loop4 asm_disk4
[root@book asmdisks]# losetup /dev/loop5 asm_disk5
[root@book asmdisks]# losetup /dev/loop6 asm_disk6
×¢Ò⣺Èç¹ûҪɾ³ýͨ¹ýddÄ£Äâ³öµÄÐéÄâ´ÅÅÌÎļþµÄ»°£¬Ö±½Óɾ³ýÄ£Äâ³öµÄ´ÅÅÌÎļþ
£¨Ò²¾ÍÊÇasm_disk1¡¢asm_disk2¡asm_disk6£©»¹²»¹»£¬»¹±ØÐëÖ´ÐÐlosetup -d /dev/loopN£¬ÔÚÕâÀïN´Ó1µ½6¡£·ñÔò£¬´ÅÅÌÎļþËùÕ¼ÓõĴÅÅ̿ռ䲻ÄÜÊÍ·Å
Èý¡¢/dev/nullºÍ/dev/zeroµÄÇø±ð
/dev/null£¬ÍâºÅ½ÐÎ޵׶´£¬Äã¿ÉÒÔÏòËüÊä³öÈκÎÊý¾Ý£¬Ëüͨ³Ô£¬²¢ÇÒ²»»á³Å×Å£¡
/dev/zero£¬ÊÇÒ»¸öÊäÈëÉ豸£¬Äã¿ÉÄãÓÃËüÀ´³õʼ»¯Îļþ¡£¸ÃÉ豸ÎÞÇµØÌṩ0£¬¿ÉÒÔʹÓÃÈκÎÄãÐèÒªµÄÊýÄ¿¡ª¡ªÉ豸ÌṩµÄÒª¶àµÄ¶à¡£Ëû¿ÉÒÔÓÃÓÚÏòÉ豸»òÎļþдÈë×Ö·û´®0¡£
/dev/null------ËüÊÇ¿ÕÉ豸£¬Ò²³ÆΪλͰ£¨bit bucket£©¡£ÈκÎдÈëËüµÄÊä³ö¶¼»á±»Å×Æú¡£Èç¹û²»ÏëÈÃÏûÏ¢ÒÔ±ê×¼Êä³öÏÔʾ»òдÈëÎļþ£¬ÄÇô¿ÉÒÔ½«ÏûÏ¢Öض¨Ïòµ½Î»Í°¡£
#if=/dev/zero of=./test.txt bs=1k count=1
#ls ¨Cl
total 4
-rw-r--r-- 1 oracle dba 1024 Jul 15 16:56 test.txt
#find / -name access_log 2>/dev/null
3.1ʹÓÃ/dev/null
°Ñ/dev/null¿´×÷"ºÚ¶´"£¬ ËüµÈ¼ÛÓÚÒ»¸öֻдÎļþ£¬ËùÓÐдÈëËüµÄÄÚÈݶ¼»áÓÀÔ¶¶ªÊ§.£¬¶ø³¢ÊÔ´ÓËüÄǶù¶ÁÈ¡ÄÚÈÝÔòʲôҲ¶Á²»µ½¡£È»¶ø£¬ /dev/null¶ÔÃüÁîÐкͽű¾¶¼·Ç³£µÄÓÐÓÃ
½ûÖ¹±ê×¼Êä³ö
#cat $filename >/dev/null
ÎļþÄÚÈݶªÊ§£¬¶ø²»»áÊä³öµ½±ê×¼Êä³ö.
½ûÖ¹±ê×¼´íÎó
#rm $badname 2>/dev/null
ÕâÑù´íÎóÐÅÏ¢[±ê×¼´íÎó]¾Í±»¶ªµ½Ì«Æ½ÑóÈ¥ÁË
½ûÖ¹±ê×¼Êä³öºÍ±ê×¼´íÎóµÄÊä³ö
#cat $filename 2>/dev/null >/dev/null
Èç¹û"$filename"²»´æÔÚ£¬½«²»»áÓÐÈκδíÎóÐÅÏ¢Ìáʾ£»Èç¹û"$filename"´æÔÚ£¬ ÎļþµÄÄÚÈݲ»»á´òÓ¡µ½±ê×¼Êä³ö¡£
Òò´Ë£¬ÉÏÃæµÄ´úÂë¸ù±¾²»»áÊä³öÈκÎÐÅÏ¢¡£µ±Ö»Ïë²âÊÔÃüÁîµÄÍ˳öÂë¶ø²»ÏëÓÐÈκÎÊä³öʱ·Ç³£ÓÐÓá£
#cat $filename &>/dev/null
ÕâÑùÆäʵҲ¿ÉÒÔ£¬ÓÉ Baris Cicek Ö¸³ö
×Ô¶¯Çå¿ÕÈÕÖ¾ÎļþµÄÄÚÈÝ
Deleting contents of a file, but preserving the file itself, with all attendant permissions (from Example 2-1 and Example 2-3):
#cat /dev/null > /var/log/messages
# : > /var/log/messages ÓÐͬÑùµÄЧ¹û£¬ µ«²»»á²úÉúеĽø³Ì.£¨ÒòΪ:ÊÇÄÚ½¨µÄ£©
#cat /dev/null > /var/log/wtmp
ÌرðÊʺϴ¦ÀíÕâЩÓÉÉÌÒµWebÕ¾µã·¢Ë͵ÄÌÖÑáµÄ"cookies"
Òþ²Øcookie¶ø²»ÔÙʹÓÃ
#if [ -f ~/.netscape/cookies ] # Èç¹û´æÔÚÔòɾ³ý.
#then
#rm -f ~/.netscape/cookies
#fi
#ln -s /dev/null ~/.netscape/cookies
ÏÖÔÚËùÓеÄcookies¶¼»á¶ªÈëºÚ¶´¶ø²»»á±£´æÔÚ´ÅÅÌÉÏÁË.
3.2ʹÓÃ/dev/zero
Ïñ/dev/nullÒ»Ñù£¬ /dev/zeroÒ²ÊÇÒ»¸öαÎļþ£¬ µ«Ëüʵ¼ÊÉϲúÉúÁ¬Ðø²»¶ÏµÄnullµÄÁ÷£¨¶þ½øÖƵÄÁãÁ÷£¬¶ø²»ÊÇASCIIÐ͵ģ©¡£ дÈëËüµÄÊä³ö»á¶ªÊ§²»¼û£¬ ¶ø´Ó/dev/zero¶Á³öÒ»Á¬´®µÄnullÒ²±È½ÏÀ§ÄÑ£¬ ËäÈ»ÕâÒ²ÄÜͨ¹ýod»òÒ»¸öÊ®Áù½øÖƱà¼Æ÷À´×öµ½¡£ /dev/zeroÖ÷ÒªµÄÓô¦ÊÇÓÃÀ´´´½¨Ò»¸öÖ¸¶¨³¤¶ÈÓÃÓÚ³õʼ»¯µÄ¿ÕÎļþ£¬¾ÍÏñÁÙʱ½»»»Îļþ
ÓÃ/dev/zero´´½¨Ò»¸ö½»»»ÁÙʱÎļþ
#!/bin/bash
# ´´½¨Ò»¸ö½»»»Îļþ.
ROOT_UID=0 # Root Óû§µÄ $UID ÊÇ 0.
E_WRONG_USER=65 # ²»ÊÇ root?
FILE=/swap
BLOCKSIZE=1024
MINBLOCKS=40
SUCCESS=0
# Õâ¸ö½Å±¾±ØÐëÓÃrootÀ´ÔËÐÐ.
if [ "$UID" -ne "$ROOT_UID" ]
then
echo; echo "You must be root to run this script."; echo
exit $E_WRONG_USER
fi
blocks=${1:-$MINBLOCKS} # Èç¹ûÃüÁîÐÐûÓÐÖ¸¶¨£¬
#+ ÔòÉèÖÃΪĬÈϵÄ40¿é.
# ÉÏÃæÕâ¾äµÈͬÈ磺
# --------------------------------------------------
# if [ -n "$1" ]
# then
# blocks=$1
# else
# blocks=$MINBLOCKS
# fi
# --------------------------------------------------
if [ "$blocks" -lt $MINBLOCKS ]
then
blocks=$MINBLOCKS # ×îÉÙÒªÓÐ 40 ¸ö¿é³¤.
fi
echo "Creating swap file of size $blocks blocks (KB)."
dd if=/dev/zero of=$FILE bs=$BLOCKSIZE count=$blocks # °ÑÁãдÈëÎļþ.
mkswap $FILE $blocks # ½«´ËÎļþ½¨Îª½»»»Îļþ£¨»ò³Æ½»»»·ÖÇø£©.
swapon $FILE # ¼¤»î½»»»Îļþ.
echo "Swap file created and activated."
exit $SUCCESS
¹ØÓÚ /dev/zero µÄÁíÒ»¸öÓ¦ÓÃÊÇΪÌض¨µÄÄ¿µÄ¶øÓÃÁãÈ¥Ìî³äÒ»¸öÖ¸¶¨´óСµÄÎļþ£¬ Èç¹ÒÔØÒ»¸öÎļþϵͳµ½»·»ØÉ豸 £¨loopback device£©»ò"°²È«µØ" ɾ³ýÒ»¸öÎļþ
Àý×Ó´´½¨ramdisk
#!/bin/bash
# ramdisk.sh
# "ramdisk"ÊÇϵͳRAMÄÚ´æµÄÒ»¶Î£¬
#+ Ëü¿ÉÒÔ±»µ±³ÉÊÇÒ»¸öÎļþϵͳÀ´²Ù×÷.
# ËüµÄÓŵãÊÇ´æÈ¡Ëٶȷdz£¿ì (°üÀ¨¶ÁºÍд).
# ȱµã: Ò×ʧÐÔ, µ±¼ÆËã»úÖØÆô»ò¹Ø»úʱ»á¶ªÊ§Êý¾Ý.
#+ »á¼õÉÙϵͳ¿ÉÓõÄRAM.
# 10 # ÄÇôramdiskÓÐʲô×÷ÓÃÄØ?
# ±£´æÒ»¸ö½Ï´óµÄÊý¾Ý¼¯ÔÚramdisk, ±ÈÈçÒ»Õűí»ò×Öµä,
#+ ÕâÑù¿ÉÒÔ¼ÓËÙÊý¾Ý²éѯ, ÒòΪÔÚÄÚ´æÀï²éÕÒ±ÈÔÚ´ÅÅÌÀï²éÕÒ¿ìµÃ¶à.
E_NON_ROOT_USER=70 # ±ØÐëÓÃrootÀ´ÔËÐÐ.
ROOTUSER_NAME=root
MOUNTPT=/mnt/ramdisk
SIZE=2000 # 2K ¸ö¿é (¿ÉÒÔºÏÊʵÄ×öÐÞ¸Ä)
BLOCKSIZE=1024 # ÿ¿éÓÐ1K (1024 byte) µÄ´óС
DEVICE=/dev/ram0 # µÚÒ»¸ö ram É豸
username=`id -nu`
if [ "$username" != "$ROOTUSER_NAME" ]
then
echo "Must be root to run \"`basename $0`\"."
exit $E_NON_ROOT_USER
fi
if [ ! -d "$MOUNTPT" ] # ²âÊÔ¹ÒÔصãÊÇ·ñÒѾ´æÔÚÁË,
then #+ Èç¹ûÕâ¸ö½Å±¾ÒѾÔËÐÐÁ˺ü¸´ÎÁ˾Ͳ»»áÔÙ½¨Õâ¸öĿ¼ÁË
mkdir $MOUNTPT #+ ÒòΪǰÃæÒѾ½¨Á¢ÁË.
fi
dd if=/dev/zero of=$DEVICE count=$SIZE bs=$BLOCKSIZE
# °ÑRAMÉ豸µÄÄÚÈÝÓÃÁãÌî³ä.
# ΪºÎÐèÒªÕâô×ö?
mke2fs $DEVICE # ÔÚRAMÉ豸ÉÏ´´½¨Ò»¸öext2Îļþϵͳ.
mount $DEVICE $MOUNTPT # ¹ÒÔØÉ豸.
chmod 777 $MOUNTPT # ʹÆÕͨÓû§Ò²¿ÉÒÔ´æÈ¡Õâ¸öramdisk.
# µ«ÊÇ, Ö»ÄÜÓÉrootÀ´À‹ÔØËü.
echo "\"$MOUNTPT\" now available for use."
# ÏÖÔÚ ramdisk ¼´Ê¹ÆÕͨÓû§Ò²¿ÉÒÔÓÃÀ´´æÈ¡ÎļþÁË.
# ×¢Òâ, ramdiskÊÇÒ×ʧµÄ, ËùÒÔµ±¼ÆËã»úϵͳÖØÆô»ò¹Ø»úʱramdiskÀïµÄÄÚÈÝ»áÏûʧ.
# ¿½±´ËùÓÐÄãÏë±£´æÎļþµ½Ò»¸ö³£¹æµÄ´ÅÅÌĿ¼ÏÂ.
# ÖØÆôÖ®ºó, ÔËÐÐÕâ¸ö½Å±¾Ôٴν¨Á¢ÆðÒ»¸ö ramdisk.
# ½öÖØмÓÔØ /mnt/ramdisk ¶øûÓÐÆäËûµÄ²½Ö轫²»»áÕýÈ·¹¤×÷.
# Èç¹û¼ÓÒԸĽø, Õâ¸ö½Å±¾¿ÉÒÔ·ÅÔÚ /etc/rc.d/rc.local,
#+ ÒÔʹϵͳÆô¶¯Ê±ÄÜ×Ô¶¯ÉèÁ¢Ò»¸öramdisk.
# ÕâÑùºÜºÏÊÊËÙ¶ÈÒªÇó¸ßµÄÊý¾Ý¿â·þÎñÆ÷.
exit 0