|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
9 N- H( n) Q) L or: fdisk /dev/sdc (for the third SCSI disk)% _6 ?0 ? H, a3 i: l0 c! n9 u1 o" Z
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
) u2 U: e' g: i9 r4 i or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices) ]' j+ a- j; @! R" g$ Y- ]
...
6 U3 L' ~5 X% Z. h$ G5 N1 d- df -k
% K& b9 G, B0 k - df -lh# Y3 q3 P3 |+ ]) l4 Y! x4 t
- 查看有几块硬盘:fdisk -l
8 @3 z) `: M: b, `4 N/ f
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点# A3 P& l; t2 C- d
/dev/sda3 3723848 705968 2828716 20% /$ `6 M* c6 k3 q+ i- J
/dev/sda1 101089 9274 86596 10% /boot
& ^0 y2 a' Z1 A6 }: j none 14520 0 14520 0% /dev/shm
m5 B/ t: u' I r) H" w 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
- z9 L }2 i) ^Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
+ J5 z4 J W' d Building a new DOS disklabel. Changes will remain in memory only,; [9 \% E! g* L6 I
until you decide to write them. After that, of course, the previous
# ~- \! h; _, c! n* N# w content won't be recoverable.
' X# c; W& b" W4 b, |9 N The number of cylinders for this disk is set to 8322.
0 n: s$ a8 r9 ]" Z5 o; w( O There is nothing wrong with that, but this is larger than 1024,' t2 B7 H" {" E8 f! H
and could in certain setups cause problems with:
3 j- R) s1 l6 g# t$ d 1) software that runs at boot time (e.g., old versions of LILO)
8 L/ t' F% o# l* B2 Q; z 2) booting and partitioning software from other OSs
( W% u3 V& H2 j, u5 @$ G (e.g., DOS FDISK, OS/2 FDISK)
J& X4 {6 r4 f9 [ Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
" L; l @1 H: k1 W$ g Command (m for help): p
4 i$ Y' x4 a: | Disk /dev/hda: 4294 MB, 4294967296 bytes
" f7 j! a1 F" q5 s 16 heads, 63 sectors/track, 8322 cylinders
' c1 p l6 Y* u# e. D' l T: W Units = cylinders of 1008 * 512 = 516096 bytes
; E2 E& Y) Q; b9 T Device Boot Start End Blocks Id System
& Z7 Z1 K3 a# {' j: t+ q Command (m for help): m
* R7 E% q3 O& y' y/ i6 l: N4 U6 h. @ Command action4 u& ~, `' A/ c) E7 u$ O$ x
a toggle a bootable flag
9 @* j/ s u/ l* Y! L% Z# f b edit bsd disklabel$ `3 J! v, C w1 t) L+ s3 o
c toggle the dos compatibility flag6 W, m9 D7 G, s+ u$ i# `# O$ Z' L
d delete a partition
& l R& |9 M5 j$ R l list known partition types5 I& x6 B8 R; p( y- l5 S
m print this menu5 |# i$ Z' a) o) y
n add a new partition
% L& A9 V C. z: L( j o create a new empty DOS partition table
: y' ]& B, h+ d2 G- e p print the partition table) O3 T0 z/ _6 c/ _8 d
q quit without saving changes' g1 @1 X% I8 ~7 r( A
s create a new empty Sun disklabel
9 V. c7 f3 G1 m6 W3 a( W t change a partition's system id
: o8 A( U( b" |- V" ?% r u change display/entry units
3 U3 J! v6 X$ f1 r* Q) j v verify the partition table( j i7 ~5 X$ U6 C y2 p& c
w write table to disk and exit$ ?$ O+ J9 l7 d2 B) `: D* R
x extra functionality (experts only)" w# g) U# k* a( I0 [
Command (m for help): n' s: B) a$ B$ j
Command action
% r! `6 h! t: G: i( J. E' D" W e extended- y* X8 }6 L- _0 Q
p primary partition (1-4)
+ ?+ W4 j) ?8 E* T p& k# @4 G. Z$ n$ g! p
Partition number (1-4): 12 q4 b* b. v8 d& H6 y- @/ ?; }( P
First cylinder (1-8322, default 1): / l: Z+ b. p6 A
Using default value 1
4 w" k. x1 A/ i6 X8 z7 u Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
0 V9 y' R9 [1 h. ^8 N p Command (m for help): p
! C" x) m& e* Y0 v, Y: V% r' ]/ ? Disk /dev/hda: 4294 MB, 4294967296 bytes
9 U9 r q: d3 O5 _ 16 heads, 63 sectors/track, 8322 cylinders
$ ]+ _8 u% @3 x' [* c) ? Units = cylinders of 1008 * 512 = 516096 bytes4 u6 C& n( C( `7 P9 w$ q
Device Boot Start End Blocks Id System
1 a+ x, e! Z$ `5 x9 i" G /dev/hda1 1 1000 503968+ 83 Linux1 V& ^+ C# S7 j# b% C
Command (m for help): w: a8 e* [' R! u1 F9 }3 v
The partition table has been altered!. J$ c4 x6 w3 \. l, ]% V$ D
Calling ioctl() to re-read partition table.
. S- Y. P- [- P; N# y Syncing disks.
% m, t( u: z2 q0 l% W) K! Q //格式化新分区! i; f( q2 A# l$ c [* r7 {" A
mke2fs 1.32 (09-Nov-2002)
) Y# [8 n( ^ O6 A, t# c Filesystem label=, ]" _ w. R( z! O6 L7 L
OS type: Linux6 P6 V5 D% a& {1 J8 g
Block size=1024 (log=0)! k( @8 @5 k- N9 k/ M
Fragment size=1024 (log=0)
`5 K: ^& F! {6 X, K4 G% g6 H 126480 inodes, 503968 blocks- z0 M# {% g5 c% Z7 ^& }' l$ z
25198 blocks (5.00%) reserved for the super user. J. C% u! T) P/ b- a, Z+ B9 h
First data block=1) v* S2 J5 } |
62 block groups! a( i3 R# o8 v7 m9 J& \
8192 blocks per group, 8192 fragments per group
$ [. i% h4 T8 H! A0 o" O 2040 inodes per group
* n2 y- w& c3 P/ y; @- J8 @ Superblock backups stored on blocks:
. V$ d; p' H; `' H5 _* L3 x" h 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014090 }* U) N6 U2 | P4 ]) J
Writing inode tables: done ! i- Z3 {2 r& d
Creating journal (8192 blocks): done
/ q' d, _0 O! Y, ^ Writing superblocks and filesystem accounting information: done
3 @# c8 d" b3 W/ g4 ? This filesystem will be automatically checked every 30 mounts or, R5 ?1 w0 |$ W) I9 O2 P$ Y% `
180 days, whichever comes first. Use tune2fs -c or -i to override.; }4 {! h! P- n0 w
文件系统 1K-块 已用 可用 已用% 挂载点
- ~+ i' c! Y+ V U4 ~5 U4 V0 ? /dev/sda3 3723848 705992 2828692 20% /
5 y {1 W% T1 R /dev/sda1 101089 9274 86596 10% /boot
4 B( q% |4 l* ? M/ T% j: C$ x, A$ N none 14520 0 14520 0% /dev/shm! |, _% ?: T: f# w' O
//挂上新分区' m V N5 {; G+ D& p, A
- mount /dev/hda1 /home0 C* S# j5 a8 r' p9 _( x' K# e& R
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点' v D' I4 z1 r4 T) S
/dev/sda3 3723848 705992 2828692 20% /
( t" ?, g! K% a3 l8 ]+ o /dev/sda1 101089 9274 86596 10% /boot
' O8 V/ m; L- T: x none 14520 0 14520 0% /dev/shm
" }+ } v& A9 p /dev/hda1 488006 8239 454569 2% /home
0 H: }4 |0 v/ E( P5 c. h$ W. u* N: c5 q8 ]# K1 {" p( A
自动挂载:
$ R I) t$ }, w% f/ c# s- vi /etc/fstab
* f. ]/ q q/ i5 p" R6 w. l
+ _/ `/ T- X) x2 P1 {7 u) v- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
/ i7 y1 F! |2 M) n, O - ! Q3 W# l1 ~! e9 V, V& w% t( G0 x% [
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:+ }" }+ u/ p" D
- mount /dev/sdb5 /mnt/ljp1 x( P! a* l/ W
- ! N% q, c0 H+ Z3 \
- mount /dev/sdb6 /mnt/ljp2
复制代码
) K1 \0 Y9 H c3 h
: H, B5 K; U0 V$ n1 f! |8 A) v
' u, d8 y+ d0 A% Y2 S, B) c( K- e |
|