|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
. y' o, m' j- E$ W1 d7 {( D or: fdisk /dev/sdc (for the third SCSI disk)
! U: \. t/ X/ T/ C' s or: fdisk /dev/eda (for the first PS/2 ESDI drive)
8 I# e/ `* x+ f4 V0 Q or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
2 V1 T' \, p: K0 ^( _% ^5 L& P( H0 _ ...
. Q- w0 e7 ^8 s) B& O0 a- df -k
" g o3 M* K6 O; O - df -lh- x; V) A- X5 y. ~" G$ X2 U
- 查看有几块硬盘:fdisk -l
& |3 Z8 e. R. P& Q) Y. A
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点5 q! g P3 m# c u' W
/dev/sda3 3723848 705968 2828716 20% /9 V! M; A e7 t. X
/dev/sda1 101089 9274 86596 10% /boot& ?2 T+ d4 A+ x' d% l* ]9 `
none 14520 0 14520 0% /dev/shm9 ^ ?! p" c! j
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用$ G4 ~' p; w" D
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel5 J4 T# _# |# ?9 m; j7 t
Building a new DOS disklabel. Changes will remain in memory only,
( i+ e* K9 I8 y until you decide to write them. After that, of course, the previous
7 B% z3 h. c5 `! @5 s content won't be recoverable." {. W8 _* u% a0 e7 O
The number of cylinders for this disk is set to 8322.# G- D7 O; ]; a6 L
There is nothing wrong with that, but this is larger than 1024,# `% I3 ]/ I* D# S* C6 g9 n
and could in certain setups cause problems with:5 ?7 P4 G9 Y9 G2 ?# s
1) software that runs at boot time (e.g., old versions of LILO)
- K1 T) }% `1 q" v4 H 2) booting and partitioning software from other OSs2 V0 S) i0 O9 I: N. u
(e.g., DOS FDISK, OS/2 FDISK)1 H( v5 ]) t- F
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)8 w5 |2 M& D: ?2 o; B7 B0 p# t
Command (m for help): p, W4 S/ e1 p$ T, `; Y
Disk /dev/hda: 4294 MB, 4294967296 bytes1 J7 I( |- I, _6 ?; c, |1 z
16 heads, 63 sectors/track, 8322 cylinders
: g2 ]+ Y8 p# u/ M Units = cylinders of 1008 * 512 = 516096 bytes
; h1 l( e# k4 C! _( w. n Device Boot Start End Blocks Id System4 G5 |$ ~$ \( W8 _0 u/ W
Command (m for help): m/ ~) e4 X6 a, j
Command action8 R$ D7 s8 M8 t, Y' Z4 q. u
a toggle a bootable flag" C8 l9 O3 d5 ~
b edit bsd disklabel
: }! |- M& T5 B0 Q c toggle the dos compatibility flag7 b; E, I+ d. q3 s$ `4 g' e% b
d delete a partition7 }, H, B9 f* u# J
l list known partition types
* \6 [% Q( p" A+ ~ x m print this menu. a% u6 `! A8 J0 r6 A- D# b
n add a new partition
) E# L# I' d& [; y, f o create a new empty DOS partition table
" n$ \3 T x3 J# \& L* I" X p print the partition table
6 C2 Y. B' f; i4 b' S8 n. |5 n q quit without saving changes. m& T, @# j! @: X3 Z0 S% T7 k' w% i
s create a new empty Sun disklabel
$ \& s# X; j7 q8 g' [3 p$ F t change a partition's system id
0 v" y; x* I3 E& J3 n. ]! E% { u change display/entry units. v, [- i' z: s# q% ~$ @6 x; v
v verify the partition table
6 q+ _4 T9 `6 j w write table to disk and exit
0 y' i/ }$ D( |' F2 a$ g6 m x extra functionality (experts only)
" v& M# d9 ?; O Command (m for help): n6 H ~! Y; Y8 r) E5 \# q5 Q1 \
Command action, I/ Y& H+ M: j9 h& I8 z( Z
e extended8 l% U6 g4 c0 W; _+ g' g! X+ V
p primary partition (1-4)
% s" u1 ?6 A) Z; E0 s p3 N$ I2 j# y$ V' P8 c
Partition number (1-4): 1
* l, W$ l& V- r5 ?! U0 H First cylinder (1-8322, default 1):
8 K) }/ ^8 _, ~1 U4 P& N Using default value 1
& [! O2 B- R; Q8 n4 I$ c Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G5 m) i0 v3 m1 n. _5 | F' {
Command (m for help): p5 U- ^" `. C4 @( n
Disk /dev/hda: 4294 MB, 4294967296 bytes/ E: T4 x' U+ a( C1 T0 }6 t
16 heads, 63 sectors/track, 8322 cylinders
, W# h; K' _( ], Z; m8 y5 D. a Units = cylinders of 1008 * 512 = 516096 bytes$ o4 u( y" a7 g8 h3 P0 C: j# q' K; a
Device Boot Start End Blocks Id System; ~$ a9 V" d4 K: D! @ F! y
/dev/hda1 1 1000 503968+ 83 Linux
# J: \( G# ~% ^0 q Command (m for help): w
0 w0 f$ K! y8 \' h0 ^* V' z) t The partition table has been altered!' r0 I* [/ q* V) o. e: ~. [
Calling ioctl() to re-read partition table.' r3 C- D) C* o& y& k
Syncing disks.
8 ~6 u9 L5 F( o //格式化新分区: F1 m; e* c$ R/ D: J# i! B
mke2fs 1.32 (09-Nov-2002)7 L; {6 v; k2 U! J; ~" B" B
Filesystem label=+ B5 R# L; b1 K, q+ h w
OS type: Linux' t d5 j. [6 ~" w* N6 e4 q
Block size=1024 (log=0)
i& g# i6 ]( T5 Q: B Fragment size=1024 (log=0)
* t- Z- G$ y& h: W! V 126480 inodes, 503968 blocks5 ~. y. n# C7 u" h' T8 z, Z
25198 blocks (5.00%) reserved for the super user3 t) w; X, Q" J( ?9 e
First data block=15 a( X2 W7 [+ H( y
62 block groups
" T# W1 r1 ]% D2 s7 U; J 8192 blocks per group, 8192 fragments per group% m1 _, X8 u( j) F* b
2040 inodes per group& Z1 T |- r: D0 Y0 }. g5 f; E/ x
Superblock backups stored on blocks: U0 z, X k: y2 g6 A+ c! q
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
8 \. B1 ^/ P8 G! s) v9 F: X4 T Writing inode tables: done
' P% l" u R; Z5 r& E1 ~& i1 ^ Creating journal (8192 blocks): done Q' h- `0 a2 P) i5 ^
Writing superblocks and filesystem accounting information: done& |: I0 l! F9 B" e
This filesystem will be automatically checked every 30 mounts or2 B- J8 C/ G9 q: a. Q( J
180 days, whichever comes first. Use tune2fs -c or -i to override.
( U% l2 Q! g7 E& ]# m4 U- \文件系统 1K-块 已用 可用 已用% 挂载点6 p6 o: A& p( W+ ~ L# \# z& a/ w; p
/dev/sda3 3723848 705992 2828692 20% /
) V2 V7 R7 |* g! A" e8 H /dev/sda1 101089 9274 86596 10% /boot
& ?, A$ U: `; X- T P- W/ C3 O none 14520 0 14520 0% /dev/shm
! Z* u/ k, Q/ \! m& F" ]# D5 l' n //挂上新分区) v2 R8 {6 a) Q; {- Y/ d' h; M
- mount /dev/hda1 /home
; L# L- i, W# J7 [4 F - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
; K1 u4 r9 m( o* A+ C4 v5 h' a* p /dev/sda3 3723848 705992 2828692 20% /
. S4 |) I! R6 A /dev/sda1 101089 9274 86596 10% /boot3 D; M* B! [6 w6 X8 v0 \
none 14520 0 14520 0% /dev/shm' ~: i% L3 ^6 Y/ i
/dev/hda1 488006 8239 454569 2% /home
$ v$ u9 X# e: M3 j+ { g+ y( q1 p' [3 X$ l4 A
自动挂载:
/ b' R: x/ q/ R1 l" e5 U2 e- vi /etc/fstab
3 q1 ^+ F3 e: m - ( h3 I! n3 C3 e; _
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 04 @# h% X. M3 m5 f* B: P1 o D
- # D2 ]6 _$ P! t% K7 R
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
6 {! N4 i- s: z* X- mount /dev/sdb5 /mnt/ljp1; j& `4 q, U5 r% X* i
/ L, M( Y8 R* @: k$ V l! S6 o1 n- mount /dev/sdb6 /mnt/ljp2
复制代码
1 W j% a9 z$ D6 S! U* J( s$ C! ~5 u) @/ s7 q8 s
: N3 b( ^7 _/ O% _ |
|