|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk); W. u. @3 ?$ P6 A4 @# b
or: fdisk /dev/sdc (for the third SCSI disk)
) A3 X/ i* F- d, O or: fdisk /dev/eda (for the first PS/2 ESDI drive)
! t& P$ e3 K: R) d7 q6 @ or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)0 b& f, s/ ^) h w" d0 |8 s) p" I
..." O$ l9 z, U3 N' [, l
- df -k+ y9 Y6 O X* e. P
- df -lh
A, Z9 X+ B, a9 P0 o* Q& A - 查看有几块硬盘:fdisk -l7 E( @& j2 {' x0 Q2 |; D7 C/ S
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点7 m2 ]8 w3 ]7 @( }+ f- }3 N# ~
/dev/sda3 3723848 705968 2828716 20% /
& X [# V) l9 [- D$ w9 |4 | /dev/sda1 101089 9274 86596 10% /boot" u2 E( I0 P) Z. |: n
none 14520 0 14520 0% /dev/shm
0 l5 {+ w$ R F$ S 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用5 {( s7 R, O2 G+ _
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
! Q9 }: U6 ?" P, x Building a new DOS disklabel. Changes will remain in memory only,
- o2 r7 J k! v, ^) u2 k1 e until you decide to write them. After that, of course, the previous& p1 }( `9 g2 s, a+ f/ D- o# [
content won't be recoverable.% [6 k2 J B* p; v8 [
The number of cylinders for this disk is set to 8322.
' V* ?; r7 d: X$ a7 \ There is nothing wrong with that, but this is larger than 1024,
5 z# b5 H6 ]: J0 F1 _ n: @- k- l and could in certain setups cause problems with:7 S! G* [, }# C. U
1) software that runs at boot time (e.g., old versions of LILO)
, Q# }! |" W% @" o 2) booting and partitioning software from other OSs
3 q: F$ ^' Q$ p) K; M, ~7 W7 ^ (e.g., DOS FDISK, OS/2 FDISK)
6 B5 Y1 a% S. m4 T Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
2 V9 C# {5 L4 K& [. ^+ z Command (m for help): p
0 n% }0 E! ]2 @5 z: o# \ Disk /dev/hda: 4294 MB, 4294967296 bytes; s) Y: R ~' F: m" k% L l
16 heads, 63 sectors/track, 8322 cylinders9 v6 H& o" x" T- M' @5 X0 u! h! i
Units = cylinders of 1008 * 512 = 516096 bytes
8 m$ _' X% l; a4 W1 G v Device Boot Start End Blocks Id System8 D$ E# E0 t3 R2 J% l& L
Command (m for help): m3 R3 M( U9 u+ f7 n3 J( W `5 | @
Command action
" S6 C1 _' H, g+ h* j) k a toggle a bootable flag3 o/ }) l! C2 B: P h8 J, u
b edit bsd disklabel
. t" C/ U- |) m* e! g% } c toggle the dos compatibility flag
* a: A, ?4 G Y d delete a partition# V4 o& v- J, ?0 e4 `
l list known partition types
0 N6 s& L% O+ O. A" @ m print this menu% e$ A5 p) ?+ l8 Z
n add a new partition; A" g% B% u% K: e$ j: U
o create a new empty DOS partition table
6 Q" P: ?; }+ E& ?" [/ o' ? p print the partition table
) n+ p7 H! F+ Y. j q quit without saving changes
9 ~2 u5 d9 T3 X6 Z. I+ C/ |- `/ O x s create a new empty Sun disklabel/ V# j, x) r0 \- c: m3 u2 v
t change a partition's system id7 C9 y4 V% a1 G G# z
u change display/entry units2 @( a: ?5 o! D w! R& H& {( X
v verify the partition table5 q% v/ S, B% p7 {) M. f; P
w write table to disk and exit
; A$ H+ m9 Y3 ` y# Q6 X$ H x extra functionality (experts only)
* q, V: J/ z7 D! k' f Command (m for help): n8 H; D/ j$ {0 Q: g
Command action
# e, q; \( w' E e extended
0 M/ |2 }/ D/ I( J* X. U7 }+ | p primary partition (1-4)
, Z- i! ?0 l5 ]0 t; W9 g' D p
6 ^7 c8 ?! p' H Partition number (1-4): 1
6 m3 n |- Z# U8 S% a9 Q% y' c First cylinder (1-8322, default 1):
0 i) n0 r6 G# X4 i0 x) ` Using default value 1- g/ c2 S+ i% n G! }- m
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G: Y8 {/ m+ A0 N+ _) |
Command (m for help): p
& u# c. C+ ^2 R1 G# z) P Disk /dev/hda: 4294 MB, 4294967296 bytes5 v! p5 I+ Z3 h3 a8 d5 r( n9 y" ?: d
16 heads, 63 sectors/track, 8322 cylinders
2 z- r, J7 k3 z' S) Q& X Units = cylinders of 1008 * 512 = 516096 bytes
) B& F& e9 a v) U6 \0 V Device Boot Start End Blocks Id System) ?" b5 U1 B# J; X" _# }
/dev/hda1 1 1000 503968+ 83 Linux: V- }3 ^$ V/ v$ x6 i
Command (m for help): w) ?( T* ~! a, v# H) K: H$ x" ]
The partition table has been altered!
& f" x% V- x2 y! t% X4 e Calling ioctl() to re-read partition table.
6 x& O% `9 g2 A; T( o2 w s Syncing disks.
3 r: @: P5 q$ q- W5 z# _ //格式化新分区
2 E) p9 f# C' Q# Y) a9 Gmke2fs 1.32 (09-Nov-2002)
( t6 T1 J# W9 h; v$ ` Filesystem label=
3 E A" T6 n5 U) T OS type: Linux4 ]' }' Z) B$ A
Block size=1024 (log=0). B) t. m# O6 B' n
Fragment size=1024 (log=0)
/ U0 K' L5 d1 o3 k/ u3 W 126480 inodes, 503968 blocks( S- N7 n6 Q Q2 J
25198 blocks (5.00%) reserved for the super user
" W" }) s! L" r3 Y) B( } First data block=1
# B( e3 H& E* p& y6 |8 e 62 block groups3 V- A+ g% X6 Q! B
8192 blocks per group, 8192 fragments per group. @/ r1 F+ z4 N$ s/ b% i# p! C
2040 inodes per group
/ y0 |3 K; ?( L9 U( h; e( D# f' S Superblock backups stored on blocks:
$ H* F0 T0 o$ j4 E8 k: v/ } 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
9 {" \' g) V# a# n/ v/ g A Writing inode tables: done 1 M3 I& R+ i; S' @9 d- [
Creating journal (8192 blocks): done$ O6 w6 [; U/ U) m2 V# {/ I
Writing superblocks and filesystem accounting information: done; `) s1 }" E: T/ {" s: H3 k
This filesystem will be automatically checked every 30 mounts or' v+ j. m5 W9 k# C8 t5 W
180 days, whichever comes first. Use tune2fs -c or -i to override.7 }9 q0 J2 G! m- c
文件系统 1K-块 已用 可用 已用% 挂载点
& u2 |- _ ~/ J3 |; C; v( `4 f /dev/sda3 3723848 705992 2828692 20% /
3 {1 a/ `. O) j; b; n/ N) C /dev/sda1 101089 9274 86596 10% /boot: N' g* \1 d$ f& _' j0 F
none 14520 0 14520 0% /dev/shm0 H* I9 P& ^' z4 j/ T- }
//挂上新分区0 r* ~# M% W. n; U9 a$ T" g/ E
- mount /dev/hda1 /home
|+ |' h5 z: S! y - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点1 ^) q( d% ~7 s4 H/ H
/dev/sda3 3723848 705992 2828692 20% /$ V- B4 n3 G3 V; J) Q
/dev/sda1 101089 9274 86596 10% /boot; s! u# r- y2 j# p
none 14520 0 14520 0% /dev/shm
$ U* v9 P' a5 M. [. C+ l' Z /dev/hda1 488006 8239 454569 2% /home D: M6 x. [6 y
6 K' j& b, q% j8 o6 n. n9 y
自动挂载: l% m" M8 b& z$ D
- vi /etc/fstab2 J5 f: w9 }! R0 `
8 `2 K( F. z3 }( w+ x- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 03 Y7 g# U' e8 _" f
- ) Y% E- |3 g( U1 I" E# y+ K. \
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
- s5 ?$ g% J9 K# ^6 g( f5 r' a- mount /dev/sdb5 /mnt/ljp1/ d% z! u1 s* c9 _( s$ E
- 1 _* _7 i4 ?+ R" @
- mount /dev/sdb6 /mnt/ljp2
复制代码
! I! A O0 c7 M, U" a
) h/ G. [1 @$ P$ D. ^/ R) i) E% ]' s, ]5 |: Q
|
|