|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
/ ^+ ]2 g# D2 z5 l; C# O6 @ or: fdisk /dev/sdc (for the third SCSI disk)/ u* j H# k L4 w5 E$ J
or: fdisk /dev/eda (for the first PS/2 ESDI drive): ]; K3 T" {4 `7 B6 Z7 |; _# U; l( k
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)/ C- Y% V( y6 J
...! e1 A" B3 v5 d* q6 w
- df -k! {$ G* l4 N- _3 w1 ~
- df -lh
3 q9 I2 {* p! E, z# x$ } - 查看有几块硬盘:fdisk -l
0 h4 d7 S$ F3 E0 J0 s) [
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点, O+ g' ]* r, ~/ C P* _4 u
/dev/sda3 3723848 705968 2828716 20% / B' j; e5 o. \, v
/dev/sda1 101089 9274 86596 10% /boot* u7 ]# a8 }8 J$ ^4 |. p. \
none 14520 0 14520 0% /dev/shm
4 D& f! s! \- \$ t 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用0 b3 g4 [. n d7 n( [
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel6 \6 s- Z/ B. z) l" s8 j3 K2 f* Y
Building a new DOS disklabel. Changes will remain in memory only,; l3 {% K6 c9 q
until you decide to write them. After that, of course, the previous
% p' y# N' N# | content won't be recoverable.# \- w; D+ ?+ \4 ~# w4 ?
The number of cylinders for this disk is set to 8322.
9 k* Y c H; T' Q! p There is nothing wrong with that, but this is larger than 1024,4 k1 I% S0 l3 Z8 f! T' {
and could in certain setups cause problems with:
& K6 g a; W& [6 f1 M 1) software that runs at boot time (e.g., old versions of LILO)3 Z1 J5 l3 e; T0 ^
2) booting and partitioning software from other OSs
O2 |( j2 N+ c% ~ (e.g., DOS FDISK, OS/2 FDISK)6 {- I5 s5 v2 Y1 L
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
+ f: J8 L7 }7 {# ]1 g Command (m for help): p
' A% R+ C; K; }* ?' N+ W Disk /dev/hda: 4294 MB, 4294967296 bytes. k7 j) A8 g& w- w! Y5 x2 b, [; v
16 heads, 63 sectors/track, 8322 cylinders6 M2 E+ O& ^- t. s& E" K
Units = cylinders of 1008 * 512 = 516096 bytes8 E1 X/ s7 Q( _' k9 S5 d* \" F% a
Device Boot Start End Blocks Id System# c3 a- m2 Z# j/ E& Y; b ` ~( K1 i
Command (m for help): m
+ v4 b" I5 n: t* Q) K+ B Command action: y) @5 D3 x( V9 W! ~ \
a toggle a bootable flag6 u7 b% [ P/ R( }7 u
b edit bsd disklabel& s/ w% S* e7 v: y
c toggle the dos compatibility flag
% x- t5 e/ O- L9 F4 e0 ^7 k: m d delete a partition
/ V" V' h' ^' k/ P' ^- Y7 @/ S l list known partition types+ q' J6 l' d- b) R8 M8 ]' Y
m print this menu
) K! Y6 F8 C$ J, y n add a new partition( x; [: b& Z+ \6 q. e
o create a new empty DOS partition table( i( h, \! k# y) J5 A, c* L! b4 w
p print the partition table
0 A- {- m. Z2 Y$ e) e4 H q quit without saving changes1 V- y- ~1 r, B" F) d2 O8 [# }
s create a new empty Sun disklabel
* K8 v3 D' \! y8 T7 J t change a partition's system id3 M l1 T" O2 m2 ~
u change display/entry units$ _! e. Q, B! s# R
v verify the partition table
6 S8 _9 N- f0 I; w0 H0 _ w write table to disk and exit- n6 [! R8 i& ^
x extra functionality (experts only)
+ L! @8 z4 n0 J/ T' N, O Command (m for help): n
/ Q- H6 ?- U) h* j; O2 ] Command action" f* G2 o) G8 p7 r" _3 e% T
e extended8 y( L) l& n1 l1 f# @& [+ ^/ ?
p primary partition (1-4)9 t7 u2 q9 G5 L& s2 R
p _/ L, r ^& @7 n
Partition number (1-4): 1' X7 E( K! I. e+ _* k8 w. E1 ?: K
First cylinder (1-8322, default 1): t2 L& g$ f) R+ O
Using default value 1
% l/ H: q- V- l( ?! _ Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G, v/ G1 x3 Y+ w! c0 \0 j
Command (m for help): p; a2 ^6 E4 c, s, e4 Q
Disk /dev/hda: 4294 MB, 4294967296 bytes
4 w- h+ B' Y* ^6 h 16 heads, 63 sectors/track, 8322 cylinders
0 \0 s& Z. Y( |0 C U Units = cylinders of 1008 * 512 = 516096 bytes2 u1 u) \9 p) l% \) X' K) a7 J/ L
Device Boot Start End Blocks Id System& N0 M8 f" A* a; }
/dev/hda1 1 1000 503968+ 83 Linux
, h5 G' f9 @4 h/ d Command (m for help): w
; f* j; s, o. j* P+ |4 z: c The partition table has been altered!
5 b7 z1 |" p+ {+ b H Calling ioctl() to re-read partition table.
) ?: G! N' X5 O! E- f' U Syncing disks.
! l9 g) D& i3 F' h6 a //格式化新分区
& m; H8 M" g2 W! A! nmke2fs 1.32 (09-Nov-2002)
& e2 w. F) o- |5 o' d; n9 R Filesystem label=
3 |8 ?7 z! O/ U9 r ]2 ]0 t( A7 l OS type: Linux
0 C( F# x( P9 {2 W$ s Block size=1024 (log=0)+ t6 [8 k% h5 V6 s7 E
Fragment size=1024 (log=0)! D, h8 ~6 _% F' e. y7 `
126480 inodes, 503968 blocks
" ]6 L' d% t3 t7 k, K0 I, X: N+ q 25198 blocks (5.00%) reserved for the super user/ {( J0 k* n9 F+ b" q* W
First data block=1
0 _( ~3 w% v. C8 O, U0 f) H( a8 u 62 block groups
" P4 W0 ~" T& J: W5 @ V 8192 blocks per group, 8192 fragments per group
2 L% K( a8 I! T; V) Q3 y 2040 inodes per group5 P% U- R+ E0 `% e& _
Superblock backups stored on blocks: % [) r5 e, M. X3 a
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
6 F* E3 p6 m( J/ Y5 M. m Writing inode tables: done $ U/ \3 C: ?% d1 b( W
Creating journal (8192 blocks): done
% e, S# j+ R6 B% Z1 h Writing superblocks and filesystem accounting information: done
9 c' ?- p' s M0 B) A) E( _ This filesystem will be automatically checked every 30 mounts or; U& o1 T* P& K' I0 |; @
180 days, whichever comes first. Use tune2fs -c or -i to override.
1 N! j" c% T7 Q文件系统 1K-块 已用 可用 已用% 挂载点
' Z2 S1 n. c S. @) a3 ^ /dev/sda3 3723848 705992 2828692 20% /0 `, O5 M; I) S+ l. N
/dev/sda1 101089 9274 86596 10% /boot
+ T* N* s! C6 s* g none 14520 0 14520 0% /dev/shm8 W! Z# r" M: g$ z
//挂上新分区
$ T, B5 Q$ B, W% k$ V8 p6 I: u% t- mount /dev/hda1 /home
! f# c+ X& \; ^, |. C, x0 n. z - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点0 z# O8 g; D# L- V( B; W
/dev/sda3 3723848 705992 2828692 20% /
7 i8 G" q. s3 J% v) q% `9 e0 Y /dev/sda1 101089 9274 86596 10% /boot' S5 ?* } K5 _% f" A& a& i( ^
none 14520 0 14520 0% /dev/shm
6 d+ l I& L; C( S: [6 z, E) U /dev/hda1 488006 8239 454569 2% /home
1 _6 k4 o1 |( }9 `( M
) _1 p, s) P# n; [自动挂载:
1 E* C0 \! x* e% _- vi /etc/fstab6 j# Y# K( s* ?/ B* X& f
- B* F: g5 W3 L3 T g& N
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0& w) c1 \' w) u
3 r6 I: }1 }$ e, T/ j+ j& I* R- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
' _2 R% z/ \& k- mount /dev/sdb5 /mnt/ljp1
. a6 h/ i5 A8 w/ K4 v0 E6 L" _( j
+ H( r. p! c" g- mount /dev/sdb6 /mnt/ljp2
复制代码 j5 W- _/ t/ H1 Q1 C- ]6 V; o
; C7 N. J! n1 E9 h* K$ n* b6 j/ [2 o+ Y5 q) i& r8 H
|
|