|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
3 Z% b2 C" y% ?* R; }0 c or: fdisk /dev/sdc (for the third SCSI disk)
8 X( u' F; k1 A7 N1 F* r or: fdisk /dev/eda (for the first PS/2 ESDI drive)8 L. a, l# @$ p/ K! Y% _
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
4 o: K; |! T5 A3 s3 h, z .... N) X |& G/ X& z
- df -k
9 H* N; g3 G. n - df -lh
$ Y: A2 v- x& r - 查看有几块硬盘:fdisk -l8 T' M( g) x4 e# L- h2 X6 B
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
" a: B% e) Q' y /dev/sda3 3723848 705968 2828716 20% /
- X; L) v, J+ I8 F /dev/sda1 101089 9274 86596 10% /boot$ {, z% e1 m8 l! o* q6 {3 h
none 14520 0 14520 0% /dev/shm
: Y- ~! _& p4 J 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用9 W# O/ j$ S2 [8 d |
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel0 t8 T: f3 T: H
Building a new DOS disklabel. Changes will remain in memory only,; y) x: [. z3 i3 x1 M3 v; Y6 I
until you decide to write them. After that, of course, the previous' i9 x$ @, b8 }8 H. @4 m! W9 o+ ~
content won't be recoverable.( j6 R2 U. {% Q' b" ?# F" c
The number of cylinders for this disk is set to 8322.
{# d$ [% H/ c/ _5 C/ j/ ~( } There is nothing wrong with that, but this is larger than 1024,( l5 E6 V) a; _+ @# X
and could in certain setups cause problems with:0 Q0 P5 u2 @1 i S
1) software that runs at boot time (e.g., old versions of LILO)
; E' M$ R! K& D1 \- {2 p: {' q/ t: O 2) booting and partitioning software from other OSs6 @% ~. u" Z9 F. z
(e.g., DOS FDISK, OS/2 FDISK) n% { |# C* }, J4 s% d- V3 }
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- G3 C1 ?+ Z( w: ^+ e5 n Command (m for help): p0 i* p- }% {- s. l. [% V
Disk /dev/hda: 4294 MB, 4294967296 bytes2 e/ z8 M2 {/ P8 D! p# M7 p8 Y
16 heads, 63 sectors/track, 8322 cylinders
: y- }9 b) i- U5 o Units = cylinders of 1008 * 512 = 516096 bytes$ i- ^ R3 \; x+ u& A3 f
Device Boot Start End Blocks Id System
+ M, a( i8 n1 U Command (m for help): m
+ k+ T' \! N3 [# {8 H7 h Command action. w% U0 p+ F$ n; M$ l6 @
a toggle a bootable flag. ^0 \2 {6 m& l, O8 c6 B- r
b edit bsd disklabel
+ A% l0 U9 p8 P. n c toggle the dos compatibility flag
, S U0 }; X. T' W# r d delete a partition/ K8 z! ^8 H! `! O2 c! X
l list known partition types
. ]" ~3 Y# O2 [: b/ @ m print this menu
$ I" @& q" u6 F n add a new partition
/ z- z& k2 U; q o create a new empty DOS partition table
. Q3 k7 F3 T& k# Q+ j p print the partition table
$ m; f2 B" q% A* @6 g4 U3 }* C8 b q quit without saving changes; ^: e5 q% x7 P# n! C5 L. f$ W
s create a new empty Sun disklabel4 \( A! i+ E* C: q3 r a9 l
t change a partition's system id) B8 Z' l9 k7 v1 b0 ~
u change display/entry units% A2 I( s o+ e
v verify the partition table4 S6 W/ ^9 u, g
w write table to disk and exit/ X: K) u$ N9 j
x extra functionality (experts only)) \) o2 a7 z+ K/ [* M: Y$ `" b5 L
Command (m for help): n
- l% B1 J# T! V& Q/ n Command action# j7 b& @& E, n
e extended
6 e3 H+ d/ U! g R p primary partition (1-4)
6 g5 H- {3 v+ N p, e- I0 j7 Q' V3 A$ D$ v. P2 y2 H$ @
Partition number (1-4): 19 k3 ~% y% F' s) k5 x: H& ~
First cylinder (1-8322, default 1):
/ p( f4 f$ l1 h+ K' I, r; x5 v7 L Using default value 1
) W' g8 C; x- ?9 z2 D- K" E6 U Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
1 q Y8 g5 d) F/ v& \# q9 E- ` Command (m for help): p# W) g" }+ z* w# W8 w
Disk /dev/hda: 4294 MB, 4294967296 bytes9 F( g: }. s4 G) u
16 heads, 63 sectors/track, 8322 cylinders9 j8 f6 T8 i) t; Y F
Units = cylinders of 1008 * 512 = 516096 bytes
6 i& W, K& x! A+ N Device Boot Start End Blocks Id System
* u) [" s* i+ D /dev/hda1 1 1000 503968+ 83 Linux
3 P" O' g" t- s+ T5 t# q Command (m for help): w
( T, |% A* y" e& a0 a6 \ The partition table has been altered!
4 X" v9 X" y0 T6 d/ o Calling ioctl() to re-read partition table.+ I) `7 X" V% q. ]5 t" c
Syncing disks.
" k* ^* v+ K/ n7 ~1 V: V //格式化新分区
- z! q7 A' M$ C& Mmke2fs 1.32 (09-Nov-2002)
. r7 |+ s8 g/ S8 f Filesystem label=: B2 w3 n# f$ x) c- k4 U
OS type: Linux
" i' s% x2 c- D6 G% W. O2 p Block size=1024 (log=0)& X5 Y1 N* s' G: K8 f, I
Fragment size=1024 (log=0)( T8 i: h$ `2 Z* Y2 j% u0 \
126480 inodes, 503968 blocks) Q0 M& [+ l5 D: V
25198 blocks (5.00%) reserved for the super user: X$ ^" x, b- C% x0 ]2 E) h
First data block=1, H- |" |* f N% {# l9 p3 ^6 g' J
62 block groups
, a9 F/ r" _) ~) H2 z 8192 blocks per group, 8192 fragments per group
, U# g5 A) n# G& Y2 @4 M4 K 2040 inodes per group
# s7 t/ q8 @- i B+ x0 i: D4 B Superblock backups stored on blocks:
! X( g/ K" E7 |9 v, l, a) R 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
: m& _' d& {# f* U Writing inode tables: done
6 _* I! c% I$ w6 M: S& |# h+ n Creating journal (8192 blocks): done0 r8 U7 F/ ]- v$ P! W7 _$ K+ x
Writing superblocks and filesystem accounting information: done) a$ ]6 F& V7 K. Z* c" M
This filesystem will be automatically checked every 30 mounts or' p6 ]7 Y( [. |1 J7 Z% x
180 days, whichever comes first. Use tune2fs -c or -i to override.
# t* } M3 |4 h. E& \0 a3 E. L文件系统 1K-块 已用 可用 已用% 挂载点
8 J C! [# Z4 [5 @5 \ /dev/sda3 3723848 705992 2828692 20% /
8 I, b* ^) R* R* F9 t P+ T /dev/sda1 101089 9274 86596 10% /boot, Y+ G, W% s: f+ j+ n6 o
none 14520 0 14520 0% /dev/shm
5 n' a# _ f0 X, T4 G //挂上新分区9 h" p( J& S$ n$ J- m
- mount /dev/hda1 /home
2 ?3 ], o! h7 i$ J: m, I - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
* p$ D; v1 U0 J /dev/sda3 3723848 705992 2828692 20% /
2 K3 j, V; g) X7 m/ [: E/ l! g /dev/sda1 101089 9274 86596 10% /boot' L0 c) Y8 `: ~( L( j8 {
none 14520 0 14520 0% /dev/shm) i/ k: z) A2 |$ g% w7 |) Q
/dev/hda1 488006 8239 454569 2% /home
% e- q8 ^! N% r$ f- [! n+ e- R' ^+ Z/ ?; q5 z
自动挂载:
3 ~. o9 E) F/ ?( Z- vi /etc/fstab Z* o! I5 d0 L5 ]$ Y5 B4 n
- f! x+ N- ^2 P- S2 W
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
2 _' R% @! C* S! A9 F% ]* Z - * v* _/ h8 c! w- L) E! j& }
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
4 `; ~4 ^8 }9 d) {" g- g- mount /dev/sdb5 /mnt/ljp1* x" M; Y. V; a3 [ S' B
- 6 Q# `6 s, z& Z- E( I' J
- mount /dev/sdb6 /mnt/ljp2
复制代码 1 B% s* H1 a! D0 p8 b& G
2 {, d. O: g# U5 K2 J3 ~
, n6 ]5 {+ ]9 T) a! x |
|