|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
6 O! n9 S9 X' B1 }. e3 y; k) W" X or: fdisk /dev/sdc (for the third SCSI disk)! p7 R( X8 |7 @8 w
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
' i, |5 b* D; }6 r7 W2 E or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
+ X% s0 F+ v* \' t2 K" O7 ~1 ` ...
$ k5 `$ x8 g0 m! T6 O+ H: b- df -k
3 {9 _0 u. I/ T' z4 { - df -lh$ k/ @% v/ l3 _7 e. o
- 查看有几块硬盘:fdisk -l# Z5 @( T( b. W8 g' \
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) q* N# f& L' n6 i* h& T3 a1 H. H /dev/sda3 3723848 705968 2828716 20% /+ a. K4 ] g& ~. L- P F7 j/ H
/dev/sda1 101089 9274 86596 10% /boot' o. V' d# Y3 S$ _; \
none 14520 0 14520 0% /dev/shm' }1 B" h- \! G+ @$ H
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
; z. D$ ~# L! t& [# w. SDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
' ^$ v9 t' T" r7 X* N Building a new DOS disklabel. Changes will remain in memory only,
- R/ S; s( y' f8 @. D until you decide to write them. After that, of course, the previous
- z+ p- o- E7 t; S7 O content won't be recoverable.0 v4 ~6 M& n$ _' R
The number of cylinders for this disk is set to 8322.- Q5 a7 C) i8 p9 Y( C6 b3 z' U
There is nothing wrong with that, but this is larger than 1024,
& M5 s1 o* m; n r. n, r) i7 k and could in certain setups cause problems with:% f8 E$ w- S2 L; g
1) software that runs at boot time (e.g., old versions of LILO)
, @/ a+ F; ~2 q4 j6 R! f5 J8 U 2) booting and partitioning software from other OSs8 i$ q2 w3 N8 y9 M% s& e
(e.g., DOS FDISK, OS/2 FDISK)
0 M1 U, ?# |" n, E5 G B D Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
6 ]) M7 O" C8 k( B& K* m; _# ] Command (m for help): p
+ a4 g1 H% @ m. N& A Disk /dev/hda: 4294 MB, 4294967296 bytes$ v1 ]0 v: B' q% g& ~
16 heads, 63 sectors/track, 8322 cylinders* s( ~5 a! P$ ?' `; \
Units = cylinders of 1008 * 512 = 516096 bytes) P5 Y, _/ n' a9 i
Device Boot Start End Blocks Id System. @2 m: D6 W% d0 `
Command (m for help): m
8 v) J. Y1 x' n c/ U Command action
; N8 x. C" X( D a toggle a bootable flag
M: T+ U3 H9 T5 r; z% k b edit bsd disklabel7 [6 y+ Q7 i$ \: c5 o# k* b' f
c toggle the dos compatibility flag
- m- U9 q1 I) f; r d delete a partition
) K. ?- W3 _% I6 g+ ]2 y l list known partition types
3 y9 c1 ^ A2 o: D; ]- ] U9 Q m print this menu
' R8 B6 S5 p: _- C: {" X3 x1 M n add a new partition
* O+ a+ T2 Z, v) r o create a new empty DOS partition table. n+ u* `' V& R
p print the partition table6 R& ^- L/ B- a, ?( A
q quit without saving changes
2 w, I; ~% [) u5 A/ p9 f B( N8 m7 f s create a new empty Sun disklabel
/ ?: b/ k& R& s' W1 D t change a partition's system id
% t @$ G1 a/ o5 F7 ?$ d5 ^ u change display/entry units$ t5 U" y2 s( M
v verify the partition table
1 n7 D% m Q7 J5 H; r: C w write table to disk and exit6 Z! k6 ]6 ?4 |$ ~. H
x extra functionality (experts only)8 e1 `: n+ S2 m
Command (m for help): n
$ S! i6 X0 j( b- X0 {# x) x Command action
/ q$ j z$ N2 `) C9 s6 { e extended
: s! n" ^; O3 X9 u) W0 _ p primary partition (1-4)
* J& f c- d: ] q9 M p2 o8 C5 ?$ E3 c; Y: l- [. J5 t& l( Y
Partition number (1-4): 1
$ p. [4 P( A. }4 f! [ First cylinder (1-8322, default 1): - Z8 {6 ?3 J& S# D
Using default value 1
/ N' `( V5 t3 I5 S( t& V) i! F Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
; h, B9 N# M) b# z. S/ Y Command (m for help): p- a4 M) y/ T2 ?/ R+ ?
Disk /dev/hda: 4294 MB, 4294967296 bytes
7 v$ C2 I" Q: ?5 D0 m- \1 [ 16 heads, 63 sectors/track, 8322 cylinders; k8 t d/ @# x( ]- Q5 ^. [
Units = cylinders of 1008 * 512 = 516096 bytes/ s! D6 W" G* N/ B) [4 t
Device Boot Start End Blocks Id System
# s; b% s& v% ]& x% T. A /dev/hda1 1 1000 503968+ 83 Linux
$ D* x' T, ]# D Command (m for help): w5 ^1 G6 H" R) k+ U P: d+ o
The partition table has been altered!
& G% L% M0 _+ H Calling ioctl() to re-read partition table.
" ~! K: ]/ [4 ^; z$ }; ] Syncing disks.
, ^# a( _( h0 c //格式化新分区
! c$ R8 `" _0 g9 X0 Y- D& Smke2fs 1.32 (09-Nov-2002)
+ h9 j# L. j' e# b0 a6 |) P! Q Filesystem label=" I G+ i o1 _# y4 P
OS type: Linux
: r: i7 ~: q( y( p+ F# i; g1 m0 m Block size=1024 (log=0)% p3 _0 W g3 @0 S" g: ^
Fragment size=1024 (log=0)) M4 _8 {+ Q1 Q' D, U. X
126480 inodes, 503968 blocks
) p0 J2 U2 Y8 S5 ` 25198 blocks (5.00%) reserved for the super user* t, ~1 t- I7 z( Q2 o! W
First data block=1! R) f* y1 N' r" Z4 X1 \
62 block groups# k/ B( P7 l4 I/ X
8192 blocks per group, 8192 fragments per group" I3 c9 H1 n4 w3 n: |' c' X
2040 inodes per group
# b0 P4 r( `$ Y3 e: ^; e. G) a, I' S Superblock backups stored on blocks:
! @- B$ A0 \# j* K s- | 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
, M. l! i6 u$ }) j Writing inode tables: done 1 i" i% x0 s$ ~: p
Creating journal (8192 blocks): done
0 ^, r% v! \. t- w' Y; R' v Writing superblocks and filesystem accounting information: done
/ \( ~( f/ a( o! _" O This filesystem will be automatically checked every 30 mounts or/ k$ ]- F5 d) H/ a* {/ @& s
180 days, whichever comes first. Use tune2fs -c or -i to override.
, ^; ^0 E6 m$ e文件系统 1K-块 已用 可用 已用% 挂载点
2 K. `1 y! n. y5 i) o% N2 j' G /dev/sda3 3723848 705992 2828692 20% /
2 E9 W5 A- Z* U% b G N /dev/sda1 101089 9274 86596 10% /boot
- J6 k2 [9 w2 f4 i none 14520 0 14520 0% /dev/shm2 x A: E) D8 k5 @# Y# r% ?
//挂上新分区
- a g) D* ~, X f- mount /dev/hda1 /home# Q, ~% m( ]: c5 Y/ B& y5 X. Q; U
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点, f# V8 `3 T+ M0 @0 A8 {
/dev/sda3 3723848 705992 2828692 20% /
. ]& s( W5 H) H; I& S7 \# ] /dev/sda1 101089 9274 86596 10% /boot
7 K1 P7 a. X9 d( P/ ] none 14520 0 14520 0% /dev/shm" B7 t6 D8 K% V E2 `/ P
/dev/hda1 488006 8239 454569 2% /home
, C4 Q- ]: x3 Y( z' G( o2 i* N! O3 q# O7 h/ s) O
自动挂载:
1 d6 @( N9 O( _+ v. n3 E* q. N- vi /etc/fstab
- | ]4 }4 q4 {8 u, a$ d - 2 `' U1 z, ^7 H, }, J. r
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 00 Z$ h" d, j9 I) R4 v# l( O( {
% O$ E# |1 @0 U/ Q+ M; o5 ]- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:( w# ~3 |/ E2 i8 x8 f
- mount /dev/sdb5 /mnt/ljp1. G# e9 c1 j: l
- . w& d* e% ^! a- i5 c' z6 `" n/ v: Z
- mount /dev/sdb6 /mnt/ljp2
复制代码
0 k- R" V- i( J: \9 |
- d0 g+ {3 _' k* C) R h
9 F" J/ g8 R: s! n8 M% o |
|