❶ linux鎬庝箞鏌ョ湅紓佺洏絀洪棿
涓銆乨f 鍛戒護;
df 鏄鏉ヨ嚜浜巆oreutils 杞浠跺寘錛岀郴緇熷畨瑁呮椂錛屽氨鑷甯︾殑;鎴戜滑閫氳繃榪欎釜鍛戒護鍙浠ユ煡鐪嬬佺洏鐨勪嬌鐢ㄦ儏鍐典互鍙婃枃浠剁郴緇熻鎸傝澆鐨勪綅緗;
涓句緥錛
[root@localhost beinan]# df -lh
Filesystem 瀹歸噺 宸茬敤 鍙鐢 宸茬敤% 鎸傝澆鐐
/dev/hda8 11G 6.0G 4.4G 58% /
/dev/shm 236M 0 236M 0% /dev/shm
/dev/sda1 56G 22G 35G 39% /mnt/sda1
鎴戜滑浠庝腑鍙浠ョ湅鍒幫紝緋葷粺瀹夎呭湪/dev/hda8 ;榪樻湁涓涓56G鐨勭佺洏鍒嗗尯/dev/sda1鎸傝澆鍦 /mnt/sda1涓;
鍏跺畠鐨勫弬鏁拌峰弬鑰 man df
浜屻乫dsik
fdisk 鏄涓嬈懼己澶х殑紓佺洏鎿嶄綔宸ュ叿錛屾潵鑷猽til-linux杞浠跺寘錛屾垜浠鍦ㄨ繖閲屽彧璇翠粬濡備綍鏌ョ湅紓佺洏鍒嗗尯琛ㄥ強鍒嗗尯緇撴瀯;鍙傛暟 -l 錛岄氳繃-l 鍙傛暟錛岃兘鑾峰緱鏈哄櫒涓鎵鏈夌殑紜鐩樼殑鍒嗗尯鎯呭喌;
[root@localhost beinan]# fdisk -l
Disk /dev/hda錛 80.0 GB錛 80026361856 bytes
255 heads錛 63 sectors/track錛 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 765 6144831 7 HPFS/NTFS
/dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)
/dev/hda3 2806 7751 39728745 5 Extended
/dev/hda5 2806 3825 8193118+ 83 Linux
/dev/hda6 3826 5100 10241406 83 Linux
/dev/hda7 5101 5198 787153+ 82 Linux swap / Solaris
/dev/hda8 5199 6657 11719386 83 Linux
/dev/hda9 6658 7751 8787523+ 83 Linux
鍦 涓婇潰Blocks涓錛岃〃紺虹殑鏄鍒嗗尯鐨勫ぇ灝忥紝Blocks鐨勫崟浣嶆槸byte 錛屾垜浠鍙浠ユ崲綆楁垚M錛屾瘮濡傜涓涓鍒嗗尯/dev/hda1鐨勫ぇ灝忓傛灉鎹㈢畻鎴怣錛屽簲璇ユ槸6144831/1024=6000M錛屼篃灝辨槸6G宸﹀彸錛屽叾瀹炴病鏈夎繖涔 楹葷儲錛岀矖鐣ョ殑鐪嬩竴涓嬫妸灝忔暟鐐瑰悜鍓嶇Щ鍔ㄤ笁浣嶏紝灝辯煡閬撳ぇ綰︾殑浣撶Н鏈夊氬ぇ浜;
System 琛ㄧず鐨勬枃浠剁郴緇燂紝姣斿/dev/hda1 鏄疦TFS鏍煎紡鐨;/dev/hda2 琛ㄧず鏄痜at32鏍煎紡鐨勬枃浠剁郴緇;銆
鍦ㄦや緥涓錛屾垜浠瑕佺壒鍒娉ㄦ剰鐨勬槸/dev/hda3鍒嗗尯錛岃繖鏄鎵╁睍鍒嗗尯;浠栦笅闈㈠寘鍚鐫閫昏緫鍒嗗尯錛屽叾瀹炶繖涓鍒嗗尯鐩稿綋浜庝竴涓瀹瑰櫒;浠庡睘浜庡ス鐨勬湁 hda5錛宧da6錛宧da7錛宧da8錛宧da9 ;
鎴 浠榪樻敞鎰忓埌涓鐐癸紝鎬庝箞娌℃湁hda4鍛?涓轟粈涔坔da4娌℃湁鍖呭惈鍦ㄦ墿灞曞垎鍖?涓涓紓佺洏鏈澶氭湁鍥涗釜涓誨垎鍖; hda1-4綆楅兘鏄涓誨垎鍖;hda4涓嶅彲鑳藉寘鍚鍦ㄦ墿灞曞垎鍖洪噷錛屽彟澶栨墿灞曞垎鍖轟篃綆椾富鍒嗗尯;鍦ㄦ湰渚嬩腑錛屾病鏈塰da4榪欎釜鍒嗗尯錛屽綋鐒舵垜浠鍙浠ユ妸鍏朵腑鐨勪竴涓鍒嗗尯璁 緗涓轟富鍒嗗尯錛屽彧鏄鎴戝綋鏃跺垎鍖虹殑鏃跺欐病鏈夎繖涔堝仛鑰屽凡;
鍐 浠旂粏緇熻′竴涓嬶紝鎴戜滑鐪嬩竴鐪嬭繖涓紓佺洏鏄涓嶆槸榪樻湁絀洪棿?hda1+hda2+hda3=瀹為檯宸茬粡鍒嗗尯鐨勪綋縐錛屾墍浠ユ垜浠鍙浠ヨ繖鏍風畻 hda1+hda2+hda3=6144831+16386300+39728745 = 62259876 (b)錛屾崲綆楁垚M鍗曚綅錛屽皬鏁扮偣鍚戝墠縐諱笁浣嶏紝鎵浠ョ洰鍓嶅凡緇忓垝鍒嗗ソ鐨勫垎鍖哄ぇ綰﹀崰鐢ㄤ綋縐鏄62259.876(M)錛屽叾瀹炴渶綺劇『鐨勮$畻 62259876/1024=60800.67(M);鑰岃繖涓紓佺洏澶у皬鏄80.0 GB (80026361856byte)錛屽叾瀹炲疄闄呭ぇ灝忎篃灝辨槸78150.744(M);閫氳繃鎴戜滑涓緋誨垪鐨勮$畻錛屾垜浠鍙浠ュ緱鍑鴻繖涓紜鐩樼洰鍓嶈繕鏈変嬌鐢ㄧ殑絀洪棿;澶 綰﹁繕鏈18G鏈鍒嗗尯鐨勭┖闂;
fdisk -l 鑳藉垪鍑烘満鍣ㄤ腑鎵鏈夌佺洏鐨勪釜鏁幫紝涔熻兘鍒楀嚭鎵鏈夌佺洏鍒嗗尯鎯呭喌;姣斿傦細
[root@localhost beinan]# fdisk -l
Disk /dev/hda錛 80.0 GB錛 80026361856 bytes
255 heads錛 63 sectors/track錛 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 765 6144831 7 HPFS/NTFS
/dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)
/dev/hda3 2806 7751 39728745 5 Extended
/dev/hda5 2806 3825 8193118+ 83 Linux
/dev/hda6 3826 5100 10241406 83 Linux
/dev/hda7 5101 5198 787153+ 82 Linux swap / Solaris
/dev/hda8 5199 6657 11719386 83 Linux
/dev/hda9 6658 7751 8787523+ 83 Linux
Disk /dev/sda錛 60.0 GB錛 60011642880 bytes
64 heads錛 32 sectors/track錛 57231 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 57231 58604528 83 Linux
閫氳繃涓婇潰鎴戜滑鍙浠ョ煡閬撴ゆ満鍣ㄦ湁涓ゅ潡紜鐩橈紝鎴戜滑涔熷彲浠ユ寚瀹歠disk -l 鏉ユ煡鐪嬪叾涓涓涓紜鐩樼殑鍒嗗尯鎯呭喌;
[root@localhost beinan]# fdisk -l /dev/sda
Disk /dev/sda錛 60.0 GB錛 60011642880 bytes
64 heads錛 32 sectors/track錛 57231 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 57231 58604528 83 Linux
閫氳繃涓婇潰鎯呭喌鍙浠ョ煡閬擄紝鍦/dev/sda 榪欎釜紓佺洏涓錛屽彧鏈変竴涓鍒嗗尯;浣跨敤閲忓樊涓嶅氭槸鐧懼垎鐧句簡;
鎴戜滑榪樺彲浠ユ潵鏌ョ湅 /dev/hda鐨
[root@localhost beinan]# fdisk -l /dev/hda
鑷宸辮瘯璇曠湅?
涓夈乧fdisk 鏉ヨ嚜浜巙til-linux鐨勮蔣浠跺寘;
cfdisk 涔熸槸涓嬈句笉閿欑殑鍒嗗尯宸ュ叿;鍦ㄦ湁浜涘彂琛岀増涓錛屾ゅ伐鍏峰凡緇忎粠util-linux鍖呬腑鍓旈櫎;cfdisk 綆鍗曟槗鐢ㄦ槸浠栫殑鐗圭偣;鍜孌OS涓鐨刦disk 鐩鎬技;鍦ㄦ湰鏍囬樹腑錛屾垜浠鍙鏉ヨВ璇村備綍鏌ョ湅鏈哄櫒鐨勪腑鐨勭佺洏鍒嗗尯鐘跺喌鍙婃墍鐢ㄧ殑鏂囦歡緋葷粺絳;
銆鏌ョ湅紓佺洏鍒嗗尯鐨勭敤娉 cfdisk -Ps 紓佺洏璁懼囧悕;
姣斿
[root@localhost beinan]cfdisk -Ps
[root@localhost beinan]cfdisk -Ps /dev/hda
[root@localhost beinan]cfdisk -Ps
Partition Table for /dev/hda
First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
1 Primary 0 23438834 63 23438835 Linux (83) Boot
2 Primary 23438835 156296384 0 132857550 Extended (05) None
5 Logical 23438835 155268224 63 131829390 Linux (83) None
6 Logical 155268225 156296384 63 1028160 Linux swap (82) None
鎴戜滑鍙鐢ㄧ殑鍙傛暟 -Ps錛屽氨鍒楀嚭浜嗙佺洏鐨勫垎鍖烘儏鍐;鐩鍓嶅湪Slackware Debian Mandrake 絳変富嫻佸彂琛岀増涓瀛樺湪cfdisk 錛岃宖edora 4.0鎶婅繖涓灝忓伐鍏峰墧闄や簡;鏈夌偣鍙鎯;榪欐槸鎴戝湪Slackware涓鎿嶄綔鐨;
濡傛灉鎮ㄨ繖鏍鋒搷浣滐紝灝辨洿鐩磋備簡;
[root@localhost beinan]cfdisk 紓佺洏璁懼囧悕
涓句緥錛
[root@localhost beinan]cfdisk /dev/hda
鎮ㄦ墍鐪嬪埌鐨勬槸濡備笅鐨勬ā寮忥細
cfdisk 2.12a
Disk Drive錛 /dev/hda
Size錛 80026361856 bytes錛 80.0 GB
Heads錛 255 Sectors per Track錛 63 Cylinders錛 9729
Name Flags Part Type FS Type [Label] Size (MB)
-------------------------------------------------------------------------------------------
hda1 Boot Primary Linux ReiserFS 12000.69
hda5 Logical Linux ReiserFS 67496.65
hda6 Logical Linux swap 526.42
[Bootable] [ Delete ] [ Help ] [Maximize] [ Print ] [ Quit ]
[ Type ] [ Units ] [ Write ]
Toggle bootable flag of the current partition
鎮ㄨ繘鍏ヤ簡cfdisk 鐨勬搷浣滅晫闈;鐢ㄩ敭鐩樼Щ鍔ㄦ寚閽堝埌[Quit]灝卞彲浠ラ鍑;
鍥涖乸arted 鍔熻兘涓嶉敊鐨勫垎鍖哄伐鍏;鍦‵edora 4.0涓鏈夊甫錛屽彲浠ヨ嚜宸卞畨瑁呬笂;鍦ㄦや富棰樹腑錛屾垜浠鍙璇村備綍鏌ョ湅紓佺洏鐨勫垎鍖烘儏鍐;
璋冪敤鏂規硶綆鍗曪紝parted 榛樿ゆ槸鎵撳紑鐨勮懼囨槸/dev/hda 錛屼篃鍙浠ヨ嚜宸辨寚瀹;姣斿 parted /dev/hda 鎴/dev/sda 絳;閫鍑虹殑鏂規硶鏄 quit
[root@localhost beinan]# parted
浣跨敤 /dev/hda
(parted) p
/dev/hda 鐨勭佺洏鍑犱綍緇撴瀯錛0.000-76319.085 鍏嗗瓧鑺
紓佺洏鏍囩劇被鍨嬶細msdos
Minor 璧峰嬬偣 緇堟㈢偣 綾誨瀷 鏂囦歡緋葷粺 鏍囧織
1 0.031 6000.842 涓誨垎鍖 ntfs 鍚鍔
2 6000.842 22003.088 涓誨垎鍖 fat32 lba
3 22003.088 60800.690 鎵╁睍鍒嗗尯
5 22003.119 30004.211 閫昏緫鍒嗗尯 reiserfs
6 30004.242 40005.615 閫昏緫鍒嗗尯 reiserfs
7 40005.646 40774.350 閫昏緫鍒嗗尯 linux-swap
8 40774.381 52219.094 閫昏緫鍒嗗尯 ext3
9 52219.125 60800.690 閫昏緫鍒嗗尯 reiserfs
鎴戜滑鍦╬artd 鐨勬搷浣滈潰涓婏紝鐢╬灝卞彲浠ュ垪鍑哄綋鍓嶇佺洏鐨勫垎鍖烘儏鍐碉紝濡傛灉鎯寵佹煡鐪嬪叾瀹冪佺洏錛屽彲浠ョ敤 select 鍔熻兘錛屾瘮濡 select /dev/sda ;
浜斻乹tparted 錛屼笌parted 鐩稿叧鐨勮蔣浠惰繕鏈塹tparted 錛屼篃鑳芥煡鐪嬪埌紓佺洏鐨勭粨鏋勫拰鎵鐢ㄧ殑鏂囦歡緋葷粺錛屾槸鍥懼艦鍖栫殑;
[beinan@localhost ~]# qtparted
鍥懼艦鍖栫殑鏌ョ湅錛屼竴鐩浜嗙劧;
鍏銆乻fdisk 涔熸槸涓涓鍒嗗尯宸ュ叿錛屽姛鑳戒篃澶氬;鎴戜滑鍦ㄨ繖閲屽彧璇翠粬鐨勫垪紓佺洏鍒嗗尯鎯呭喌鐨勫姛鑳;
[root@localhost beinan]# sfdisk -l
鑷宸辯湅鐪嬪惂;
sfdisk 鏈夊嚑涓寰堟湁鐢ㄧ殑鍔熻兘;鏈夊叴瓚g殑寮熷厔涓嶅Θ鐪嬬湅;
涓冦乸artx 涔熺畝瑕佺殑璇翠竴璇達紝鏈変簺緋葷粺鑷甯︿簡榪欎釜宸ュ叿錛屽姛鑳戒篃綆鍗曪紝鍜宖disk 銆乸arted銆乧fdisk 鏉ヨ翠笉鍊間竴鎻;涓嶇敤涔熺艦;
鐢ㄦ硶錛 partx 璁懼囧悕
[root@localhost beinan]# partx /dev/hda
# 1錛 63- 12289724 ( 12289662 sectors錛 6292 MB)
# 2錛 12289725- 45062324 ( 32772600 sectors錛 16779 MB)
# 3錛 45062325-124519814 ( 79457490 sectors錛 40682 MB)
# 4錛 0- -1 ( 0 sectors錛 0 MB)
# 5錛 45062388- 61448624 ( 16386237 sectors錛 8389 MB)
# 6錛 61448688- 81931499 ( 20482812 sectors錛 10487 MB)
# 7錛 81931563- 83505869 ( 1574307 sectors錛 806 MB)
# 8錛 83505933-106944704 ( 23438772 sectors錛 12000 MB)
# 9錛 106944768-124519814 ( 17575047 sectors錛 8998 MB)
鍏銆佹煡鐪嬬洰鍓嶆満鍣ㄤ腑鐨勬墍鏈夌佺洏鍙婂垎鍖烘儏鍐碉細
[beinan@localhost ~]$ cat /proc/partitions
major minor #blocks name
3 0 78150744 hda
3 1 6144831 hda1
3 2 16386300 hda2
3 5 8193118 hda5
3 6 10241406 hda6
3 7 787153 hda7
3 8 11719386 hda8
3 9 8787523 hda9
8 0 58605120 sda
8 1 58604528 sda1