|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)+ U7 W4 [. ?4 o4 k
or: fdisk /dev/sdc (for the third SCSI disk)
% m" J' x3 k% T ^ or: fdisk /dev/eda (for the first PS/2 ESDI drive)( X- U) H u( y# ]& p
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices) v: m9 l# ?% E6 L/ x( v
...
" A7 G+ h4 d2 h1 z- df -k
. O7 I! }9 G" x0 W% N% O - df -lh
- [2 I% P8 \% q4 | - 查看有几块硬盘:fdisk -l
; c+ f% t! n- o% r/ Z& x
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点: }4 J$ m5 C: Q* m/ K
/dev/sda3 3723848 705968 2828716 20% /& n0 F) u4 u0 M( f' P0 _0 K
/dev/sda1 101089 9274 86596 10% /boot
7 N8 i# i- Y+ [, r) x. V none 14520 0 14520 0% /dev/shm1 o2 O2 S1 u- l1 x
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用! ~! {9 W1 \# t+ v& D0 a! Y
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
* [ k+ z& y% U( p3 m Building a new DOS disklabel. Changes will remain in memory only,
9 o6 A. w, ?5 d# g8 O w+ J, u until you decide to write them. After that, of course, the previous
! p$ q$ \! j- J/ w& i content won't be recoverable.. w, a9 {0 s( l1 \
The number of cylinders for this disk is set to 8322.
0 [7 j1 ^& A# \" k- u5 g There is nothing wrong with that, but this is larger than 1024,1 q8 Z" A0 w2 a+ A2 k0 O) }
and could in certain setups cause problems with:: l. X& ^; z# T& E
1) software that runs at boot time (e.g., old versions of LILO)8 c% q( |9 R, Q& [$ Q
2) booting and partitioning software from other OSs
- \. E, l" Z1 E. T (e.g., DOS FDISK, OS/2 FDISK)
4 ^4 X4 Z; x1 p Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) H! I. b' _( {% }5 L
Command (m for help): p
0 B t0 @. b( g3 l1 t' h: K+ h Disk /dev/hda: 4294 MB, 4294967296 bytes3 y+ w5 m. j, x ]% q) f* T& x
16 heads, 63 sectors/track, 8322 cylinders
* x% R( y8 s+ B/ J9 R% p Units = cylinders of 1008 * 512 = 516096 bytes, k4 t5 \# H& H2 a" R. ^5 m
Device Boot Start End Blocks Id System) F3 n2 X) A) d0 |- }! j
Command (m for help): m: S/ J$ i% Q' r, _+ z& Q
Command action
% @& W) b6 i7 X7 h5 f% C a toggle a bootable flag" ^: B5 x( `8 S/ s/ U" g0 ]3 t
b edit bsd disklabel4 }4 b5 a4 _! f. \) Z
c toggle the dos compatibility flag
& G: M& m3 v m9 o8 U/ e d delete a partition Y1 v2 s- C8 }1 C: Y
l list known partition types# Q) r* t3 J( F0 O; t. \
m print this menu2 ~0 O1 E% A+ E* A9 A+ o% H' z
n add a new partition( }' U' {/ S# g: f: r& P4 G- y; ^1 i
o create a new empty DOS partition table
- R8 t& x& I% D* q W% A p print the partition table/ t3 Y- x7 L* H. A6 K
q quit without saving changes
, E/ s& j' u" s0 D o9 G s create a new empty Sun disklabel
5 u6 w6 O7 W. i) ^ t change a partition's system id8 F' e8 u; o- A! [% c4 X7 o8 {
u change display/entry units
! Z% }( L5 U) N/ x- y v verify the partition table! ?* o" @# T# H# s- C5 ?9 b9 J
w write table to disk and exit0 D; `" N' i T) o# x9 c2 A, A8 p
x extra functionality (experts only)
9 Q1 l# U) n" T) y7 G, a. Y o7 T Command (m for help): n
, c9 [7 Q, H }5 E Command action
4 A8 r. H1 D& I+ Y" u e extended
# J/ E% d! p3 z- m9 |- |$ u p primary partition (1-4)* {3 ]( _1 [. ^% E3 i
p
, N4 s, a0 \8 S' C' l' A& S Partition number (1-4): 1' v8 X9 b- Z$ m5 M8 H
First cylinder (1-8322, default 1):
# T% j; V+ }9 }" g7 O& z Using default value 1& }( d8 f8 G a8 D; Z1 G4 X3 e
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G5 P: p O, T3 x: z/ d/ y+ x9 S
Command (m for help): p
# G L' k+ D% h" u& c. q Disk /dev/hda: 4294 MB, 4294967296 bytes7 D8 p4 P" t! S7 d( ?, V8 A& X S
16 heads, 63 sectors/track, 8322 cylinders3 }. g3 X/ o( o5 v8 {8 B
Units = cylinders of 1008 * 512 = 516096 bytes" v6 k+ t% {# l( C* G
Device Boot Start End Blocks Id System
9 X; T, h: _: y5 p9 d /dev/hda1 1 1000 503968+ 83 Linux
1 v6 V7 o- w, }9 \" _8 r$ L f Command (m for help): w
6 h7 k4 q+ Z7 D% F" _) O8 ~ The partition table has been altered!6 Z9 C3 L; i+ o% _0 E$ l+ }
Calling ioctl() to re-read partition table.0 U5 ?- w# @( T4 b7 Y
Syncing disks.
) @# [0 A. t H2 h A' B9 p/ r, e //格式化新分区# _5 S3 e# [ `# b/ V
mke2fs 1.32 (09-Nov-2002)
; q& I0 W+ o' Y" C4 F Filesystem label=' w) v3 }6 j- [1 w1 I
OS type: Linux2 P& L. u" Y N6 ^3 F
Block size=1024 (log=0)
, X! B7 G7 F" @' \7 H Fragment size=1024 (log=0)
: i. Q; Q8 y* e% V2 w( N# L 126480 inodes, 503968 blocks
8 U; u& W( ~% p2 z. R O# [# ^' _# _4 d 25198 blocks (5.00%) reserved for the super user! N5 @, p5 D4 }# L
First data block=1
( i1 u5 v) F; m5 ~3 V" T" n2 i% A; \ 62 block groups
5 H6 p' E/ A2 S1 B( j 8192 blocks per group, 8192 fragments per group
* f" N+ _6 M' j0 E" Z 2040 inodes per group5 m1 I' {; t2 s! {& L% O
Superblock backups stored on blocks: ; o# i" E7 ]5 _1 G) c
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
5 b, `' Q/ b2 r C- n* T/ V' `# n* C1 ? Writing inode tables: done ! h$ W/ E2 ~+ p: K" ?) v
Creating journal (8192 blocks): done) |! O1 R* j/ I8 E$ k' L
Writing superblocks and filesystem accounting information: done" ]7 x' ^5 x2 J0 A
This filesystem will be automatically checked every 30 mounts or
3 y, n- y* {# t! r7 l 180 days, whichever comes first. Use tune2fs -c or -i to override.( Z9 G6 G% c9 X
文件系统 1K-块 已用 可用 已用% 挂载点3 }3 ]& P( Q, h
/dev/sda3 3723848 705992 2828692 20% /
- z" A% g1 Z4 b4 } /dev/sda1 101089 9274 86596 10% /boot
3 l4 o7 |' u: q' e none 14520 0 14520 0% /dev/shm2 d; Q% P" ~9 E, K$ V7 e
//挂上新分区
! I" _) ~7 l" M# p* n% Q% C- mount /dev/hda1 /home
5 Z# u3 W& c7 z7 H( k - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点: | U6 j. K, ?) q" J* |4 v
/dev/sda3 3723848 705992 2828692 20% / O2 M& F; j3 z& p6 d1 }' y8 D6 q
/dev/sda1 101089 9274 86596 10% /boot+ I* H) [" l& s# u! U: m
none 14520 0 14520 0% /dev/shm+ G0 n2 ^8 W# O! @( [! u$ X. o" F- B
/dev/hda1 488006 8239 454569 2% /home9 Q2 |# ~: J# Z H7 S" b
9 l: ^- C+ T& g# a8 ^, O( X自动挂载:6 c& o S" C4 q Y/ H
- vi /etc/fstab7 u3 l5 d' I6 T2 ~
- o5 h6 @& U2 e& [2 L" W6 K
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
9 D3 }8 ~; q# _7 Y6 p& { L
. Z, ~% b$ t" E- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
0 n* Z, l: w- o3 {2 V" G- mount /dev/sdb5 /mnt/ljp1* a4 |( l$ ?8 P- a# ~# I
- % \# y. J- n# q8 C# q; O1 Q
- mount /dev/sdb6 /mnt/ljp2
复制代码 - u7 ~* h3 D6 F" t% F
- W3 r% F+ x+ `9 _9 d- k6 d z Y' q( @: G. V; F
|
|