|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)9 ^ Q ~& {( f
or: fdisk /dev/sdc (for the third SCSI disk)( l9 [! p* b# X2 }$ n
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
4 I2 i3 N3 x* F. \: l/ A or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)2 P: X" q- C {
...4 [9 h' u8 `, H/ z4 r% A
- df -k! J6 H/ s$ \3 ~4 {
- df -lh% }' ?7 K* `0 g
- 查看有几块硬盘:fdisk -l
1 ^. [- T* R& q& d8 ^ X
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点3 ~) T: W( Z" E$ X. r
/dev/sda3 3723848 705968 2828716 20% /$ d( W; d. S* c
/dev/sda1 101089 9274 86596 10% /boot7 n: ^0 G, ^' L, T9 S7 |
none 14520 0 14520 0% /dev/shm( j0 X) I# d8 i# x9 j2 p4 s8 a4 U" _) E4 N F
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
, ~1 ?0 o/ O, U1 m; DDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
# L( w5 `9 p1 L Building a new DOS disklabel. Changes will remain in memory only,
) _8 C/ D! x1 {, E) S until you decide to write them. After that, of course, the previous, w0 J4 L+ v! v- |
content won't be recoverable.
( ?5 S. ~; Z9 e7 H: l The number of cylinders for this disk is set to 8322.
" q8 m3 H y1 h8 y" z; L3 z There is nothing wrong with that, but this is larger than 1024,& D5 K1 t- H) b1 ~/ F/ ?7 A* Z# ~
and could in certain setups cause problems with:+ @( _5 e& c: l" d [, b
1) software that runs at boot time (e.g., old versions of LILO)
' M: L1 z3 W+ @1 _ 2) booting and partitioning software from other OSs
& I+ r1 [) Q: n! f (e.g., DOS FDISK, OS/2 FDISK)
: k- r9 S& M# D2 A2 u5 R Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
* S4 f! y v# c9 P1 Z% V Command (m for help): p7 E/ y2 a6 X+ j7 B& A7 V# v% f& U
Disk /dev/hda: 4294 MB, 4294967296 bytes
. e# M& Y' e( J4 b# o7 y 16 heads, 63 sectors/track, 8322 cylinders
; u: G, y0 F" N" E2 N' A Units = cylinders of 1008 * 512 = 516096 bytes
) k; B9 q5 M- p; X$ i6 Y( ? Device Boot Start End Blocks Id System; X4 M! n. b7 ?) W! a4 q: b) u0 U
Command (m for help): m- @/ i' g3 r- h! B
Command action0 J! ]4 q% f7 j# m
a toggle a bootable flag
( N! d5 }+ z6 B: v+ n* }0 J b edit bsd disklabel9 m/ u6 p9 p* j) Q7 n
c toggle the dos compatibility flag! j2 D h" v) ?0 \ U5 Y
d delete a partition) E" P, a3 G8 {" a5 W" U! c, p
l list known partition types" o/ q H- o4 R7 q
m print this menu
4 T- w8 |6 V4 B* b& K: P1 x5 _ n add a new partition
2 g7 \$ b$ k: [8 k o create a new empty DOS partition table
* G, R6 u m# p# W/ [# J8 E1 \ p print the partition table) z5 @$ f! ~/ t ?7 D5 E0 z/ G
q quit without saving changes
% {3 o6 o7 u$ I- Z0 M" ?7 u- o s create a new empty Sun disklabel' O# P( d8 S/ }4 b3 @' ^2 ]1 r: a
t change a partition's system id
) A/ V" A$ b+ ~% `' M( h- ^ u change display/entry units
( k/ b8 ?; {6 C2 }) r4 N4 r% m5 ~ v verify the partition table
' _6 z5 o2 p4 W; m w write table to disk and exit+ \1 Y, s- m5 h4 K q' ~
x extra functionality (experts only)$ c1 P" P0 h. d+ G; ?, e: |0 P
Command (m for help): n/ G" S0 f+ Y! R: @& ?1 d! b' o
Command action
- H: O3 j! ]- C0 N/ D e extended; k& l, S( t6 `5 H2 P9 ]
p primary partition (1-4), c! i6 X, L5 x) b; Z
p8 T) P+ y$ b. `2 }* G- ]
Partition number (1-4): 1
- U" ^, Y/ @! o- ]; @ First cylinder (1-8322, default 1): # W; N" P8 X, _% X J- M! _0 f! B
Using default value 1
/ T: E! x& _- |' u- O Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G% Z- @$ S' v, Q. `
Command (m for help): p
' |$ p) A( O9 D, \) x! c Disk /dev/hda: 4294 MB, 4294967296 bytes) |( j0 l7 A# k; X
16 heads, 63 sectors/track, 8322 cylinders. V9 ~, x5 ?* _
Units = cylinders of 1008 * 512 = 516096 bytes
9 J5 `/ y9 F2 F' r! m( m/ ~ Device Boot Start End Blocks Id System: b# j! ^' b8 }5 Y) k
/dev/hda1 1 1000 503968+ 83 Linux
1 x) ~5 C1 D; }; T3 { Command (m for help): w# X& s5 R+ B9 e. G- _7 k- ~
The partition table has been altered!/ j! s6 `" J' \* X# T' \
Calling ioctl() to re-read partition table., X5 S l0 {: ]4 b# H
Syncing disks.& S) ?. S" b4 ?" P% K
//格式化新分区8 A* _% }6 S1 J& b" ]
mke2fs 1.32 (09-Nov-2002)
& u5 ?! Z6 w4 O+ y( U: e$ Y Filesystem label=
& V. o. t2 P: \' p5 L OS type: Linux
4 w k* C h: r Block size=1024 (log=0)8 n1 U+ M/ y9 x! b( x- P6 b
Fragment size=1024 (log=0)! ?; s F% U1 Q
126480 inodes, 503968 blocks
* x" p% x5 g* _+ `6 C0 N+ R 25198 blocks (5.00%) reserved for the super user
" h: ^$ g+ e: X( \. K9 H+ C4 k First data block=1
3 J) Y$ _7 r$ Y9 N 62 block groups
5 q- x, |" L5 d/ }% X& z ?2 e 8192 blocks per group, 8192 fragments per group3 W3 }9 m4 r; F* }+ ]/ R& @; v/ a
2040 inodes per group/ n5 l. q( m3 o9 g- |' {+ A6 y
Superblock backups stored on blocks: - p% D/ v2 X! Z* h
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
9 O, [6 _; Y/ p- d3 d n ?$ { Writing inode tables: done 6 v2 |0 A6 o3 C- V6 u0 ~1 u
Creating journal (8192 blocks): done; {% s1 T0 J' n$ _$ A/ `
Writing superblocks and filesystem accounting information: done
& P2 X. _7 X1 r8 A# D0 V" Q This filesystem will be automatically checked every 30 mounts or; U5 k3 K r; x) a# h/ q
180 days, whichever comes first. Use tune2fs -c or -i to override.* E) [. c$ p9 F1 X% h0 @: q
文件系统 1K-块 已用 可用 已用% 挂载点8 b, _. p( X5 Q" E6 `5 U M- u- U
/dev/sda3 3723848 705992 2828692 20% /$ ]& z3 q& u1 g% m
/dev/sda1 101089 9274 86596 10% /boot
, g- _/ K5 ?3 y# G- [0 ^ none 14520 0 14520 0% /dev/shm
" B4 O3 \5 x3 j+ Y //挂上新分区 m+ l. q# @4 a; `$ x
- mount /dev/hda1 /home3 |( F2 ^- m1 W5 c$ Q, k' l
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) M |1 n& k% Q$ s /dev/sda3 3723848 705992 2828692 20% /) O- i% R9 g# i5 A" {
/dev/sda1 101089 9274 86596 10% /boot2 i5 g+ x0 Z- z
none 14520 0 14520 0% /dev/shm$ y$ G9 F! E3 ^
/dev/hda1 488006 8239 454569 2% /home
: X: F( Q% T, U' W4 X. O9 p L0 f
自动挂载:% W/ L* l% `4 ?; T/ ~( l7 Q' z. n( ^
- vi /etc/fstab
3 v2 m! p E4 [; a
: q/ V1 }% j, C1 e/ }6 Z- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0' d; Q' O ~+ K2 X
3 v5 V* c- g2 r- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:7 v: Y& X0 K; P. t. W: D
- mount /dev/sdb5 /mnt/ljp1
8 s h! v, ?7 O1 c - 5 \9 b7 e( T1 u$ c, B
- mount /dev/sdb6 /mnt/ljp2
复制代码
' P7 V* E$ s+ r& l \* u' F, ]4 t$ f
6 E, ? q! ^+ S7 C |
|