|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
4 _) U5 _) \5 i G O4 l! @ or: fdisk /dev/sdc (for the third SCSI disk)
0 X5 Y( @. E! t2 n7 _ or: fdisk /dev/eda (for the first PS/2 ESDI drive)4 U* g2 |6 H( h! f
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
9 }3 U% h0 C$ ^: Y: I+ g0 i0 e, T ...
+ K7 S+ Y0 c* K- df -k
% L) i2 B6 }: [( _; ~4 V - df -lh$ A. l- H$ q$ P/ h( Q
- 查看有几块硬盘:fdisk -l/ D8 n# N7 ^# n; x/ M/ k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
+ T0 ]: C: B8 M6 R$ K /dev/sda3 3723848 705968 2828716 20% /
7 Y \2 [# C }; ?$ y8 y /dev/sda1 101089 9274 86596 10% /boot
% u$ y1 P' n/ w1 n4 { none 14520 0 14520 0% /dev/shm+ i9 z* ^2 R) \9 l K( j' k$ _. n2 ^
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
) m \1 E" L' S1 t$ X9 x% hDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
7 u6 _6 t9 i9 k! j v Building a new DOS disklabel. Changes will remain in memory only,; b% N( q0 o! F
until you decide to write them. After that, of course, the previous
6 _1 J" a' Y* y& P8 V5 P content won't be recoverable.4 ~/ \$ b- T% n
The number of cylinders for this disk is set to 8322.% s1 J- i/ `' s+ I" J$ {# D; L
There is nothing wrong with that, but this is larger than 1024,
' b1 i$ O6 b1 D7 N; c8 r and could in certain setups cause problems with:9 f, S: |) G' }5 m
1) software that runs at boot time (e.g., old versions of LILO)9 I7 N6 q! P( j5 B8 c* B$ l0 n
2) booting and partitioning software from other OSs }2 ~7 W4 N) C0 b0 f
(e.g., DOS FDISK, OS/2 FDISK)* K3 f, v; V) O- t
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)9 T; r1 c7 m1 g# |. P7 H! J
Command (m for help): p2 u) q! o# }) [" Y; g& ~5 T
Disk /dev/hda: 4294 MB, 4294967296 bytes
?) _ d* E9 u: x1 y6 Q3 e 16 heads, 63 sectors/track, 8322 cylinders1 M+ ]: L# `, Q3 E( n: `
Units = cylinders of 1008 * 512 = 516096 bytes3 }9 ]; {; F' B
Device Boot Start End Blocks Id System
* i$ C4 G# n7 ]8 X7 I& V Command (m for help): m) Z# i- L, T! a/ j6 b# e
Command action, }- }* E. e" X2 p3 n, s) P
a toggle a bootable flag1 a5 l2 J( R6 r
b edit bsd disklabel3 Q( {* F. U7 y2 n0 v
c toggle the dos compatibility flag- o3 }% [8 ? J3 y
d delete a partition/ A7 e- n" E! l& L
l list known partition types
0 ]1 M7 U& y0 m+ J* k0 p0 u* h m print this menu$ Y" o M5 p3 b* ^% H3 b4 {
n add a new partition
( N2 h3 i; z! e2 l o create a new empty DOS partition table6 q9 G: `* ^0 y# K
p print the partition table2 U$ j- B' m0 o
q quit without saving changes
% i- o' B6 c9 R! q- ~3 \ s create a new empty Sun disklabel# Z5 H, @. `9 H: p7 Q* u' J+ K
t change a partition's system id
9 p2 {" Z9 D/ p3 O, e u change display/entry units1 k( g3 u. o8 }4 p, T
v verify the partition table/ U+ d3 i) C" h9 p2 a
w write table to disk and exit
" q% }9 O+ ^$ K; h, K# F1 q x extra functionality (experts only)
* G: M! f& n4 T$ K; u Command (m for help): n$ ]4 E* L$ ^" m* P W2 R
Command action
7 y$ S7 u( B# w' | e extended+ w' f5 O1 T, B, Z7 e( N* i
p primary partition (1-4)
2 W" o6 I9 n& y; ^% w+ `, J$ G p! \9 A9 l8 R; v' J. y
Partition number (1-4): 1
9 x! n" z C! |" ~ First cylinder (1-8322, default 1):
) X9 z: X" C" Y0 v/ o Using default value 1
6 L! d" j5 S9 J, N8 p* X$ G' G; B Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G- X1 x$ Q# \3 q% E$ k! D2 {. n
Command (m for help): p
" J. J: g i V* {0 [* P' w$ q Disk /dev/hda: 4294 MB, 4294967296 bytes8 s% `- T" J4 W! E- \7 [7 L; ?
16 heads, 63 sectors/track, 8322 cylinders
# o6 X4 v, Z- r- w Units = cylinders of 1008 * 512 = 516096 bytes
: e* {6 N& W6 [3 }1 ^+ y Device Boot Start End Blocks Id System
: G6 L6 w7 |; o) O /dev/hda1 1 1000 503968+ 83 Linux
2 T7 \! B0 {$ c+ K) h Command (m for help): w1 T7 y+ i3 [% C6 k3 K0 w. R" b9 M
The partition table has been altered!
7 u9 t" |0 j5 V$ b% z Calling ioctl() to re-read partition table.. d/ [: R1 f5 M$ D5 B3 G
Syncing disks.
! U0 y \) r# V8 O; i2 q //格式化新分区, S! u% {5 I. a3 a, f. [
mke2fs 1.32 (09-Nov-2002)
% V- A" r# M1 U Filesystem label=' S" m- s4 l' K2 X( I- \. |9 Q2 \
OS type: Linux4 q, `9 V4 z8 F7 i* c' S# P' O
Block size=1024 (log=0)1 i* s j. v, X0 h3 L8 h% [$ S9 z7 W
Fragment size=1024 (log=0)
3 |# n9 n ]$ N7 g# v( b! I% d 126480 inodes, 503968 blocks
# o& M& N6 ?: r6 b! W 25198 blocks (5.00%) reserved for the super user" T5 k2 @: p* \* j
First data block=1
$ p. y; b- H6 V7 R 62 block groups7 S) U' ~* i: \4 Y
8192 blocks per group, 8192 fragments per group: j7 w& r% ]5 D4 a0 @
2040 inodes per group( `. D' [' W: [
Superblock backups stored on blocks:
" R+ d4 g: y8 j 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409+ n" C6 @5 E8 F- }3 B; R- _8 C
Writing inode tables: done
0 A0 T# x' r& M& I/ W T7 p ?, g Creating journal (8192 blocks): done
5 i. {6 k T" ]4 |% S8 D9 R: Y Writing superblocks and filesystem accounting information: done
& { _2 F8 a2 N) d1 p, t2 j This filesystem will be automatically checked every 30 mounts or6 y* m I0 m4 k6 ] h
180 days, whichever comes first. Use tune2fs -c or -i to override.7 g7 o0 u# h! {0 _* v
文件系统 1K-块 已用 可用 已用% 挂载点
' A5 w& @/ D! h) i4 Z$ A+ S' a/ p /dev/sda3 3723848 705992 2828692 20% /, _1 d& b( U% |. C1 [, I' B
/dev/sda1 101089 9274 86596 10% /boot
8 ?' S p: T2 @# s7 v none 14520 0 14520 0% /dev/shm; N0 X( c( W3 e# P* X
//挂上新分区
; v) B5 w+ `* N- mount /dev/hda1 /home
3 y2 U% m; l$ h; p - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! v$ ?, U0 a* [ /dev/sda3 3723848 705992 2828692 20% /% A9 k6 Y( \* n
/dev/sda1 101089 9274 86596 10% /boot
7 {" k2 k% _! n- b0 G$ e" ? none 14520 0 14520 0% /dev/shm
. w3 t0 K$ x8 W: K# k C /dev/hda1 488006 8239 454569 2% /home5 C s! C6 u# u% B' `/ T0 |% z
) P7 I# i" L; r b
自动挂载:
- z+ {7 Q6 X% C: n j; N$ k! D- vi /etc/fstab
% z! s% J; j2 d; F/ C' } - + r# S- {: [; I; C* \% M
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
+ V6 u9 M- z% I - s- p7 }! Y+ D$ x
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
$ t3 e* B% S: ~ B+ I( N% c; |- mount /dev/sdb5 /mnt/ljp1, S! A1 F# k2 E1 d
0 m6 z0 B" [# \0 M- g- mount /dev/sdb6 /mnt/ljp2
复制代码
' R5 m' y! {; _9 n- N9 g5 R+ c8 ^2 [; T: ]1 X
- I1 M! Q7 F1 ^' f |
|