|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk), r, m d$ E$ d5 h) {7 S
or: fdisk /dev/sdc (for the third SCSI disk)! T) p; A) n4 t: M/ [2 O' n8 y
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
8 `1 ?4 \* I2 v9 R# Y6 @: @ or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)4 `3 W! L+ o0 _' { ?( Z4 O
...9 _& T) c2 k: D" r1 S0 j
- df -k3 O2 d! `/ D' e7 d/ r# a! a3 }& o9 f
- df -lh5 G* v9 `( c) h4 {+ f ^
- 查看有几块硬盘:fdisk -l8 ~4 j' U( I7 f8 L$ M7 E
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 u9 @: T |0 a: `$ j# B
/dev/sda3 3723848 705968 2828716 20% /
+ S9 D: L4 `4 X /dev/sda1 101089 9274 86596 10% /boot
0 }1 t& P; F: N, q Q, h none 14520 0 14520 0% /dev/shm+ f" A! G* P3 o$ S/ a- z
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
" b1 g7 E$ ?. ^) W6 EDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
6 F7 k |7 C3 k2 Q# \, z& \1 a4 E/ K Building a new DOS disklabel. Changes will remain in memory only,% k6 D7 F7 I0 U: n: X6 ]
until you decide to write them. After that, of course, the previous
2 f+ a& M+ |$ C& ^6 s( p& O1 E content won't be recoverable.! F7 s2 I& o/ I+ W+ u
The number of cylinders for this disk is set to 8322.
?0 D8 D {3 X5 M# P There is nothing wrong with that, but this is larger than 1024,1 k- o3 C6 }3 k% T6 Q4 p8 D1 O; |
and could in certain setups cause problems with:! i3 O. X) @2 S- F$ S9 s
1) software that runs at boot time (e.g., old versions of LILO)7 \' i: w: U( v9 P, S
2) booting and partitioning software from other OSs/ Y. |& M& Y. N5 z
(e.g., DOS FDISK, OS/2 FDISK)5 P3 E- D! P3 P" n
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)9 Y% o3 U* i$ W Q4 A9 p
Command (m for help): p9 E2 L! H [' H0 Q$ y
Disk /dev/hda: 4294 MB, 4294967296 bytes4 Q9 W1 m- d4 p
16 heads, 63 sectors/track, 8322 cylinders
6 I& m" F, G Q Units = cylinders of 1008 * 512 = 516096 bytes, \3 q2 d1 d8 S8 ]9 h% |
Device Boot Start End Blocks Id System
; k8 g/ a7 K. H3 C Command (m for help): m+ A7 Q s4 B, @1 ^
Command action
; P% V4 G) D7 u, p) C; {$ ^: e' G a toggle a bootable flag f7 m/ P/ ]+ q. ~4 e
b edit bsd disklabel9 \# v2 M5 }8 m/ _2 I) I& ?# _
c toggle the dos compatibility flag
+ c5 m+ A7 H+ F. | d delete a partition
) j- F8 a6 I- s- |' P' H l list known partition types) G, s/ _4 w6 S6 H. B0 y
m print this menu
K* u) e# U3 }2 ^2 G) J n add a new partition5 k7 B, i( Q3 _' a5 [5 M& ]; ~5 b
o create a new empty DOS partition table
1 X! J; m8 p4 ]3 W. [, F p print the partition table
: @ b0 t4 O7 ?8 H6 J$ q1 m q quit without saving changes2 } d# W3 l6 ]
s create a new empty Sun disklabel$ L- S) L9 A* k9 Y
t change a partition's system id
?0 s0 B& M( ~0 o n u change display/entry units1 S! E) j5 n* A/ _2 N: n
v verify the partition table* t0 u7 D6 L% s/ ~* y' s1 }9 z
w write table to disk and exit y: r! b: @5 L( c$ B0 r
x extra functionality (experts only)6 @ I. \0 Z' n O
Command (m for help): n& T1 O& c- j& ~
Command action* G# Y" b- Q) l! D. l9 y% X9 ^
e extended
) a" A1 Q+ `' s; O! G) F0 b) P& d) K! { p primary partition (1-4)
! Z, B3 o9 D s+ L- { p
; ^0 ]. Z/ b9 ]& P: m Partition number (1-4): 1
/ \% q; f. U7 r4 g First cylinder (1-8322, default 1): # I( f" _$ d3 k A* n
Using default value 1
1 ?5 h, O. o4 a0 s Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
$ j! f1 Y8 \+ Q: j# `* g! `; q Command (m for help): p
/ e, L+ ^, @( s6 N Disk /dev/hda: 4294 MB, 4294967296 bytes; | @ Q2 Q" o* [; P
16 heads, 63 sectors/track, 8322 cylinders8 p% p' s" `- ^
Units = cylinders of 1008 * 512 = 516096 bytes# k$ q& Y, K4 [3 V3 w% t
Device Boot Start End Blocks Id System2 S5 j0 }; S. w
/dev/hda1 1 1000 503968+ 83 Linux& W; R3 w4 N+ q
Command (m for help): w
0 p. ~5 s3 y3 T* t The partition table has been altered!
6 O" m" v- L" J' c Calling ioctl() to re-read partition table.
6 _* _& y1 I6 i3 v* j; V Syncing disks.% ?/ }8 I$ j3 I, j
//格式化新分区2 m5 [6 {9 M- J, X+ _
mke2fs 1.32 (09-Nov-2002)
% O* w7 l5 p$ y& N' ]9 P9 j6 ? Filesystem label=
" z. ?; M9 X$ C, q4 u$ Q OS type: Linux3 T) f+ s N* B9 k, C0 Y1 v0 P
Block size=1024 (log=0)
' [0 g; l0 W5 `6 @/ k: e Fragment size=1024 (log=0)
& f& _ u N$ s" G( i 126480 inodes, 503968 blocks
! g9 v. q( _' W" b2 Y0 M 25198 blocks (5.00%) reserved for the super user
3 c, O- m6 F; Z7 z& [ First data block=1* z* Z/ ~% ]3 C3 W& Y! M2 n# e
62 block groups
: U! {6 ~6 E7 A! A) t; x; P 8192 blocks per group, 8192 fragments per group/ m, @0 N/ E: U2 X* z8 x
2040 inodes per group1 `' i4 e' v5 A- ^; q7 ]6 m
Superblock backups stored on blocks:
4 q' d& o# i' O' R' V' H 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014099 w% Z( O; p& I
Writing inode tables: done
) n, _& L- E1 |! K* ^. }7 L Creating journal (8192 blocks): done
9 C9 a6 w( H4 k2 R. x3 X | Writing superblocks and filesystem accounting information: done+ u$ f2 m3 |/ b: r5 K, i$ _( o
This filesystem will be automatically checked every 30 mounts or
7 n6 u7 p$ c# c; j5 G 180 days, whichever comes first. Use tune2fs -c or -i to override.
% J$ H! o' N' m' G0 x5 F& B文件系统 1K-块 已用 可用 已用% 挂载点
$ R0 @ U. _4 X" f, b /dev/sda3 3723848 705992 2828692 20% /6 q1 j7 X9 I% k& j' T8 [
/dev/sda1 101089 9274 86596 10% /boot' x+ g& D; x8 n s! r) p
none 14520 0 14520 0% /dev/shm4 m1 T9 ~( k9 b: N. ?! Z6 X
//挂上新分区- l$ Q% n- V$ C( E; h( i. m
- mount /dev/hda1 /home# C/ w5 o% O4 j. r6 I* E+ ~
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
# l" d4 k8 f: ?: _- e8 r5 b /dev/sda3 3723848 705992 2828692 20% /
5 s8 w: b& v; W. n /dev/sda1 101089 9274 86596 10% /boot' T& i; k* O. W* a8 w/ ]
none 14520 0 14520 0% /dev/shm
, {3 E, \0 w: c) _) v /dev/hda1 488006 8239 454569 2% /home
/ l m- A) n' w$ [) J$ b0 \4 ?9 @+ g5 }1 ]7 R& d6 w6 W4 [& z n
自动挂载:
8 D* \+ q |( T1 P" l& E9 n* S- vi /etc/fstab
- i2 I/ u) g- t7 c
1 ~& S7 @/ r4 E @5 G' I5 z- u4 Q- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
# r# D' K! @5 H. k: x! X
4 u8 O! N& E/ X- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:- P# h; F. l' h
- mount /dev/sdb5 /mnt/ljp1" |: c4 K! k- P- s1 ^
- 2 a' N+ K% |5 @2 F
- mount /dev/sdb6 /mnt/ljp2
复制代码 . n# \3 ^! J& s# y5 D
8 q9 @3 m; ]8 ]0 Y* ~' X* R( U9 V
7 T* V8 f0 c0 V7 ^2 l |
|