|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)$ X$ R H4 c' N9 j. K$ G
or: fdisk /dev/sdc (for the third SCSI disk)
1 G0 p* J; e9 s9 W% F3 | or: fdisk /dev/eda (for the first PS/2 ESDI drive)7 X; J$ j( I' X9 ^1 Y0 O; K
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices). U0 n# Z6 V0 g& e2 A
...
B6 q1 U% C6 W3 R, V- df -k
& ^0 e2 D( B+ h1 e1 O. C6 i, _: A - df -lh
! f1 B+ o: q3 \: ] - 查看有几块硬盘:fdisk -l6 d8 \! ?- e2 [6 F
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
8 ^, s2 P# l( {! W( @' u /dev/sda3 3723848 705968 2828716 20% /% t& u8 i) O! Z1 @* c% ?6 @
/dev/sda1 101089 9274 86596 10% /boot* N/ `8 L% C. a0 R' r+ Z' J
none 14520 0 14520 0% /dev/shm. u6 H4 c1 ^/ a, I; \
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
4 m* q- o" R, n- LDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
& P2 w+ X3 o. D+ V) t6 U: H. H* o5 R Building a new DOS disklabel. Changes will remain in memory only,0 i% ^4 Z8 [# G" a& x3 E
until you decide to write them. After that, of course, the previous
3 W' g9 t3 h1 j content won't be recoverable.1 v" ?4 v) H! X+ p* z
The number of cylinders for this disk is set to 8322.. B0 {, i3 C; R1 d0 R# P" L: G3 S
There is nothing wrong with that, but this is larger than 1024,2 ]# v" h: Q0 ?' r \; q I* ~# P; j
and could in certain setups cause problems with:
; f3 B5 J; Y! X8 R- z8 Z8 V 1) software that runs at boot time (e.g., old versions of LILO)0 Y* k3 J8 h P& P
2) booting and partitioning software from other OSs
# J; n9 T0 X$ A4 X0 A' `1 W (e.g., DOS FDISK, OS/2 FDISK). x/ L1 y3 v: S8 q- I! k
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- C, W4 t- [8 s/ k" z Command (m for help): p) K' k8 i' n- M
Disk /dev/hda: 4294 MB, 4294967296 bytes
. ^5 P: j: I) z) t+ F 16 heads, 63 sectors/track, 8322 cylinders
9 I: D, P* T2 G$ r- T" @& c Units = cylinders of 1008 * 512 = 516096 bytes& ~4 c' q; N" A. E- D: x, }
Device Boot Start End Blocks Id System
/ ~. K8 n( D7 _* ^& I9 @ Command (m for help): m
5 a; V' r- v5 v5 D Command action
4 t2 Y: x* I5 A a toggle a bootable flag6 m' d% Z! y; ]; k$ z
b edit bsd disklabel1 z5 ^; q: r; }6 `: T. J$ L
c toggle the dos compatibility flag! R/ k g; b' i! [8 m- D5 [3 y. s
d delete a partition: b A& a; h( z$ t
l list known partition types, D2 i2 W) P" I0 T; C
m print this menu
. G) B9 z/ A3 A& x6 U ~0 i6 C n add a new partition
2 A5 B3 d& d+ P o create a new empty DOS partition table: D+ \& \1 e$ _9 m# v/ g% Y
p print the partition table
0 y K3 q, n( R3 i q quit without saving changes" L3 O3 c; j( ?8 C/ I
s create a new empty Sun disklabel9 i/ M1 e) a& S+ @
t change a partition's system id
6 k9 Y' @) Q% v$ W% m! y u change display/entry units5 v! D1 t# D! C1 ?6 c
v verify the partition table' }- f8 i7 F1 u$ e {
w write table to disk and exit0 x9 g# Z: x5 l% r
x extra functionality (experts only)
: E4 g3 j8 @9 W. h- s5 j" A+ ]$ S Command (m for help): n- X6 C# ]+ Q i( p( I
Command action2 {7 p7 o+ X1 p! i O7 ]
e extended' d+ \' H2 [' D
p primary partition (1-4)
$ e% p- R* v" S) D6 b, j" w p2 Z. `! C, L4 s+ W# z
Partition number (1-4): 1
" \, S, \% X3 l5 g |) S First cylinder (1-8322, default 1): " W( k# q' ^/ S4 \5 p1 @
Using default value 1
- y" s0 V- Z! T: U3 m Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
) u2 \7 X) V& X/ t8 I Command (m for help): p
4 O& i# ^- i' r- z5 _ Disk /dev/hda: 4294 MB, 4294967296 bytes
$ {$ \/ y9 y/ A8 D) N 16 heads, 63 sectors/track, 8322 cylinders
7 E0 o" K G' a! f# F" \+ j4 q Units = cylinders of 1008 * 512 = 516096 bytes: V; m* H2 i; C- i7 @7 |+ D, V
Device Boot Start End Blocks Id System
4 t) R/ E$ G8 k; V h8 _8 g /dev/hda1 1 1000 503968+ 83 Linux
7 T [0 o9 P; `% e. y# l0 b6 ? Command (m for help): w
* ~, W" B( S0 p3 ?9 P; W The partition table has been altered!
+ E4 t" [1 q& B. s( Q Calling ioctl() to re-read partition table." H4 Z: l! O, O) V9 W1 Q
Syncing disks.' z0 G4 F& |; A1 c2 e4 C: V8 r. ]
//格式化新分区
$ T& J; g k/ I9 Smke2fs 1.32 (09-Nov-2002)
& Y0 r, N2 `7 b3 a4 r Filesystem label=2 X% A* m0 } j7 L
OS type: Linux/ c; r0 @/ J( c) q7 D* C' e( F% k b
Block size=1024 (log=0)
: Z* ^0 G9 T S Fragment size=1024 (log=0)
6 {" a w( \+ e9 l+ h. T% N 126480 inodes, 503968 blocks$ ~7 Z' _7 M2 q- F% _
25198 blocks (5.00%) reserved for the super user$ }$ B# l, g0 |0 u' |$ C* E
First data block=13 T- M6 j9 C, g1 E3 m
62 block groups
B0 @, X% x* w: o 8192 blocks per group, 8192 fragments per group
+ ~2 g, g' \ v 2040 inodes per group+ z. z% H" y0 ]; T
Superblock backups stored on blocks:
# I6 `1 y0 z( u. A* x3 j+ ]% @ 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% Q/ `0 Z# g8 X( B* H Writing inode tables: done ' A( ^4 |7 ]% S0 O ^$ b! T2 n! V
Creating journal (8192 blocks): done6 D* z) p4 L! U0 l6 I4 m9 o4 a0 Q
Writing superblocks and filesystem accounting information: done j- y2 x' h: ?+ w
This filesystem will be automatically checked every 30 mounts or
, K, {% w: x/ @. `1 `$ b* e 180 days, whichever comes first. Use tune2fs -c or -i to override.) Z/ G. L3 j& k# \9 ]
文件系统 1K-块 已用 可用 已用% 挂载点6 L! N1 J3 Q2 {! X9 j- D! p
/dev/sda3 3723848 705992 2828692 20% /
! d# q: J2 m0 Y: r8 E9 ?% k) ~ /dev/sda1 101089 9274 86596 10% /boot9 [' j6 E6 v; d# \8 P; Q
none 14520 0 14520 0% /dev/shm% x" n7 J, p% t& {" |# u" j
//挂上新分区: {9 A! m$ _2 o# x
- mount /dev/hda1 /home0 @/ @6 C* c! `1 z U
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
3 F7 t, @7 k3 }6 r /dev/sda3 3723848 705992 2828692 20% /
+ V6 T2 J v- n% j, m+ P3 C- | /dev/sda1 101089 9274 86596 10% /boot
) r6 o# b0 A: X3 U# C none 14520 0 14520 0% /dev/shm: y+ Z" W$ ~2 T4 n' f
/dev/hda1 488006 8239 454569 2% /home0 d; U) N! _, u4 O4 s
0 G: l& D4 Z9 j自动挂载:
0 J8 o! F* E7 \* n- vi /etc/fstab
6 V( P. i& ?+ h! l# ^* W9 x - ) [! I3 Y/ p( Y+ u. x( K
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0/ f6 t0 a3 Z- }2 i! r v( S
$ c5 i" }% T0 I2 D, |- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
# I+ S& j" ?, C) _ r+ S- s, Y- mount /dev/sdb5 /mnt/ljp1# b* J3 n. _2 A0 O$ b
- 3 k4 f7 T8 V9 H. W3 m( e
- mount /dev/sdb6 /mnt/ljp2
复制代码
6 M' n. z3 g; T+ h
& l; Y' }$ Q6 N! X5 M, f0 {6 |) t; i: H& g: O: T
|
|