|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)4 U/ e9 R& I- V, t. y
or: fdisk /dev/sdc (for the third SCSI disk)
" P' m! C0 n& Y' X f/ v- E* J: U or: fdisk /dev/eda (for the first PS/2 ESDI drive)
) e) t: [& S/ X0 L( f or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
' \( B5 t8 J; q3 k2 p ...0 I; \4 k$ v7 e) |- U, [" m
- df -k6 e; j8 B2 H4 L6 P
- df -lh, U" }7 D5 j) H+ s
- 查看有几块硬盘:fdisk -l6 D2 U$ W1 \9 r7 X3 F# B6 r
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
3 D8 S' F5 r6 Z: z; s1 } /dev/sda3 3723848 705968 2828716 20% /
( ~) ?: I# S5 v2 ^! J8 h# Y /dev/sda1 101089 9274 86596 10% /boot' s. _: a2 \2 ^8 }6 I4 x. r3 x+ a
none 14520 0 14520 0% /dev/shm( @5 V+ k( e/ V# V
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用1 \+ u. a$ `; X: W& K
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
% j& P0 D2 C: M6 m2 M- @7 z. A Building a new DOS disklabel. Changes will remain in memory only,: K, E. a- N$ K5 a
until you decide to write them. After that, of course, the previous6 W4 K2 {3 \, v0 a$ M' P
content won't be recoverable.
4 Z7 ?7 h1 `5 O) B: a2 e% J/ P! y4 U The number of cylinders for this disk is set to 8322.
- @; o. B9 P8 ^6 P There is nothing wrong with that, but this is larger than 1024,; \% }7 s0 ~4 g U5 x+ w
and could in certain setups cause problems with:
, J. O* h# A# Z7 |1 i8 ? 1) software that runs at boot time (e.g., old versions of LILO)
' n' R% S& l1 f$ [/ T8 V" w+ n 2) booting and partitioning software from other OSs# I. ?7 c" E: K, N6 ~& A9 O
(e.g., DOS FDISK, OS/2 FDISK)+ _, T& N5 f- y* H6 S4 b
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite); F! `2 Z; i2 |" s, O
Command (m for help): p
( p& G# h7 j* X- {0 ^. W Disk /dev/hda: 4294 MB, 4294967296 bytes4 p9 W( ]; J% q3 H
16 heads, 63 sectors/track, 8322 cylinders% ]+ I7 ?7 G6 s, n( c
Units = cylinders of 1008 * 512 = 516096 bytes/ j1 z p- g' G% P
Device Boot Start End Blocks Id System
2 {$ u$ \$ h! x4 I4 J7 U Command (m for help): m b% O- s* m- ]$ x% _6 K
Command action' J$ l* E# j1 `8 b2 ~- V0 D
a toggle a bootable flag" [* L- @) H" D5 m
b edit bsd disklabel: ~2 p- ?$ M' |$ Q' Q# g2 m
c toggle the dos compatibility flag
9 t, l7 U8 g. J d delete a partition
5 E' q& `- S0 ], @ l list known partition types) n4 [3 q* e, P
m print this menu* Y8 v/ Y) E+ ]/ f' M
n add a new partition" x+ ^& f/ |. ]; Q0 e I
o create a new empty DOS partition table
% H% J! }# ]$ I: l h3 k2 R' G: A p print the partition table. F8 R% t3 t- m# o
q quit without saving changes
, j/ b+ @; c& y( @( ~: Q; M s create a new empty Sun disklabel& e( q, z4 I6 H! u( E
t change a partition's system id
0 E* ?4 d, F. F( F, ~% r) z" E u change display/entry units
7 V6 T. @! g0 f2 D7 U v verify the partition table
( h/ _9 p1 y5 @ u, ~ w write table to disk and exit
2 h x% G% s: V, o/ |4 ^( B" R& \ x extra functionality (experts only); |# Y' r6 L k2 X& G6 n
Command (m for help): n$ J v. s6 K- w( l$ c+ K* `4 I
Command action0 h& \9 {9 d( Y; @5 G- @
e extended
# s; D! d3 I/ _6 X& h [, e i p primary partition (1-4)4 \5 `' V8 U+ `% C |7 ^0 \
p9 K+ Z4 s1 m& p8 T2 L5 e
Partition number (1-4): 1
4 i* O$ M* @1 [ First cylinder (1-8322, default 1):
& Q8 \& c9 l5 i' f- j W Using default value 1
7 \5 Z) S$ }' B. u Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
, f" i3 g' g: o% U3 \* { Command (m for help): p
9 {4 ?! ?* O/ U+ q& i, H2 E Disk /dev/hda: 4294 MB, 4294967296 bytes( h( ^1 a) t1 O1 _1 {
16 heads, 63 sectors/track, 8322 cylinders2 Y) L8 i" E/ d z
Units = cylinders of 1008 * 512 = 516096 bytes2 N3 ]# U$ D8 m. _$ x
Device Boot Start End Blocks Id System! K: J4 w2 w, @$ [: d6 Z( ^: U
/dev/hda1 1 1000 503968+ 83 Linux
/ F* i; T, D9 n! m/ z" {9 Y% `. G Command (m for help): w
9 Y z. p4 r$ L! L The partition table has been altered!+ {- l- T1 Y+ l- d# ^$ ]2 T
Calling ioctl() to re-read partition table.
3 J' M; P, S: t8 C$ Q Syncing disks.
8 G3 h4 W" u: ^0 b/ Y //格式化新分区$ d B$ y, B2 P! e& s+ b* V& ]
mke2fs 1.32 (09-Nov-2002)" _& E0 J. j k! e
Filesystem label=9 R) K8 u' S" a/ n
OS type: Linux
+ a4 a8 g6 T- [ s A4 x3 P Block size=1024 (log=0). o) E- r; }6 ?: u% h2 a1 f
Fragment size=1024 (log=0)
v/ l U1 c% ?: y# T4 m 126480 inodes, 503968 blocks
1 `! j$ }' s5 [$ ~# }, h 25198 blocks (5.00%) reserved for the super user
) w9 f2 D1 F& P% S First data block=18 x# H" k2 D/ m+ o# A
62 block groups
8 P4 P& ?1 t; F# L: H 8192 blocks per group, 8192 fragments per group
3 F7 B( e8 d( E: L. ? 2040 inodes per group5 i! u5 d; `. @+ G# W
Superblock backups stored on blocks: 8 ~8 L2 y$ y5 P, \0 g; G
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409& Y6 [1 S3 N+ z/ w: X: E2 F# Y
Writing inode tables: done + l; h2 S/ o4 x. v; {! ]2 a
Creating journal (8192 blocks): done/ t# T" j8 w, }8 |% g: z+ n! I! \
Writing superblocks and filesystem accounting information: done
7 F+ p( ~8 _# T, [1 Y This filesystem will be automatically checked every 30 mounts or
, \- P$ M7 G ?; w5 M 180 days, whichever comes first. Use tune2fs -c or -i to override.
" i q4 K1 n* g3 K文件系统 1K-块 已用 可用 已用% 挂载点5 {" K! u( A' f6 ]! ^3 O. B
/dev/sda3 3723848 705992 2828692 20% /8 h9 ?9 o0 S( J: N* s: w
/dev/sda1 101089 9274 86596 10% /boot4 I: g+ ?" Y5 X& k/ t
none 14520 0 14520 0% /dev/shm
0 G% J7 s) ^& c' ~, y //挂上新分区' f8 U6 h$ b7 _$ x4 a7 z
- mount /dev/hda1 /home$ z& l, g5 L7 M" U g Y4 Z4 S
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点. |9 h. Z& S) y
/dev/sda3 3723848 705992 2828692 20% /
( Z# f% S9 S; K+ b: @ /dev/sda1 101089 9274 86596 10% /boot/ T2 [ f, @& s5 w1 j, S. y5 y
none 14520 0 14520 0% /dev/shm
/ q7 p4 @+ K) a0 y /dev/hda1 488006 8239 454569 2% /home5 ^% k& C( }! a( b, z7 |& C
& ~, Q' L% G6 p自动挂载:
! X2 f* u# M/ N- vi /etc/fstab
( W9 c# f' Z( J, b4 M5 U
* L9 q, X1 i. f- }9 d* \- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 08 J% x1 N, R$ [
- & \6 \2 G4 b% E/ ~6 V
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:! {% b; ^/ R. \3 |- w8 e
- mount /dev/sdb5 /mnt/ljp14 x R( [9 S8 a. @
; G2 G8 a/ ^. q' M+ p- mount /dev/sdb6 /mnt/ljp2
复制代码 ) R! ]1 v; u$ N% Y/ k) [* F
+ Q3 `! e6 m" ?) G1 X4 i
, T, Z- J! W& ?. Q |
|