|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk); I5 O' {! w7 P" x% H! I( Q% A" T
or: fdisk /dev/sdc (for the third SCSI disk)8 G& \5 x r3 J1 O8 k5 l
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
3 p1 g$ J$ m- k, T7 n6 b or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)- x1 C- Q+ R/ L, c2 t# u8 Q! V+ B
...
' b1 |, r( U3 r. Q) i& z: G- df -k1 R3 W' u( ^8 ~5 B4 l
- df -lh
& {7 z0 ~) M' G- [) e - 查看有几块硬盘:fdisk -l7 z, }: H6 F$ t% Q
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 S/ H7 z* s/ h% e2 O: G* w0 {
/dev/sda3 3723848 705968 2828716 20% /$ f* E3 l: g K9 H/ E2 A' J3 Y" w
/dev/sda1 101089 9274 86596 10% /boot: M) _7 c# [5 @5 J
none 14520 0 14520 0% /dev/shm
, L2 P; e( o+ V 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用: g) E6 n+ C G; ]2 ^! S# c0 f
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel) _5 |; u; H1 N7 R% u N6 _2 Q
Building a new DOS disklabel. Changes will remain in memory only,
/ q) ^# k7 W9 }; {& C until you decide to write them. After that, of course, the previous& n+ _0 c' H9 ~. t3 U
content won't be recoverable.7 Y, ~ j1 y( A0 P% T$ L
The number of cylinders for this disk is set to 8322.
" k% S; _7 O& T" u+ N8 w1 h' r There is nothing wrong with that, but this is larger than 1024,
- p/ o2 X# o9 f4 B3 c3 X: I5 K and could in certain setups cause problems with:( n1 D. F. s3 c. [9 O% d2 ~
1) software that runs at boot time (e.g., old versions of LILO)
0 z+ o# f; n+ Q5 Z _& x 2) booting and partitioning software from other OSs" G* c- f0 Z+ ?/ r5 A
(e.g., DOS FDISK, OS/2 FDISK)
% z3 _8 j1 A' w6 K7 G: O Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
/ I3 C- h( _3 X% t* v4 d' l Command (m for help): p
D9 T4 I7 t7 e' f* ` Disk /dev/hda: 4294 MB, 4294967296 bytes
* I% \5 T) S) d3 I7 B0 t6 B 16 heads, 63 sectors/track, 8322 cylinders
8 j: S, }! s' c9 }' l7 O Units = cylinders of 1008 * 512 = 516096 bytes
8 e9 R+ A/ s2 J3 O Device Boot Start End Blocks Id System
! J3 v4 X$ m9 U- j* ?9 ~2 d Command (m for help): m
0 \6 v: Y# M# p" L; @) g/ n Command action
% H) N. ?' Q) V N/ S6 G a toggle a bootable flag/ U7 q7 Y+ x( C0 p: {8 W
b edit bsd disklabel
7 m8 w3 h D; g. r' w. a6 o3 i c toggle the dos compatibility flag
1 Y- U/ S* r$ V- W- _, L; \ d delete a partition( ?2 @3 ?# K0 z
l list known partition types
. ^" ?4 Q7 j; Q6 n5 k9 a m print this menu
$ Q+ ~1 }- R9 g( X9 ^* H8 C n add a new partition
5 g- `- i, X v8 G: _1 l* i o create a new empty DOS partition table: ^8 R6 \! d- W1 k7 S C: N3 }1 ]
p print the partition table
( R$ U, H: f# ~# ~; M" b( \ q quit without saving changes
* }; V4 B: _. _ s create a new empty Sun disklabel# I6 @' p0 e* ]4 n% w0 z
t change a partition's system id
% M" L8 G- W0 \2 V3 o/ t% }6 F u change display/entry units# M( p' u$ v; N2 x& S
v verify the partition table
- {# F& s% ^& w/ g# x9 R$ U w write table to disk and exit) o8 D: }% j2 h. V3 [4 F. g* L
x extra functionality (experts only), j* [0 y2 u+ {" ~; X7 q) B2 f6 c
Command (m for help): n
: y7 U5 `. Q: N& x9 u8 S1 d Command action, o/ ~) X3 C, t4 y0 E: _6 J5 `
e extended0 p# J5 d9 A! A3 F0 G9 h
p primary partition (1-4); I5 k6 g0 O% b, M. Q
p
( L% o8 C* c8 s: g, p& I* x Partition number (1-4): 1) L% i5 u% b6 y7 X7 W
First cylinder (1-8322, default 1): 0 F! [' m- C, ?' n0 h
Using default value 1, [: ~. f# U s' S8 j: q& i
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G( t9 L" e0 G1 |: ?
Command (m for help): p
V* O E/ e4 ?. t4 `. G. d Disk /dev/hda: 4294 MB, 4294967296 bytes
, `$ W2 v/ |& s: X8 n ?* y0 h 16 heads, 63 sectors/track, 8322 cylinders
$ `2 ^2 t4 M3 B& m9 f N Units = cylinders of 1008 * 512 = 516096 bytes4 F2 T+ O* k1 p. B$ f
Device Boot Start End Blocks Id System
3 C7 w- e7 S, g$ ` /dev/hda1 1 1000 503968+ 83 Linux# t% n' j5 u+ U0 A; y2 A, b& J
Command (m for help): w
! {0 K; r% F; k! j1 y The partition table has been altered!; f: T5 R6 B, \$ ~8 D
Calling ioctl() to re-read partition table.
+ N: t3 P9 K4 L2 C( _$ ]2 @ Syncing disks.( ~, \( m6 _6 k6 }- p! k
//格式化新分区& D$ ^ V/ J% Q z4 y
mke2fs 1.32 (09-Nov-2002)
* ]8 t- H- I* e3 j4 H8 I! n Filesystem label=7 w1 O! b, E& M& N+ R% i5 s: \+ }9 B
OS type: Linux
( z3 B( l$ E! B) T0 e1 Q. e Block size=1024 (log=0)* w0 X: `$ F( M" {* r! ^
Fragment size=1024 (log=0)
- b# W: M: i+ ], [, e 126480 inodes, 503968 blocks
# W# y% L/ ~# @ 25198 blocks (5.00%) reserved for the super user3 X, P! k- ^) `6 ?# \
First data block=1
. N7 i) j3 F9 ^2 D 62 block groups
" [5 c+ f9 j( o. g7 K" D4 Z5 O 8192 blocks per group, 8192 fragments per group
; I5 ]$ g6 U7 K1 R" B. n 2040 inodes per group) w: \" I8 g+ R* R: @! y3 v
Superblock backups stored on blocks:
9 q4 k, E) K( M. b 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
) q/ n1 z! L9 G8 r. Y4 N( I1 q Writing inode tables: done
+ i3 {' s0 y: V6 S$ Y8 ? Creating journal (8192 blocks): done: Q4 ]! ?% c0 r% P8 ^( \
Writing superblocks and filesystem accounting information: done! B" \ J6 E0 S; `- G" \, r7 N
This filesystem will be automatically checked every 30 mounts or% O5 l; J" k7 `& P, x; l
180 days, whichever comes first. Use tune2fs -c or -i to override.1 x/ X" [% S8 {1 L
文件系统 1K-块 已用 可用 已用% 挂载点
4 q- |$ y7 @0 Z, G4 I. d /dev/sda3 3723848 705992 2828692 20% /: x1 N: B# P u5 p' f0 {8 d& {
/dev/sda1 101089 9274 86596 10% /boot
3 }, C( x) J _ none 14520 0 14520 0% /dev/shm
+ q* D, @# K2 R1 S( m# x //挂上新分区
( ]9 s$ H5 `' s8 j- mount /dev/hda1 /home, t; o8 H# ?- y( v
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 `$ F6 Q& e+ o! g+ K
/dev/sda3 3723848 705992 2828692 20% /
n6 i0 c4 N+ U /dev/sda1 101089 9274 86596 10% /boot
+ n" I. s5 g3 I8 ? none 14520 0 14520 0% /dev/shm9 A' ~" q+ v$ {3 U
/dev/hda1 488006 8239 454569 2% /home
5 T) s6 s. `" x3 k1 z* p9 n9 M
5 B+ ?$ L1 L2 |+ ?, `自动挂载:
( i% }1 \. J2 |/ N8 ^8 D- vi /etc/fstab/ g- ^/ S) X, g3 ]
- 1 d, \( R* q9 J) z+ K" h
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
H% d4 z0 [" k7 h3 J4 A2 N7 ^' v. T - % n+ {. [, Q3 r' d+ }' Z0 D* J/ s
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:/ f+ x' P2 e( e% m5 s
- mount /dev/sdb5 /mnt/ljp1$ J$ |3 P+ O {) Y% b0 J! }1 t
7 g) V' h! Q' n- mount /dev/sdb6 /mnt/ljp2
复制代码
; u* g* c3 c0 N
2 F' A: `8 K3 W1 d/ {' z! ?7 J0 Q" s8 V5 {2 A
|
|