|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)" r1 W0 [' n' C( e }" ^! S, M7 c
or: fdisk /dev/sdc (for the third SCSI disk)
' I) s' w; p2 N or: fdisk /dev/eda (for the first PS/2 ESDI drive)
, e; d3 K4 o5 _: T, n$ Z( M or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)0 {9 C F/ M! a% Z J6 m
...! `, h' S# L0 a K: }* d% i0 y
- df -k
0 z1 W; q% ^- b( m+ y4 {) B! ^ - df -lh0 f7 J, r# ?4 ?
- 查看有几块硬盘:fdisk -l
8 V* D% d( U- a3 A8 N3 @" X$ H) I0 E/ S
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点/ }7 ~. \4 [* O) p: ]+ e9 f& r4 |
/dev/sda3 3723848 705968 2828716 20% /& F2 }& F) M. Y+ Q4 u+ c* C
/dev/sda1 101089 9274 86596 10% /boot2 L& m3 A' X0 z) |2 K! }: b
none 14520 0 14520 0% /dev/shm
1 }, J9 v j r$ S) p+ D1 D 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
4 U. J- ~, D1 I/ Y/ Y$ S7 e8 KDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel) ^1 h, W7 q+ D I+ j+ a' c; E
Building a new DOS disklabel. Changes will remain in memory only,
6 @. B* W& j) }) e, T until you decide to write them. After that, of course, the previous
' P$ K& [" l* C9 o& O) a* z content won't be recoverable.9 w' N2 b7 J0 S( Y2 P! B7 B
The number of cylinders for this disk is set to 8322.- {6 i8 R3 g- G% v! A& [
There is nothing wrong with that, but this is larger than 1024,
5 {) w, K, z5 e! z# Y. {+ b* h* Q; V and could in certain setups cause problems with:
: m$ ]' Z4 B4 A k$ Q 1) software that runs at boot time (e.g., old versions of LILO)* R' m- K+ e$ y' ?6 j) ?5 ]
2) booting and partitioning software from other OSs
0 | h2 c1 P6 R7 X+ X" ~! F (e.g., DOS FDISK, OS/2 FDISK)0 a* n% j& Y9 m+ r6 U/ P
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)5 a9 z1 U, \4 g# Q2 N2 l
Command (m for help): p/ c- ^; R' r! m( |8 f4 M* ~0 l$ |0 D7 x
Disk /dev/hda: 4294 MB, 4294967296 bytes4 o% i5 r5 H4 m+ o. p- Y+ H
16 heads, 63 sectors/track, 8322 cylinders: B' j2 M$ L9 w& U& S1 l/ T
Units = cylinders of 1008 * 512 = 516096 bytes/ H# V, ^8 `- s0 Q7 A, Q
Device Boot Start End Blocks Id System. X. S7 ?& H( y! |' L6 Q
Command (m for help): m
4 U( u0 f J( G* w+ T& n Command action& ]! G" g2 b* N" ~
a toggle a bootable flag; H& t6 [( z% z% x
b edit bsd disklabel6 r. R' M3 c: k7 @2 }! V4 U0 `
c toggle the dos compatibility flag2 k# `& k# }7 j, f; E% m
d delete a partition# A4 {( Z2 {: R. {
l list known partition types$ {# u, h! \# i, U
m print this menu
$ _* k' X( D& d n add a new partition
6 i1 N3 S6 Y& O, K o create a new empty DOS partition table
( f R4 t9 c" }7 E2 N6 E5 y5 V1 E$ U p print the partition table
. y7 d: c; _' H3 s& J9 D0 u* R q quit without saving changes v/ e% X |+ C6 O* }& O+ C
s create a new empty Sun disklabel
/ `: J7 | G8 W" u t change a partition's system id5 N4 V; z' [; E g# H; X8 x0 H
u change display/entry units( ~ Z" Z* y+ S S# r# B* X3 @
v verify the partition table% X7 \; ^( ] M- f8 }5 m
w write table to disk and exit
. R# _% C3 m- h6 v8 g x extra functionality (experts only)
/ C1 i+ ]' Y) I# A7 }/ f Command (m for help): n" v# i( \5 o# p p" |
Command action
2 H2 ?& G6 y% [; a/ F e extended
- e7 B( N$ n/ Z$ d9 G p primary partition (1-4)6 C0 ?! o* w8 N2 h2 Z
p5 z3 ^/ R' o! C, p% u1 P0 S2 V; d: s- a
Partition number (1-4): 12 ]& r4 k1 w7 ^$ h6 @+ {' X
First cylinder (1-8322, default 1): % k3 b. o& [6 {2 @5 N& j: q: g
Using default value 14 I3 ~* n5 V* ^
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
' Z6 p( D+ c, k. A3 g% U Command (m for help): p
- g% C- E( f$ Y( j Disk /dev/hda: 4294 MB, 4294967296 bytes! V+ R6 Q: K. C
16 heads, 63 sectors/track, 8322 cylinders- ]+ u; a: \3 p" R+ H
Units = cylinders of 1008 * 512 = 516096 bytes
' }# g) Y) J+ i& s7 A Device Boot Start End Blocks Id System1 k, M5 l$ W# e
/dev/hda1 1 1000 503968+ 83 Linux
5 x. b3 T* F- P% d Command (m for help): w# U3 z. p W* S8 h. Z; ?
The partition table has been altered!' Y8 i1 r9 N' i# M, `
Calling ioctl() to re-read partition table.
' Z/ N l; o) [. G' t3 m, z0 c& I Syncing disks." T# g1 B6 P2 H, j
//格式化新分区
3 k0 C. L0 G. w. X9 dmke2fs 1.32 (09-Nov-2002)
( ~5 p0 O, o# o) O' ]' ]" ]* @ Filesystem label=
/ g! n7 a2 k* g1 U' S/ @! V+ f OS type: Linux# v2 d& n% C8 }" |
Block size=1024 (log=0)# H2 \& H( ~: t$ p/ E
Fragment size=1024 (log=0)) w* T) O- M3 z, m1 u0 h [% Z
126480 inodes, 503968 blocks
, f3 D# O0 r, U8 Y) e 25198 blocks (5.00%) reserved for the super user( D0 z8 @( \- ?5 m
First data block=1# L; E* M& z% \
62 block groups) H9 o" v( T4 {& ^& |; j) y4 }6 R' x/ A j
8192 blocks per group, 8192 fragments per group6 l4 C/ Z$ P- W7 ^4 W1 C" _
2040 inodes per group
) r* E1 M- a5 F8 d Superblock backups stored on blocks: # }5 R( p( Q, ~+ O1 H3 T
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
0 ]% m1 G7 C* d& Z4 X) c Writing inode tables: done 5 U2 |; s* v- X
Creating journal (8192 blocks): done
9 R1 _( \* y& m9 r( R Writing superblocks and filesystem accounting information: done) @) {; d$ }9 r* A
This filesystem will be automatically checked every 30 mounts or
! d/ m' {$ m+ A 180 days, whichever comes first. Use tune2fs -c or -i to override.
. B" }2 y! }2 i" V( {文件系统 1K-块 已用 可用 已用% 挂载点 e. X+ l4 G7 I
/dev/sda3 3723848 705992 2828692 20% /
4 y$ l& r: D6 n$ l& p# Q9 @ /dev/sda1 101089 9274 86596 10% /boot& e: k! j) T+ M
none 14520 0 14520 0% /dev/shm9 G# f$ X2 F ]
//挂上新分区8 |3 J; j1 V3 d8 q: l8 ]& C
- mount /dev/hda1 /home3 a0 W k5 z' b) Q! `3 m; T5 r6 h
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
3 V& {- _% }1 ?; [, i /dev/sda3 3723848 705992 2828692 20% /
" }8 o/ b2 O5 g* i# M /dev/sda1 101089 9274 86596 10% /boot- r2 |" _ ~5 `! R$ Y' B: X u c; b
none 14520 0 14520 0% /dev/shm
$ s" Z- k5 _( g+ `+ u) M! v, a /dev/hda1 488006 8239 454569 2% /home8 |8 j0 E% _( \1 o
, l: [# f0 Z& c: T$ u6 j
自动挂载:6 v4 h7 G- m4 C* e
- vi /etc/fstab
2 K8 ?2 z L/ k
+ }8 `- j) O" q7 N9 C- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
0 o; k# V% r; y/ e - ' |! p) A4 T# q2 T; b/ n
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
7 f% y! d/ A1 V; ~7 T6 V- mount /dev/sdb5 /mnt/ljp1. N5 t$ U2 T _) M, \
- # x+ C! r) x- H6 {3 a, ^ b
- mount /dev/sdb6 /mnt/ljp2
复制代码 ( h+ C3 b3 d1 e3 D- F
$ k+ q) A$ W( W) \8 ^
0 v7 P. z$ m" \ \6 D |
|