|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
. Y3 _, m7 k5 _) s! ] or: fdisk /dev/sdc (for the third SCSI disk)
* l6 S9 b& e0 B, Z or: fdisk /dev/eda (for the first PS/2 ESDI drive)! R0 g s2 A% `% g2 m
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices); n- i2 L, u U6 \0 N% E
...
8 ]! w. Z- {, J9 y. _! c- df -k( R1 ^9 V2 u8 }+ T* V% {' {, z
- df -lh
- T% P% q+ c& B7 V% V3 Y, o6 \ - 查看有几块硬盘:fdisk -l
" Y0 k$ z) K' G0 ~0 j/ o
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 x8 s9 \( P2 B& R8 C
/dev/sda3 3723848 705968 2828716 20% / {5 Q5 X' }4 ~8 Z
/dev/sda1 101089 9274 86596 10% /boot
. \4 o8 p/ J4 O$ \% O none 14520 0 14520 0% /dev/shm
* A( z" U! h; c( v 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
/ t$ D/ @0 v+ f" IDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
1 }: H+ |* G5 d+ E. R Building a new DOS disklabel. Changes will remain in memory only,
" `6 t C! T8 ^* ~2 S5 h6 h' P, F until you decide to write them. After that, of course, the previous5 b. r5 v) |: s4 f/ ~
content won't be recoverable.6 L3 b8 y' R2 p C5 @3 z" O
The number of cylinders for this disk is set to 8322.( N$ [: b4 U9 M9 Y# }
There is nothing wrong with that, but this is larger than 1024,- G/ ~5 y# b, q& P
and could in certain setups cause problems with:
; A Y- C% ]7 O7 x/ M: y 1) software that runs at boot time (e.g., old versions of LILO)+ {8 K- m! P. V( a) o! S" q. N
2) booting and partitioning software from other OSs6 d4 p5 ?. Z) }; `( A9 \
(e.g., DOS FDISK, OS/2 FDISK)% M. Q) m7 b z- s G9 U
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)3 V- W$ r" D& j# I3 v
Command (m for help): p
6 S% S/ @. I/ ^% T3 u* V) A Disk /dev/hda: 4294 MB, 4294967296 bytes
# Q0 T4 Z) }" f! p 16 heads, 63 sectors/track, 8322 cylinders
1 l: K6 J# n: }% ?8 D0 T: S2 n Units = cylinders of 1008 * 512 = 516096 bytes
. U; W3 W: v) n4 N* u6 {/ C: a Device Boot Start End Blocks Id System
0 i6 f8 N2 N$ q' R8 K& w Command (m for help): m
c7 r3 c$ f6 G% C9 f8 [ Command action
6 p4 A5 p& J1 ?" L a toggle a bootable flag, O6 q8 ?- A: w5 Z
b edit bsd disklabel
7 J' e( z" Z7 `* C3 K. E8 n c toggle the dos compatibility flag
2 T9 W9 C' w- Z9 k: k( c0 `& b d delete a partition- J+ m. o* o5 J. L! |& s4 x
l list known partition types
6 F, P* d9 [! S9 _3 u m print this menu
3 o. w! j. ^& U. q3 j) V) G5 l2 v n add a new partition8 S7 {9 H3 f3 s( C8 W- R& k
o create a new empty DOS partition table* I4 E$ ]& Q4 j3 s3 |4 V/ o
p print the partition table5 `5 e) _& A% X$ ~5 X+ U
q quit without saving changes
) I. D( l& P' k; H0 U s create a new empty Sun disklabel% M7 ?% t( ^. z; L; U$ N/ U# a( a7 U
t change a partition's system id% H* e( c& O8 ?) X6 e& b8 ^
u change display/entry units0 ]1 s# `- |: |$ {% ?! B
v verify the partition table
2 T, ~( P! y8 B5 L w write table to disk and exit1 u/ _% Z: _) D( A) p' P i8 A# E
x extra functionality (experts only)% z, T( `* a0 P5 f" m
Command (m for help): n8 v4 ]% N7 x2 p( f
Command action q$ T$ m/ u+ a! c5 y5 g- A
e extended
/ k9 z2 F2 s$ @+ V% K5 \; p* O6 F, n p primary partition (1-4); F6 c5 x/ s y7 m
p- C+ j: i, j5 t; N
Partition number (1-4): 1
5 ~3 R/ z, O, D! a First cylinder (1-8322, default 1):
2 X, E; Q5 }: A& c' g; N. K( D Using default value 1
{' |4 U! H1 [* r. \- g% }$ v Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G# H7 Z8 m: h* A$ ?5 \
Command (m for help): p
3 \! N: t! f4 [5 M! k& ?' G5 | Disk /dev/hda: 4294 MB, 4294967296 bytes
/ X0 q; k3 ?) K2 r0 s m* D* c 16 heads, 63 sectors/track, 8322 cylinders, V6 k& U# R" Z# L. f9 o0 l
Units = cylinders of 1008 * 512 = 516096 bytes- q5 j; i+ H# o# [
Device Boot Start End Blocks Id System
Z: l2 {$ x7 r7 S: G /dev/hda1 1 1000 503968+ 83 Linux
$ F0 V# |# T3 D, u+ c8 } Command (m for help): w
) r( u9 a5 Y- J1 E/ N6 w% n/ @ The partition table has been altered!, i7 Q2 k5 n& v, G2 ]2 z
Calling ioctl() to re-read partition table.8 j3 D: _* }) J4 Z7 o
Syncing disks.5 K% g+ j1 E( c Y" |. O
//格式化新分区
; J Z) ]3 o$ k) ^; S" `/ e2 Wmke2fs 1.32 (09-Nov-2002)
' e8 c; R8 S9 f8 T+ K# m' g1 y Filesystem label=
7 q- o" J. j7 g3 U8 q8 ?$ Y0 S7 Q OS type: Linux
' v( w7 ?2 ` j; D/ v Block size=1024 (log=0)1 {5 j7 g$ F6 f. k5 u @5 S
Fragment size=1024 (log=0)
$ o1 [/ U7 M- w0 L& e: m( K 126480 inodes, 503968 blocks1 K$ Z5 ` `3 `2 Y
25198 blocks (5.00%) reserved for the super user/ {: Q( T u" X$ \, W" ~' u
First data block=14 G6 S: e7 p" T8 `* t* ?. U8 h
62 block groups
+ D q- h. F2 x: D8 J; }2 {8 Y: l 8192 blocks per group, 8192 fragments per group
: c4 N1 \3 |# H# i8 E3 ~( C 2040 inodes per group$ D. H* s6 ~5 C$ q, F
Superblock backups stored on blocks: ! j/ E% z/ O7 o1 o8 Q5 A" B% i6 }+ q2 \
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409& |1 o) w. Y+ x+ K: i; L m
Writing inode tables: done - g* R( j4 |( F' P( N
Creating journal (8192 blocks): done
9 l2 L. O4 e4 L: D! A& x Writing superblocks and filesystem accounting information: done1 d( a- P2 c9 {
This filesystem will be automatically checked every 30 mounts or
8 y1 R9 y2 {: V; i 180 days, whichever comes first. Use tune2fs -c or -i to override.
8 v5 \, w: s$ u7 p2 q8 |' y文件系统 1K-块 已用 可用 已用% 挂载点) W6 ?; F, f9 c8 N* Q
/dev/sda3 3723848 705992 2828692 20% /
/ Y( W y" B" D }/ i8 {; F6 j /dev/sda1 101089 9274 86596 10% /boot2 }% x! R+ {" M. e4 t( O
none 14520 0 14520 0% /dev/shm( \* \- `& @. Q S+ b# W
//挂上新分区& A+ a" @) u- p
- mount /dev/hda1 /home
. ?; [- w9 P; V o - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) |4 o3 M- ^" q" f$ _3 n- ? /dev/sda3 3723848 705992 2828692 20% /
3 R: T( p- `" X* n2 I /dev/sda1 101089 9274 86596 10% /boot
1 g& I. ~2 g2 j+ W3 Z none 14520 0 14520 0% /dev/shm# D: S* W% U, V1 ]' U; {
/dev/hda1 488006 8239 454569 2% /home- @6 u2 K- o" E& w# w% I# A" }% W! A, ~
. m: B/ P+ m1 j% q7 h2 G3 j& A
自动挂载: e# p8 r: @' ?. G! Z8 M. i' N
- vi /etc/fstab
# v8 l1 Q' r! I2 C2 I7 O - & ?8 K% p8 m( g: R
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
! C0 d8 X8 t3 u" t5 q9 b4 l% W - * Z) L, f+ O1 S* a# |( t4 B& K
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:! k( d: Z6 ^' L6 `, a; m' m% X: }
- mount /dev/sdb5 /mnt/ljp19 f* T: v y7 f3 O2 m) F0 l/ z+ a
$ ]9 [: r% k! E( Z5 w1 K- mount /dev/sdb6 /mnt/ljp2
复制代码
* J& o1 Q3 g5 ]) z6 y+ c7 G7 Q. Z
+ E2 s: \7 a$ y9 v* D. q2 ^3 f
|
|