❶ 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