|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)9 S1 Y9 U( R# D, X
or: fdisk /dev/sdc (for the third SCSI disk)9 T2 ?' ~3 D+ k3 w2 s
or: fdisk /dev/eda (for the first PS/2 ESDI drive)! V I# {* R$ L" ?& N5 L* w
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
3 {- ]6 k+ |- \' u' P8 d ...( @, B$ P0 A# _- f
- df -k: U4 M5 N2 L2 J7 V* O, L
- df -lh
6 ?6 `9 L, ~* \$ } - 查看有几块硬盘:fdisk -l
6 Y! _+ ]' H; u. `7 N* V! S- P4 n
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点2 i# v' [/ }% |( p
/dev/sda3 3723848 705968 2828716 20% /, ~. o3 C! Q5 V# ~8 |; A
/dev/sda1 101089 9274 86596 10% /boot
( U! c: x% A8 f4 G& l none 14520 0 14520 0% /dev/shm+ x, Z) _2 l/ {# t) D
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用9 \; D0 q7 ?4 X+ }# L
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
9 c; P# G3 ?' o Building a new DOS disklabel. Changes will remain in memory only,7 V a! s8 h- W
until you decide to write them. After that, of course, the previous
8 o$ a+ Y$ t! [8 Y content won't be recoverable.
% I k% e& w# |/ ?: G7 r The number of cylinders for this disk is set to 8322.: a% u' N, X3 H Z
There is nothing wrong with that, but this is larger than 1024,
$ o6 V8 l* M2 N, A+ a and could in certain setups cause problems with:
" ?7 o# `1 v# Z7 e6 C" t/ U 1) software that runs at boot time (e.g., old versions of LILO); L1 G$ }7 Q* N- ^: N3 O
2) booting and partitioning software from other OSs
. y0 M2 I* Y$ m0 p8 w ]0 ]. ~9 I (e.g., DOS FDISK, OS/2 FDISK)6 q" {2 k" U) N# l4 Q
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)! v ^, c* Z# l9 I( J
Command (m for help): p( a- P4 L4 S" Y1 r, u- T% W
Disk /dev/hda: 4294 MB, 4294967296 bytes+ f7 N8 K/ H, k2 y
16 heads, 63 sectors/track, 8322 cylinders
% c3 A' D/ u \) R6 k Units = cylinders of 1008 * 512 = 516096 bytes! ]1 \0 _0 ]1 G3 K v! U
Device Boot Start End Blocks Id System5 g: E, C* @- i8 y
Command (m for help): m
& Q; T. V% Z( K" o3 U Command action$ f- Z$ T& R/ R
a toggle a bootable flag
# b' e3 h9 o, K+ R% A h b edit bsd disklabel
& g9 U, t, d3 i c toggle the dos compatibility flag
* n: x! ^' S/ L d delete a partition4 f I7 k" c# w7 t
l list known partition types
0 M- Y7 j0 ?. T0 \: u% x5 s3 J5 _ m print this menu E% p* t$ q8 p J* t, U
n add a new partition
4 z- v# G( J6 R/ G6 G' Y9 l o create a new empty DOS partition table, x9 Z$ S/ c, Q: g6 R
p print the partition table3 O; |- d. G8 o# m2 A
q quit without saving changes
4 D" w' F6 O/ z0 w2 t s create a new empty Sun disklabel
9 f# {6 _; x0 j& A t change a partition's system id
7 {- a7 h5 _8 Q u change display/entry units
# w% Z& d% g9 j3 U2 G8 k' E v verify the partition table4 G, ], h8 O6 w- |6 Q( Y- v
w write table to disk and exit- U7 L/ e* k6 }" `7 }+ s
x extra functionality (experts only)' ^) l' [( i8 @/ q# c0 V. @- ]
Command (m for help): n
1 S8 ~( Y H' W9 P8 u" }& J* c+ W Command action6 ^" ~2 p. X+ f" z6 r1 Q
e extended' i2 m% r, i# W
p primary partition (1-4)" y, k6 \7 Q8 x8 r" W! o1 V
p6 y' }6 A2 x; j. Y
Partition number (1-4): 1
! A( J* `" B) ^5 |# m First cylinder (1-8322, default 1):
+ N! w( w6 o3 `! Y. H Using default value 1
( l6 M. [' T3 E1 Z: @8 z. S0 g Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G; g; I5 k% @4 o5 F
Command (m for help): p1 C6 Q( ?0 H i/ X* C/ e: k, B
Disk /dev/hda: 4294 MB, 4294967296 bytes
; {+ g3 [" M6 k3 i' q5 O 16 heads, 63 sectors/track, 8322 cylinders
0 E1 O- R* q, L* c+ ?4 f. d. ^( K Units = cylinders of 1008 * 512 = 516096 bytes' i. ^* F- B0 [5 ?; C
Device Boot Start End Blocks Id System8 Y& K9 d/ V# V. c2 K3 p
/dev/hda1 1 1000 503968+ 83 Linux
6 Q# n& e( M3 o' Q- B: f: q7 [ Command (m for help): w# x7 O' I1 y3 p2 q6 C5 {% ^- X
The partition table has been altered!
9 A P& v: R# l Calling ioctl() to re-read partition table.# l! \* k! ^7 B Q$ E# f0 ?
Syncing disks.
8 R& _% G# ]) P8 _ //格式化新分区
# m- f( `" m' @- r# gmke2fs 1.32 (09-Nov-2002)* U' o! ], i+ C+ T$ G
Filesystem label=% X( Q" D6 ~, u" M0 [% [8 U
OS type: Linux: m* B' B8 Q% v$ G
Block size=1024 (log=0)8 V7 Z. z/ d. k
Fragment size=1024 (log=0)0 z# i$ Y5 B0 L
126480 inodes, 503968 blocks8 n* M7 i6 O" `7 z0 |! q
25198 blocks (5.00%) reserved for the super user8 L4 B* T+ i/ H* j1 k
First data block=1
8 x9 N% t& w3 [9 {, X: ? 62 block groups
g9 C8 S- c9 e9 t 8192 blocks per group, 8192 fragments per group) |# ]# z, b5 {4 v5 I
2040 inodes per group
/ T+ i& i. J6 c j6 I5 T& J t Superblock backups stored on blocks:
* {; G- ]$ F/ }$ Y% X6 m8 Z8 O 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409' o2 v1 W6 _/ c5 k# w
Writing inode tables: done
$ S( H( |2 E7 E# X( Y, j Creating journal (8192 blocks): done) r7 `; R2 Z0 D
Writing superblocks and filesystem accounting information: done
/ L+ Y) N9 L+ v4 p1 a* _. s This filesystem will be automatically checked every 30 mounts or
" K; P r% w5 k' W8 U. c 180 days, whichever comes first. Use tune2fs -c or -i to override.7 u3 y9 t/ n, l
文件系统 1K-块 已用 可用 已用% 挂载点/ b( p7 Y/ D C Q
/dev/sda3 3723848 705992 2828692 20% /, c1 e5 ^& C k& _
/dev/sda1 101089 9274 86596 10% /boot
: M- y/ A' c( ]" H) u7 {8 g none 14520 0 14520 0% /dev/shm; n: W! T# D- l1 z1 U- C0 _" w5 t& |
//挂上新分区
$ _/ U; ^- ?$ A* A) Q: T J* o# Z- mount /dev/hda1 /home
) ~( Z9 t" b5 Y: n& w - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
9 ^* n3 A! v( v; |3 e* v /dev/sda3 3723848 705992 2828692 20% /
% j- Y' x2 I7 C9 J! d8 E$ p /dev/sda1 101089 9274 86596 10% /boot/ D) n, E* B0 w% o
none 14520 0 14520 0% /dev/shm" M% g0 ?7 F4 Q5 i8 a8 B
/dev/hda1 488006 8239 454569 2% /home* I/ y6 s) l* l4 p. E% V: Q
2 l4 w4 ^6 [6 c6 P/ B自动挂载:+ s+ C3 x3 N( h8 v( b
- vi /etc/fstab
+ Y: X% y: c- R3 ~' e
9 |: J+ X$ ?8 J- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
0 T* O T: }/ B - " J6 M- S) L& o) u. ~/ a
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:9 R6 ^/ l8 G7 o _" y. C j
- mount /dev/sdb5 /mnt/ljp1
9 C) V! k1 g7 Z" Q" @
& B- }8 {0 C1 ^5 X7 U3 b/ k- mount /dev/sdb6 /mnt/ljp2
复制代码 ( E2 F) X; ^! Y0 v. c$ c
- W- L! | J% D# Y" [/ b \
: u9 i" q) y" ]6 l" o/ ]! G |
|