|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
5 Y( s6 ]0 l4 n/ b or: fdisk /dev/sdc (for the third SCSI disk)
/ x4 Q0 j4 B$ {+ v5 v or: fdisk /dev/eda (for the first PS/2 ESDI drive)
& F7 B( @0 @5 S# c# Z6 j" V4 L% ] or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)/ k, R0 |1 d: m9 C$ @
...
, M1 q P1 s3 C+ Z; x# s# e/ V- df -k9 a1 P" S9 y3 S+ ^8 P' D0 S
- df -lh
( e8 \/ f% I, _8 s5 _ - 查看有几块硬盘:fdisk -l
* S1 E* p% @5 p/ Y0 D
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
7 u* L. |7 f. P' c" d/ V6 }. b /dev/sda3 3723848 705968 2828716 20% /7 q. U! r) Q. X3 \
/dev/sda1 101089 9274 86596 10% /boot- @7 e5 \, s3 d8 m! i8 w+ F
none 14520 0 14520 0% /dev/shm& C3 r6 I" S! J
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用4 }( T) p% _# G- u p6 w9 G. G+ {
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
2 u/ |; }% v) N, G Building a new DOS disklabel. Changes will remain in memory only,
4 q3 S- e, n, l# d until you decide to write them. After that, of course, the previous
2 O4 k d ?; \) [" k6 }% F1 H, Q content won't be recoverable.
- s% w2 t5 @% ], m4 t The number of cylinders for this disk is set to 8322.
\- w3 f6 ]6 r There is nothing wrong with that, but this is larger than 1024,
, M" c ^7 G0 @$ Q and could in certain setups cause problems with:
- s+ A( Q3 |0 v+ \ ? 1) software that runs at boot time (e.g., old versions of LILO)7 b/ q0 e0 M* I% O8 q
2) booting and partitioning software from other OSs8 E; Q( x) H0 Y0 n% s5 u1 z
(e.g., DOS FDISK, OS/2 FDISK)
& L- Q' k& W" C# ?. o) Z' h! X8 r, O Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)# A4 c: {! p( z `
Command (m for help): p
7 z4 f7 N6 {0 U) o Disk /dev/hda: 4294 MB, 4294967296 bytes
, N/ L$ e0 e4 \6 T1 @. ]' o1 T 16 heads, 63 sectors/track, 8322 cylinders- \% w: A* [4 U# @ y9 c$ ^
Units = cylinders of 1008 * 512 = 516096 bytes+ N! `' t U5 q1 m& {
Device Boot Start End Blocks Id System& G% y! n# h W k# N0 U' j) I
Command (m for help): m' Y% J8 H3 j* h: d3 w
Command action
) ?; ~5 F1 Q+ I% p8 l" m$ o. m a toggle a bootable flag
F4 Z2 t. g1 @& ?& [# M b edit bsd disklabel' c8 w" }, g2 n; x' y
c toggle the dos compatibility flag! B1 T$ ?% u. g: Q9 W t
d delete a partition( ~3 L" s- o! H! }6 R6 \
l list known partition types4 R7 B+ Z* d, ], y: i y
m print this menu
2 U6 n: }' }8 {. e- c5 q n add a new partition j& I$ S: Q7 c# X* ?$ x
o create a new empty DOS partition table/ i E% H4 c4 a/ A) W
p print the partition table
2 H8 S. @' s0 _$ z3 o' e q quit without saving changes' i; A& K4 Q O: O7 K
s create a new empty Sun disklabel
; ~: p: a; J5 c t change a partition's system id
& {9 ^" ?0 e1 f& _+ D u change display/entry units
' H% b& ]- J$ U6 _4 s" N" I; z6 Q v verify the partition table3 c: s h6 [. t6 q2 I. ?
w write table to disk and exit. G1 ~5 }' ?# H) S7 y
x extra functionality (experts only)
. W3 ^* Q& Q/ a Command (m for help): n
! P3 Y% C: S1 W" d* y. t% G- v Command action
5 @0 ^0 V1 `0 k% Q7 p3 t: W0 ~ e extended
4 z4 E# ]$ g* e/ Z) S4 X8 s" L p primary partition (1-4)* g9 d. N3 Q7 u1 y
p9 v' I7 z% G% c& w q1 _
Partition number (1-4): 16 f+ y2 V% K @. J i1 x
First cylinder (1-8322, default 1):
9 K- f! b) n' D Using default value 1
3 ?+ f7 A) W4 U% [5 Z* R. {) K: \1 Y Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G8 i; ~8 i! [) g+ a& i
Command (m for help): p
7 c/ C. [: g( n4 U% E Disk /dev/hda: 4294 MB, 4294967296 bytes
) p& N3 L% k6 H+ h( W. ]7 v 16 heads, 63 sectors/track, 8322 cylinders" U( }* f- N0 ?) M& X
Units = cylinders of 1008 * 512 = 516096 bytes
& H; L) M* b' F& [; m) s Device Boot Start End Blocks Id System' k6 K, ^. Q& D! R L& ]* S8 A
/dev/hda1 1 1000 503968+ 83 Linux
5 L0 y5 w# i: e+ p- r8 t$ ?- {1 N Command (m for help): w
& }/ @' a4 X- _* g The partition table has been altered! i" I7 D8 Y1 a* | o! N
Calling ioctl() to re-read partition table.
3 ]4 b5 Z5 t2 k2 U4 s4 M Syncing disks.
# X3 J; r9 `' T8 @2 V, D6 d6 c* }0 R //格式化新分区# Q; s( ^5 |1 P
mke2fs 1.32 (09-Nov-2002), U' B+ l T9 X2 `+ j+ G! k
Filesystem label=# H! m- _" L) I
OS type: Linux0 {4 I6 K% D8 K. q" {9 E
Block size=1024 (log=0)
; a' P* f5 a# r4 z/ s3 m Fragment size=1024 (log=0)! [& I0 c& W) V! ]/ H
126480 inodes, 503968 blocks
. P+ s% u, {, {/ i- r7 ~ 25198 blocks (5.00%) reserved for the super user7 q' y% ?! N: O' y2 X
First data block=1
4 p4 D: c/ {; \" n" V 62 block groups( A: n% u' s% P, B7 d* p% f
8192 blocks per group, 8192 fragments per group
' |3 H; ?+ M& a4 W$ f4 D 2040 inodes per group; W' D& N% [/ `
Superblock backups stored on blocks: $ ]$ Z& F% B$ \1 u6 [ z, Y2 A9 a0 \
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
& ]! d e' d' b, ^ Q4 z9 V/ D3 G$ ]$ @ Writing inode tables: done
: Z6 Z7 |% ]2 I T2 T3 h Creating journal (8192 blocks): done
) F L6 j" ?' O, ?$ B- z Writing superblocks and filesystem accounting information: done0 t: X! {- q. g/ Z: }* Z- i
This filesystem will be automatically checked every 30 mounts or
% I/ k* N2 F! z( s7 L/ F 180 days, whichever comes first. Use tune2fs -c or -i to override.7 J R* E6 |' @/ Z6 w+ B% D8 U
文件系统 1K-块 已用 可用 已用% 挂载点
' ?. |2 {. c2 z/ k /dev/sda3 3723848 705992 2828692 20% /, n% \0 M# G3 Z+ }$ k8 m
/dev/sda1 101089 9274 86596 10% /boot: P7 \% c% h4 N9 w: |
none 14520 0 14520 0% /dev/shm
/ u' J8 I! a5 i- P/ ]7 P //挂上新分区
* C9 H+ d; v4 k% C P' _- mount /dev/hda1 /home5 H! ]6 T, {! i+ J
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! U6 ]3 u, Q/ q2 ~' w) i/ i) J /dev/sda3 3723848 705992 2828692 20% /, ~; ]7 v( Z7 {' M+ p2 A8 O
/dev/sda1 101089 9274 86596 10% /boot
' ?* t* ^1 p$ K* c6 Q none 14520 0 14520 0% /dev/shm
3 u7 e2 H) _, H$ w* Y) P /dev/hda1 488006 8239 454569 2% /home5 d* T% c' x1 j0 J" C" |
( y. J7 \$ y! N6 F- D自动挂载:
7 j- Q% {% Y( r$ U) D- \- vi /etc/fstab
, k o6 }1 i1 r
6 v, S8 V* \9 @0 K) O- H7 X- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0, g9 B8 Q9 j2 q6 `, d- b8 [
- / Z8 {! f4 ^6 D# j4 b' G* Z/ J
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:( `8 k; V; @/ V8 |" }* f" m
- mount /dev/sdb5 /mnt/ljp1! ~/ Z% w. G' {3 [* y
4 u5 \+ K5 s, o# s3 v- mount /dev/sdb6 /mnt/ljp2
复制代码
" R9 x% ` e' i: T& p4 O" B! V4 t& Y+ g
' N+ z' B5 p- a- s8 O6 w, f |
|