|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
( L/ @4 i% N! N, V+ @ or: fdisk /dev/sdc (for the third SCSI disk), Z# P. p8 A5 W% n" `! @
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
( i% Z4 u/ u& s# E; X; B or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
6 }* u8 O. C& c ...( ?' _0 j& s$ W, \0 L* u
- df -k* G6 q6 \5 n) y3 U' u' r8 d1 k w
- df -lh ~- i1 O& Q7 n4 j9 D7 r& l3 o$ p
- 查看有几块硬盘:fdisk -l
, ^ l1 m$ O9 Q) J+ K' [
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
' A0 E, T* o, L5 w j6 u8 D& R /dev/sda3 3723848 705968 2828716 20% /, t# z! Z1 R& _ j8 E
/dev/sda1 101089 9274 86596 10% /boot
1 G! h! u5 l4 F, A5 p# s none 14520 0 14520 0% /dev/shm
. `, Z0 U- J. u3 J+ X9 f 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
! N1 l1 R0 z3 ^1 i( U' w( o; cDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
3 l4 z: d' U6 B o1 {, B Building a new DOS disklabel. Changes will remain in memory only,
1 @! a; ]4 n) U$ S until you decide to write them. After that, of course, the previous3 v$ t1 u: ^2 ?0 K
content won't be recoverable.3 _& h; h' t* w
The number of cylinders for this disk is set to 8322.
/ o, U- s& F% ?" P* a! M There is nothing wrong with that, but this is larger than 1024,
! c4 b) p6 a; m8 S2 _. F4 k and could in certain setups cause problems with:
* J3 [! @. ~! J& Y% a8 U2 V 1) software that runs at boot time (e.g., old versions of LILO)
6 [3 c s0 V6 K; R% b 2) booting and partitioning software from other OSs
& ~, w3 B; `; ` (e.g., DOS FDISK, OS/2 FDISK): h* Y( N i: G; _* G$ ]& x
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)( R g# \, |4 Q! t. c2 Y) y4 W0 V
Command (m for help): p$ j2 s3 a0 ]7 l. u+ @
Disk /dev/hda: 4294 MB, 4294967296 bytes$ Z* s1 r0 O" N( H6 p6 H C
16 heads, 63 sectors/track, 8322 cylinders
$ Q" d2 ] @% l8 U+ w2 Z- v+ n Units = cylinders of 1008 * 512 = 516096 bytes
( o2 y8 i+ t& |1 F( w0 e. r Device Boot Start End Blocks Id System+ g' R$ f i! A
Command (m for help): m* z$ g- e8 a9 K$ f6 V3 t5 k
Command action/ w: }- i/ b+ i# p7 {7 Y
a toggle a bootable flag
V7 J! w% J6 t9 R# _* V8 u% S b edit bsd disklabel
$ G# ^# o5 U. ^ F+ B! F5 R c toggle the dos compatibility flag
1 _3 T' B3 g% A: r d delete a partition
3 B5 D: l* |( I- z; U s8 l l list known partition types. I8 A! v- e) k' c
m print this menu4 W. W% f. Q& j7 O
n add a new partition( N7 i9 @3 A8 i
o create a new empty DOS partition table* x9 }' P9 F+ B* S: C* {. {
p print the partition table
8 e. A# ~6 t: S! t8 R e8 \0 ~7 o' f$ S q quit without saving changes+ X+ s7 s' P, ^# _% @
s create a new empty Sun disklabel3 m2 u- G& B2 I6 n
t change a partition's system id
# H) f: ^. x; F& f- l2 r u change display/entry units
0 }. U: Z" o* Q! g v verify the partition table$ C2 U- i& A% |# `
w write table to disk and exit
8 n6 t* t5 Q/ ?. k/ m2 H x extra functionality (experts only)/ @- k8 X6 c" R
Command (m for help): n/ Y; X2 P$ U4 }7 A$ }0 x
Command action0 P3 v0 S9 w8 b0 Q
e extended: @, Z# O3 O. Z; Q; U
p primary partition (1-4)6 D% _6 Y U% c% K
p5 Q! p# T; V3 ]- U/ Z2 W, O
Partition number (1-4): 13 p5 D5 u$ @# [9 _; F. [8 u7 L( C
First cylinder (1-8322, default 1):
6 h) f0 |9 o* f. a, U/ B# h# Q' q Using default value 1
5 c8 v! J6 t( H# p Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
$ t: u% }8 e5 ?. m; T5 T; K Command (m for help): p
1 W2 X# I- O/ O4 [ Disk /dev/hda: 4294 MB, 4294967296 bytes6 Y$ F3 I$ {, \; @; b: m- b- Q
16 heads, 63 sectors/track, 8322 cylinders% X) h$ T w3 a( [
Units = cylinders of 1008 * 512 = 516096 bytes
9 |/ D: S# g. V6 O3 A1 L Device Boot Start End Blocks Id System$ {; L2 m- _) q7 U
/dev/hda1 1 1000 503968+ 83 Linux
( i9 U+ R. f4 D* J( H Command (m for help): w! [2 V. d" q) S: Y: o" r1 l
The partition table has been altered!
: V, Z" k& M" G# o! x Calling ioctl() to re-read partition table.
5 Y* l. N |! {( ?, V Syncing disks.
" H9 }7 J; k; n! y* z+ M3 ~% I% g //格式化新分区+ V; I" s; s7 V
mke2fs 1.32 (09-Nov-2002)1 ~, k* V! M9 s7 s% N2 Y
Filesystem label=
: S/ R8 B9 [. M1 S OS type: Linux
3 s9 r" W8 n- u3 b Block size=1024 (log=0)
3 M1 B* C# B8 T* f' K7 d Fragment size=1024 (log=0)
& q+ h! W$ i' x! b' r 126480 inodes, 503968 blocks: `) V% j( _: m8 O/ f) _: C
25198 blocks (5.00%) reserved for the super user1 w, z- M2 h& c4 G. k' l" z- R; _
First data block=1! s4 e$ I) i9 l( A
62 block groups2 q: Y6 { Z" Q6 }- G7 @! o- ]
8192 blocks per group, 8192 fragments per group
1 D- f* k0 M4 z, P0 f7 o m% o9 h 2040 inodes per group3 X/ ]" {% o& }- c( I/ Q, ^8 Y
Superblock backups stored on blocks:
r, [9 \. R1 S4 j1 B$ ` 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
2 H% n' F3 K# y" S- n9 F Writing inode tables: done & S/ a* ~$ m5 |/ z/ ^' H
Creating journal (8192 blocks): done
+ j: i' j4 l& l6 L" ? Writing superblocks and filesystem accounting information: done
% y( O& t" h. D/ L This filesystem will be automatically checked every 30 mounts or
% V+ a4 J8 M k 180 days, whichever comes first. Use tune2fs -c or -i to override.0 M( q+ j1 {# v$ j8 g" d% ?
文件系统 1K-块 已用 可用 已用% 挂载点
. U; k* Z w7 O2 ?8 z /dev/sda3 3723848 705992 2828692 20% /
) z$ C7 {( \2 {8 i6 M /dev/sda1 101089 9274 86596 10% /boot
- L, m8 j( }& Z6 @- X6 f4 \ none 14520 0 14520 0% /dev/shm
' M" P; q5 v# [0 K9 ~1 D% u //挂上新分区' i8 X; W9 X6 x0 M" C2 ^, }6 N. V! E
- mount /dev/hda1 /home
* }' U. `8 U# r6 U7 W1 z9 b$ c - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点' O# J' D, H/ `
/dev/sda3 3723848 705992 2828692 20% /$ H$ D7 y9 a% H4 ~* K
/dev/sda1 101089 9274 86596 10% /boot8 ]) [/ S1 i3 H& j- b2 I3 f
none 14520 0 14520 0% /dev/shm
2 E* B* @; O( m6 Z( f /dev/hda1 488006 8239 454569 2% /home3 }' G" r! v0 w% h3 y
. A0 [3 W8 v+ h, a) S2 R
自动挂载:: K7 w& I" `, r2 t
- vi /etc/fstab
- p! W0 z% Z. ~$ S& h - 4 H, @! j3 R+ G4 W7 D5 `$ j* r
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
9 M0 Z8 Q/ \- A8 N+ _# A
) G0 x5 i$ }* o F# G% G" D( R) K i- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:2 X( Z" u$ ?/ n$ t C8 M
- mount /dev/sdb5 /mnt/ljp15 ~" ^! m& P3 I$ P* c9 ^- U: D. u
& A7 R9 t2 c0 @/ p& }, t1 O4 `- mount /dev/sdb6 /mnt/ljp2
复制代码 2 k3 K" v4 B& l" r/ f& }
E$ L0 n+ d" r% l, C+ Z% f
- f- ~ z9 o% K0 a! w; O5 }* s- G! I
|
|