|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)- G" I) z! o, [ E$ V) s& p4 Z
or: fdisk /dev/sdc (for the third SCSI disk)- T) o! E( U6 I2 V9 G: b# l) Y
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
3 ~8 y2 }2 O( h+ ?; s or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)6 G* j6 D, h/ N1 a# C3 @0 E: L( y
...
; a9 s/ R" D$ w* Z- df -k
6 d, v2 j* |2 i9 n8 G$ y* i2 j - df -lh3 d( h2 x! P$ U/ P) A0 D
- 查看有几块硬盘:fdisk -l$ L5 g+ D) k' d& Q5 f' O
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点4 g* c/ B, @& x9 h k, Z; n
/dev/sda3 3723848 705968 2828716 20% /& O7 t9 |# z. Q; X
/dev/sda1 101089 9274 86596 10% /boot
Z/ c$ N5 {; e none 14520 0 14520 0% /dev/shm
! y. l8 Y) L* g. i/ w 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
* t+ D7 W$ l) i& fDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
( d3 D/ B0 \! i Building a new DOS disklabel. Changes will remain in memory only,0 u1 r5 Y- c# u8 r) S
until you decide to write them. After that, of course, the previous6 i) Z" r1 D u7 C8 E$ r
content won't be recoverable.
- I1 }8 ^) a' p' h; p4 H0 Z6 F The number of cylinders for this disk is set to 8322.( ]# G' l# l' z8 h. G5 z
There is nothing wrong with that, but this is larger than 1024,% j2 v+ K9 Z$ @$ C1 ~9 l' ~! e2 B- W
and could in certain setups cause problems with:
q( }1 d1 K! D; N1 k+ I2 @ 1) software that runs at boot time (e.g., old versions of LILO)
u7 _* y- h7 N3 k6 @7 k 2) booting and partitioning software from other OSs
; i: ]* E' j8 u (e.g., DOS FDISK, OS/2 FDISK)8 r% p a1 n1 n/ q3 k/ ~: J. x
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite): E# }3 O8 ? V- w) `$ q0 q
Command (m for help): p, q; E4 ^" x0 b7 N
Disk /dev/hda: 4294 MB, 4294967296 bytes. F+ x" R! _" j8 U
16 heads, 63 sectors/track, 8322 cylinders
0 [- C6 ^. I; L# X Units = cylinders of 1008 * 512 = 516096 bytes
- Q; Z) r F& V. K3 F6 { Device Boot Start End Blocks Id System+ ?4 f3 z4 K0 p
Command (m for help): m
9 B8 S% d0 q5 S. E+ V$ K/ B Command action
8 H4 } n9 W. Z" W a toggle a bootable flag
" R% p4 q! ^! u g& n4 } b edit bsd disklabel
1 B5 s; i0 R! ?* e. ? c toggle the dos compatibility flag
7 }4 A" o) X3 K7 F. I' c d delete a partition
7 h( L+ U8 T8 X+ r. C3 W2 Y+ `, t l list known partition types
! W7 R" `. {: M7 p' ^9 T6 u; y m print this menu
+ h" O1 j" ~1 ? n add a new partition
7 z7 ^# I. c( C( y+ Q# X: G- o o create a new empty DOS partition table: Z* L2 v5 X4 W2 O) @, c
p print the partition table1 W* {/ t' A* F6 E
q quit without saving changes# K6 f# C9 \7 ?( d; ?
s create a new empty Sun disklabel6 V* h Y( i4 Z6 L0 [! ~
t change a partition's system id
' `" _9 j! a! d! G2 a u change display/entry units
* T- K1 P7 d: C" O" }8 V v verify the partition table
# o% C* s) {2 a9 E* B8 F { w write table to disk and exit2 p3 |. ~" C5 w0 K, O
x extra functionality (experts only)/ Y2 Z2 t# A+ q; W5 y
Command (m for help): n8 n3 b- q- v# X2 x6 Y- W0 V4 m/ h
Command action4 E' z" \! e7 X* H5 R- p4 ~ t7 R
e extended0 H+ e# k& B4 I5 a' ]8 N# e" W, `
p primary partition (1-4)( I# T2 W6 S7 n0 ^; v, ? v9 n
p
$ ?* ]+ Q; l# g6 d$ c3 H Partition number (1-4): 1
7 K+ j2 v/ w2 E7 E! L5 w First cylinder (1-8322, default 1): + A) P+ ?, G; Z+ D
Using default value 15 Z* k9 y* r3 u( f, A; a
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G) Y3 v' n+ d) s9 V/ f4 ~
Command (m for help): p
) A/ {) w7 V+ r- `5 g Disk /dev/hda: 4294 MB, 4294967296 bytes" t8 T7 N( m/ F1 H# s4 j
16 heads, 63 sectors/track, 8322 cylinders7 H6 K8 e! f1 W A
Units = cylinders of 1008 * 512 = 516096 bytes
% V+ U1 W+ Y D/ m" I* B Device Boot Start End Blocks Id System
1 c' F# l) G. S) p) z- x+ @0 c /dev/hda1 1 1000 503968+ 83 Linux8 Q: P: G+ |2 o- p6 f
Command (m for help): w
f6 N1 w2 q6 b" l The partition table has been altered!/ b3 F0 K7 ^" G4 M A( H% w
Calling ioctl() to re-read partition table.
. l8 i9 M, E' Z+ o( |) V9 F Syncing disks.
! i# W4 I- y# _ //格式化新分区: e* D" t: X' d, E3 R! n" ]" O
mke2fs 1.32 (09-Nov-2002)
: o# z: a- o% o, C' Z* g Filesystem label=
; u$ o7 Y: U4 @+ t* v+ j7 K; U9 V OS type: Linux+ v1 w: V! q# Q" }- W' {
Block size=1024 (log=0)2 r# }, z. v3 x& K5 j1 p
Fragment size=1024 (log=0)
0 ^+ M- s: S4 a, p: L ]$ x5 T 126480 inodes, 503968 blocks
" L& F2 ?% ` X/ b 25198 blocks (5.00%) reserved for the super user
7 P3 s& i: g0 O. ?7 v First data block=1
: i" c2 B- t' G 62 block groups
; x$ W1 b; k' J7 S. W6 W9 R 8192 blocks per group, 8192 fragments per group2 v b' A* M m) }
2040 inodes per group
8 ?: D) m/ U, `/ v+ C( _% | Superblock backups stored on blocks:
# J9 m# I D3 Y6 O' ?7 C6 Q$ M 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
6 m4 o+ o) d& k" j' v0 f" I u* Z Writing inode tables: done ( m/ n4 N0 c# v! _1 d6 h8 B: g
Creating journal (8192 blocks): done
# _/ s1 @ A+ ?9 T6 T* J2 Z Writing superblocks and filesystem accounting information: done
, E+ }. l& |- P u! f$ B/ \( @ This filesystem will be automatically checked every 30 mounts or4 a! N: Y1 x g9 @3 F& h: S$ A6 l+ [
180 days, whichever comes first. Use tune2fs -c or -i to override.
8 l. l1 L8 n, Y6 s4 D文件系统 1K-块 已用 可用 已用% 挂载点. C3 r+ X1 \- H1 E g, ?9 t* ]
/dev/sda3 3723848 705992 2828692 20% /: L9 z, M5 r/ r, G. U; T( p- ?
/dev/sda1 101089 9274 86596 10% /boot Y8 ^7 R/ D' N" U
none 14520 0 14520 0% /dev/shm& _$ I5 |$ o1 p2 u. o
//挂上新分区% {# m$ [( w4 R* L, U
- mount /dev/hda1 /home/ ^# o2 @3 Q I% K' D5 D" o
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点% g1 o8 t$ F! X( n
/dev/sda3 3723848 705992 2828692 20% /6 Z8 Y5 @4 a8 z/ f: m
/dev/sda1 101089 9274 86596 10% /boot
$ v! H+ x3 Q, V none 14520 0 14520 0% /dev/shm7 G# ~( f1 ?* d
/dev/hda1 488006 8239 454569 2% /home$ j6 q$ I% ^2 j9 U! l% Y
1 f! i) w7 W2 ?* c) _. d; `/ [
自动挂载:6 `- }) a& p# _7 o0 L; {4 {+ B
- vi /etc/fstab
. W+ P& [$ P. Z1 | G$ m% n, u0 \- H
+ t- n. ~) U% n$ w! }- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
+ g$ d% f, q! h. P# a! h3 t
& W8 g5 a( Y) i) }4 L3 n- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
' Y# A4 G5 M) l% ^% ]( l- mount /dev/sdb5 /mnt/ljp1+ @# l2 \) |( V
- ) {! G3 c9 P( }9 ]& |* `
- mount /dev/sdb6 /mnt/ljp2
复制代码
$ r+ v8 G6 L2 D" E" A0 `) a- ]. A3 F3 r
6 j' s' R, [/ s8 N @8 j9 _
|
|