|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)2 p6 @5 Y* \4 @+ | _- ]# K
or: fdisk /dev/sdc (for the third SCSI disk)1 } q2 {# G- f- C
or: fdisk /dev/eda (for the first PS/2 ESDI drive); h) f0 k8 \! _& ^- a" R
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
5 |! ]& j$ n2 J ...0 [$ d& L6 I, U+ g
- df -k7 G* O. h% W" y# _4 L
- df -lh) J5 Y7 c, u/ ^+ R; x3 K3 a% F* H! j" p
- 查看有几块硬盘:fdisk -l
$ ?" t1 F& m e- s% T9 J3 e& n* b
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点: L: J9 W6 f. v. ?
/dev/sda3 3723848 705968 2828716 20% /
0 C3 @) a& C4 } /dev/sda1 101089 9274 86596 10% /boot
8 k0 t, m+ Y" X: [! m none 14520 0 14520 0% /dev/shm, A- j( U7 ~) b. q
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用: r& e: I( n" d4 W) U
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel2 X# H4 b z: v+ q- O- `' c7 b
Building a new DOS disklabel. Changes will remain in memory only,
4 w" T: U3 z- b9 y8 ^ until you decide to write them. After that, of course, the previous! E* i; N) P+ k& V/ ]- r
content won't be recoverable.- q+ N: j! u3 @5 z5 p
The number of cylinders for this disk is set to 8322.7 f- J! p$ I5 s& {. ?
There is nothing wrong with that, but this is larger than 1024,
; v! q+ R6 ~$ D0 i and could in certain setups cause problems with:# ?7 K1 @' g3 p
1) software that runs at boot time (e.g., old versions of LILO)0 V A7 H4 ^) Y( s5 y
2) booting and partitioning software from other OSs& [, M6 s2 ?& u+ K3 O- i
(e.g., DOS FDISK, OS/2 FDISK)) H- |/ s0 w' a3 y! e# y+ w
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
* G* e( P4 s& m* `. t% Q/ V Command (m for help): p
* y w5 u' g, X; N3 k Disk /dev/hda: 4294 MB, 4294967296 bytes
, |9 Z5 l) |! t; q 16 heads, 63 sectors/track, 8322 cylinders, O; N7 P, B- S7 c8 Z8 r: e7 z
Units = cylinders of 1008 * 512 = 516096 bytes& T& n/ Z4 J: o% q( J7 v+ Z
Device Boot Start End Blocks Id System) d& J! q0 U$ E" m$ M- J. \
Command (m for help): m
7 f2 B% P' q1 J" r' y. w5 @ Command action( t5 D3 E4 M' J. ~% @( K- q
a toggle a bootable flag
% o) G2 h8 t+ H6 M, [, h b edit bsd disklabel
2 T0 x$ N) R. @2 h3 W c toggle the dos compatibility flag
- v6 H {+ _2 Y2 [ d delete a partition
( _6 }5 U% i& t5 I l list known partition types2 C/ B% F7 X% J8 b! ~
m print this menu
; p/ d3 C! f, z5 y n add a new partition- V! n+ q, g3 c' e% Y$ o L
o create a new empty DOS partition table7 [9 N3 v" a" f5 X/ a) ~: U3 ~
p print the partition table8 o N& V; D# o! ]6 [4 F% ~( w
q quit without saving changes
3 c1 G; J$ B8 w9 f4 D' n1 E. U s create a new empty Sun disklabel" B4 s2 h, H" Z4 F8 C" F* [
t change a partition's system id. N, g5 E5 \& y) U, D) r
u change display/entry units
8 {9 l; K/ b" m2 n/ G5 ~! x v verify the partition table
$ J. C; T$ B9 `+ {: Q w write table to disk and exit
- ~" y' l2 \9 K: S x extra functionality (experts only)
- [, n) Z6 p' q! o Command (m for help): n
, w5 R6 I3 {, O5 f; h7 U' h Command action
4 h5 |9 w. Z" ^ e extended0 `' `% Z% d" [! X$ j
p primary partition (1-4)
& F+ y6 ?6 i* D p0 I1 F$ w& N! v' ~' @
Partition number (1-4): 1
9 _/ w6 ]3 ^8 N9 `+ x First cylinder (1-8322, default 1):
6 N7 A( A/ k3 d) ^/ F Using default value 1. y) _6 v: y; W6 @2 G; ?1 _7 [
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
- `( ~% ?& Y6 q Command (m for help): p, h( p9 g T( |" ?" J
Disk /dev/hda: 4294 MB, 4294967296 bytes! K: W- p) B3 p: X
16 heads, 63 sectors/track, 8322 cylinders
+ r! T% H8 F* h) g% k Units = cylinders of 1008 * 512 = 516096 bytes' K( S9 m* M$ u
Device Boot Start End Blocks Id System
1 B% ]" ]2 ^1 ~" C7 A /dev/hda1 1 1000 503968+ 83 Linux( k/ S0 u6 S' P/ h
Command (m for help): w
( v' U) Z/ n0 g1 w! g' \ The partition table has been altered!
6 H5 `/ @/ T* S- x* C/ B B Calling ioctl() to re-read partition table.1 T3 b5 y: E! B7 ?( Y& l. X
Syncing disks.8 X4 ]1 g+ l* _ u+ ?, H
//格式化新分区4 M/ y, a) ]5 p& x, o# j
mke2fs 1.32 (09-Nov-2002)
3 @% [" ?8 @9 G4 n! p Filesystem label=" ?) y3 T4 }1 W( X+ k! W
OS type: Linux# P- N/ ~7 e; T" x
Block size=1024 (log=0)* t; ?& S' Z* c- ?$ Z1 J+ E
Fragment size=1024 (log=0)
' D$ X( V8 z& n/ u 126480 inodes, 503968 blocks, `; d8 H' Q( t/ T9 ^) X R
25198 blocks (5.00%) reserved for the super user
6 k' t/ ?; a* h3 c- ] ^ First data block=1
7 O* p& x4 C! f( b R3 a% E% S5 _ 62 block groups
; q+ B; h' j* ^' S" y 8192 blocks per group, 8192 fragments per group
2 ]& P. t9 h$ V- M# i8 q# k 2040 inodes per group
; c' L& C/ `( ~! }$ z& h Superblock backups stored on blocks:
* w& i$ n# l" o 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
, F, f1 l9 h7 a! u9 f) @ Writing inode tables: done : ]9 |. I/ X! w1 d
Creating journal (8192 blocks): done
( u! S) c. H8 B6 m {, a/ s Writing superblocks and filesystem accounting information: done
* m$ A+ M, Y+ p' I. ?4 C This filesystem will be automatically checked every 30 mounts or. q" q2 _# a* j7 s9 W
180 days, whichever comes first. Use tune2fs -c or -i to override." ~2 j( f+ ^5 o1 h. C/ F8 P" @, @* I
文件系统 1K-块 已用 可用 已用% 挂载点
/ K3 ? C( f& `: Z /dev/sda3 3723848 705992 2828692 20% /
. t5 X" H& H* w$ U$ x7 {0 R6 v /dev/sda1 101089 9274 86596 10% /boot
/ C, ~' l$ b2 Q! J. P+ y) W: k none 14520 0 14520 0% /dev/shm; u! A4 H1 J9 i
//挂上新分区
0 E; N) P* u1 i e- mount /dev/hda1 /home
$ |( d7 Q9 r9 j. e6 b* a: K - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
/ z% y1 O% O# @ C /dev/sda3 3723848 705992 2828692 20% /8 E$ N# h# l, j3 p3 _. l$ s
/dev/sda1 101089 9274 86596 10% /boot7 X/ k* H* J! J) C L. i
none 14520 0 14520 0% /dev/shm
% |/ |7 G: [& E+ c! S /dev/hda1 488006 8239 454569 2% /home8 p. p3 j; F- ?1 Z. Y5 h% V
' K. G8 [" O9 |
自动挂载:
# I- D+ W( g1 c+ D- vi /etc/fstab
/ Z& I5 N& |2 C
$ M& N1 J x/ _9 s) T- s% h2 D- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0! C# F5 u$ n4 y8 F5 }
, T5 t, ?6 _ q8 T H# ^- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
0 y8 T# H# ]2 H: v- mount /dev/sdb5 /mnt/ljp1
7 t3 m+ Z8 T; _
% R5 [, K, Y9 v( g F8 } b% {- mount /dev/sdb6 /mnt/ljp2
复制代码
* o" G% t/ l# v
. R Q0 @* d3 s( [: l) U* C
1 H5 t0 y! J1 _9 m2 d# p |
|