|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)/ _4 s% ?& j/ ^- }* A, h. {+ s
or: fdisk /dev/sdc (for the third SCSI disk)
* \. o3 r1 x M% H* b3 \ or: fdisk /dev/eda (for the first PS/2 ESDI drive)
9 m, s7 i5 d: q( l& w or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
3 K0 y2 @! d6 ^ ..., g( z! X. A3 @& t% l' e2 _
- df -k
2 Z7 }% P. \3 g& Z3 s7 _0 O - df -lh; ~; e( g& L! r, |. }
- 查看有几块硬盘:fdisk -l
( i H: C8 S7 }( j
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
9 G; @2 o5 j5 _" Z! o /dev/sda3 3723848 705968 2828716 20% /
% \4 i3 t: W: S' o /dev/sda1 101089 9274 86596 10% /boot8 _1 a n, N' m e
none 14520 0 14520 0% /dev/shm2 c! h( k! e! m; f6 c
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用# }6 l0 N: S6 p' J
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
! t$ {& S' j' @9 S Building a new DOS disklabel. Changes will remain in memory only,
6 F4 |# T# s' e9 d& O `: \9 \/ M until you decide to write them. After that, of course, the previous/ N3 H& Y0 A- g& e/ J5 w; H( T8 y a1 G
content won't be recoverable./ |/ j m- n! v' O+ g
The number of cylinders for this disk is set to 8322.
% p/ r" P/ K9 p. y There is nothing wrong with that, but this is larger than 1024,5 M$ ?. H, B' `6 H
and could in certain setups cause problems with:4 k3 G j* Z- }3 B. N. b7 q
1) software that runs at boot time (e.g., old versions of LILO)5 v8 b7 ^: n8 ]: s9 j: r$ K5 }
2) booting and partitioning software from other OSs
0 }! H+ \$ s' Y (e.g., DOS FDISK, OS/2 FDISK)
/ v4 o. ?% G# D( X: Y+ ^! G- O9 ^ Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)3 y2 a* ?- R9 _1 V! n9 B
Command (m for help): p
, {3 W3 t- T" u' Z+ D8 @8 Q Disk /dev/hda: 4294 MB, 4294967296 bytes1 S* z/ X" B$ k
16 heads, 63 sectors/track, 8322 cylinders/ }* a8 [) T4 ]7 s+ b0 X8 q9 o
Units = cylinders of 1008 * 512 = 516096 bytes
: R9 Q% J: S5 k1 h Device Boot Start End Blocks Id System
, Y; ?+ b0 P, n4 e) Y Command (m for help): m# @- ]; ^% X; {2 T4 \
Command action* q/ F( ]: O9 ~" l9 Z
a toggle a bootable flag( a+ f. @6 _) L6 H" b
b edit bsd disklabel
5 U- E* p4 c% H4 j c toggle the dos compatibility flag5 T6 P/ v! R* ?8 C. Y0 b9 e
d delete a partition
$ t' w u7 Q2 y" m l list known partition types0 t6 N+ i: X4 h- L& B) ^
m print this menu W" y4 i3 W. @ o( V
n add a new partition
$ T# |& D2 |* H* j: S4 w% `7 X. r o create a new empty DOS partition table
* @. Q9 C$ A2 _. V: h- ?0 p$ A p print the partition table9 C& F) `- Z) r& e- w4 ]; F7 U$ n) W
q quit without saving changes( \6 P3 `& k) P
s create a new empty Sun disklabel5 W7 M( X" w+ G1 O# r
t change a partition's system id
; l# Z2 H; O8 r. C u change display/entry units/ v' O; |) t* ]7 `5 w( z
v verify the partition table7 i/ B5 L6 @6 g' K" u, K# W( Y
w write table to disk and exit! U9 ~. J1 n& J# c9 P; n
x extra functionality (experts only)5 C1 U8 ~7 v3 R' O0 f
Command (m for help): n: v1 m- z# Y& A8 c
Command action m, T3 N0 r8 U0 c
e extended( k- O9 t4 M* e! [2 _
p primary partition (1-4)
2 |2 d4 w( e7 @ p
" v0 g* o( z0 [ Partition number (1-4): 1
5 W' |' ~/ `0 v$ `) g9 y First cylinder (1-8322, default 1):
. @8 m: }1 l1 Y" H. ]1 S; E Using default value 1
2 Z. E1 H% J& J" R1 U3 x1 R Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G; |8 u6 _$ M+ U! m; y/ C. T# [4 i
Command (m for help): p
' h# v3 d! e4 g; g: f Disk /dev/hda: 4294 MB, 4294967296 bytes0 z6 P3 {- g. h0 w2 @2 }/ {
16 heads, 63 sectors/track, 8322 cylinders, e+ j* k7 }, h; y8 Q
Units = cylinders of 1008 * 512 = 516096 bytes
! v* J5 N5 \% o/ ]' Y3 t, p0 R Device Boot Start End Blocks Id System9 K4 z; T" l$ I( T8 g+ y1 Y
/dev/hda1 1 1000 503968+ 83 Linux
3 h9 {( C! _6 n1 b' O6 I- \ Command (m for help): w$ e/ H- c0 P8 Z! k) ?% g) R+ u& K
The partition table has been altered!4 F+ e/ S. ^% e' f, }; ^2 A
Calling ioctl() to re-read partition table.
$ {+ p& W6 D& h Syncing disks.# q3 H3 I8 e1 F6 r- k. Q+ R
//格式化新分区5 F; V1 W; x- D' ?8 G! X( j
mke2fs 1.32 (09-Nov-2002)
3 p/ U9 w# U9 N* |, _) b( R Filesystem label=) n( \6 A5 F# k5 o% z$ a# U
OS type: Linux# U: J5 l5 y- o: L1 l
Block size=1024 (log=0)
$ v% l9 P9 f$ } _/ W* ~ Fragment size=1024 (log=0)! [% x+ {( c2 ]/ k. Y, n- }
126480 inodes, 503968 blocks
' T+ ?/ K8 W( T$ ] 25198 blocks (5.00%) reserved for the super user: n# _: L0 u7 O: l' S9 ?2 A9 z! B
First data block=1 a7 y8 U: ?9 e. h' X$ H3 P
62 block groups
3 j* ?1 L& v: |, m7 d3 q 8192 blocks per group, 8192 fragments per group
$ X' d+ S4 c4 H) |. h 2040 inodes per group4 d* G0 ]* @2 c: ~6 x- I
Superblock backups stored on blocks: # g0 ]$ B" o# j& X
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409! c1 T0 ]) `5 D
Writing inode tables: done
# o+ O! j" O& Q Creating journal (8192 blocks): done. X4 c: u+ ], t w4 q& I1 N
Writing superblocks and filesystem accounting information: done
' f5 l* {6 g0 O+ P+ ^4 Z0 |: z: s This filesystem will be automatically checked every 30 mounts or4 `% l9 j% d2 L1 x
180 days, whichever comes first. Use tune2fs -c or -i to override.7 ^ p* q [' O/ }1 \; g
文件系统 1K-块 已用 可用 已用% 挂载点
8 J9 N" u" u( l4 y: R& f /dev/sda3 3723848 705992 2828692 20% /; j+ X3 z7 p& L$ ]2 _
/dev/sda1 101089 9274 86596 10% /boot% x! @* }( @; N3 {4 F7 k) e2 C
none 14520 0 14520 0% /dev/shm- D1 M, e0 K) I) z: l( i
//挂上新分区* m+ E7 q5 ^2 I: M+ X
- mount /dev/hda1 /home
5 r& W- r- w: r4 c# u! N$ @ - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点; @/ F- w+ q1 E) ]3 y3 S
/dev/sda3 3723848 705992 2828692 20% /) D! v: ?2 v2 D
/dev/sda1 101089 9274 86596 10% /boot( N0 Z c% T6 V5 E
none 14520 0 14520 0% /dev/shm0 p) [3 Y) e9 F& J7 y3 _
/dev/hda1 488006 8239 454569 2% /home5 @& M& r0 U- Q$ V8 P
o2 z( u8 h' ?$ v2 l R自动挂载:& X/ W0 x7 P+ g% l8 r
- vi /etc/fstab# X, L& _5 a5 z# S- [3 s6 O' W- x$ k
- 8 e; N7 z. |: g6 c6 G' }7 Q) v
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 05 i' b/ l1 J9 O# |
* C# P* [$ t- K- @+ E- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:6 G; Z# x: U: p8 V: d; H5 v
- mount /dev/sdb5 /mnt/ljp11 C/ b$ R- y) [3 H; B* H) u
8 ]: O* ?* D) K; i1 |) k, @8 ^* B8 s- mount /dev/sdb6 /mnt/ljp2
复制代码
6 t+ d1 o& n/ \5 R. D% Q0 A& m' Y" i! f' ^$ P4 ?: c' l" Y( C
f3 ^% l- E' v4 S( p2 w
|
|