|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
3 @& @( _9 C! |4 ?4 _+ p or: fdisk /dev/sdc (for the third SCSI disk)
: k& L2 a3 v- O. B* s4 m" G+ u or: fdisk /dev/eda (for the first PS/2 ESDI drive). G9 U5 N" |5 i/ n3 A
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
2 r5 e7 {- W; W- [! I* u ...
5 b9 @9 N. F+ o) ?( t- df -k8 u* |8 a6 V3 I3 q8 p
- df -lh; m! x' E1 g8 _
- 查看有几块硬盘:fdisk -l# t- M! Z* }+ O2 x1 J
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
& I+ N+ j2 u1 q /dev/sda3 3723848 705968 2828716 20% /
& N: }9 ^0 k6 H s) b /dev/sda1 101089 9274 86596 10% /boot
7 _9 N- Y$ M+ W" u5 R none 14520 0 14520 0% /dev/shm" `2 E! k2 G" S, _2 ]4 H* E. k$ o
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
' m: w0 Y1 z4 L5 J) C4 Y' h* M* oDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel/ ~1 Q% c; y8 N: o( W
Building a new DOS disklabel. Changes will remain in memory only,
( E* |$ E% n- o8 o W2 c) F until you decide to write them. After that, of course, the previous
- N5 k4 |1 Z0 ]0 r9 i+ ~ content won't be recoverable.; W- u3 {7 c, v7 F6 C
The number of cylinders for this disk is set to 8322.0 w7 e \) t2 c: ~) T
There is nothing wrong with that, but this is larger than 1024,
) g% @ Z1 g# e; T( E and could in certain setups cause problems with:% C/ H7 U% C2 ~- @7 y" V
1) software that runs at boot time (e.g., old versions of LILO)
" ]3 k \1 r; W# b& _ O 2) booting and partitioning software from other OSs
$ G* m, F- X& W% ~$ T (e.g., DOS FDISK, OS/2 FDISK); K3 B/ E. e* a# |4 G) Z. B
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
" Z. a/ ~2 r1 d; S* D* P$ z6 m Command (m for help): p5 a/ e- K& F( g
Disk /dev/hda: 4294 MB, 4294967296 bytes
# j0 M$ p7 X- L& h! S 16 heads, 63 sectors/track, 8322 cylinders) [" }5 S1 a% j# S" D# u$ }
Units = cylinders of 1008 * 512 = 516096 bytes! z. K- Z4 r& @& D- C4 O0 ]2 M- T
Device Boot Start End Blocks Id System
8 U: ~- E2 I- k7 T+ N# f( Q Command (m for help): m
8 K( H: m) s+ m$ P u$ N: ]: _! h. S Command action* U. r8 c$ N- Z& L. X7 e$ T& \- x
a toggle a bootable flag
- y1 Q* `9 r2 ~6 S+ a; i: c b edit bsd disklabel6 V; Z5 m+ {+ |3 q
c toggle the dos compatibility flag
! u. [ x6 k$ D! a& O" u4 r4 P d delete a partition
6 Q8 c$ u* n3 ~: A l list known partition types. M! U4 d+ u7 T! o6 }
m print this menu) O. a2 _+ e5 ~* K) J
n add a new partition |+ e$ U/ H1 U; q
o create a new empty DOS partition table
% n, d& t' H0 V p print the partition table& \. N3 s4 W+ O4 n% ^2 }; l
q quit without saving changes
8 H6 Y4 i+ p% I1 ] s create a new empty Sun disklabel& G8 O* C. V t$ c
t change a partition's system id
K1 s2 M i: h u change display/entry units! Z7 ?* a! I1 v( T' a' D
v verify the partition table
/ p0 e4 {9 `$ g7 n: @3 Z w write table to disk and exit' T N1 u; o$ x0 M4 s
x extra functionality (experts only)
3 W% }+ c' J+ X6 S/ t0 |+ g Command (m for help): n" r5 Q/ L* q1 I! e7 r
Command action
9 D4 O# d, i9 `) W0 i. h, I- _; S/ e e extended* E/ h1 z& R! A' v3 i, h
p primary partition (1-4)
2 \) y; h* p2 _. e& X' u p
, J6 X2 F$ t1 v! G8 ], X- a2 V; G2 \* n Partition number (1-4): 1
2 t: x; c6 S' W/ b First cylinder (1-8322, default 1):
/ Q. ~ c% ^% c, k' b' ] Using default value 14 a% W# E1 w% N. @
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
, C: g% I% A0 W9 Z Command (m for help): p" M. {- b& O( J- O) k
Disk /dev/hda: 4294 MB, 4294967296 bytes
M5 `* v6 H( \- }* V 16 heads, 63 sectors/track, 8322 cylinders: W j* p3 j7 g4 q
Units = cylinders of 1008 * 512 = 516096 bytes8 y/ e7 ?8 s: V2 u0 N. n2 y; h
Device Boot Start End Blocks Id System- O3 I& y$ J1 a! B0 B
/dev/hda1 1 1000 503968+ 83 Linux& m2 L% x' l" g& T+ d
Command (m for help): w
9 E' g4 Z4 N- ^# H8 K* d3 w8 `5 j The partition table has been altered!( ?$ \0 W& B% [- Z/ G
Calling ioctl() to re-read partition table., F# l h$ I/ b
Syncing disks.
4 _# [2 m$ b" j7 l# V //格式化新分区
1 M' m B/ R' ]# J) ]mke2fs 1.32 (09-Nov-2002)
4 w' u1 M, E6 ` Filesystem label=, W1 o2 j+ E, C* p: o, }
OS type: Linux; \$ T0 m m9 f. ^2 ?* o' j
Block size=1024 (log=0)- ]" {2 H Z& u
Fragment size=1024 (log=0)4 e; y. o1 ?1 E! P' l
126480 inodes, 503968 blocks
" W" P) s+ v3 _ 25198 blocks (5.00%) reserved for the super user
( t6 s [9 G6 D* ?4 } First data block=1# ?, Y' ~# \/ O5 Z9 X* p: I( m
62 block groups0 N' A: E, o% W& o0 Q
8192 blocks per group, 8192 fragments per group- N1 \; {% n( B
2040 inodes per group
3 w9 e0 M7 i9 P! x: B Superblock backups stored on blocks:
; ^7 v, T3 T, i* T 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409) \; z3 b+ R: r( C# d" {+ O0 m$ v
Writing inode tables: done " H" t* i, T2 [+ r
Creating journal (8192 blocks): done
/ ?# w) j3 _ Q! `. X1 | Writing superblocks and filesystem accounting information: done
6 R& Q7 }4 F* G$ D* D" b8 `0 Z This filesystem will be automatically checked every 30 mounts or$ ^# b: i8 j) j6 N) n* q
180 days, whichever comes first. Use tune2fs -c or -i to override.
+ T) p1 `: \6 ]/ G; u; o- y( `文件系统 1K-块 已用 可用 已用% 挂载点
1 ~; K3 _: D- v" z /dev/sda3 3723848 705992 2828692 20% /
: f& v& K; L7 M2 C" g) y /dev/sda1 101089 9274 86596 10% /boot
% d1 t# p ^. b' x5 c; @/ l none 14520 0 14520 0% /dev/shm$ D( ^! B- ~( Y+ p
//挂上新分区
! M+ E7 c/ S5 L8 f3 S- h- mount /dev/hda1 /home. W) Z- s1 _, A& ]3 ~8 c
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
6 p$ E/ L& l6 x /dev/sda3 3723848 705992 2828692 20% /1 k( G9 p: l: b! v/ p
/dev/sda1 101089 9274 86596 10% /boot
# z- A M) B$ C none 14520 0 14520 0% /dev/shm7 [1 M- m5 C- E6 }/ ?) _7 a
/dev/hda1 488006 8239 454569 2% /home) S' a x; B9 E/ d# f
( A* i+ z% X2 s! N
自动挂载:
! \9 D6 ~% b2 E6 \+ r. _- vi /etc/fstab
2 k4 J5 {/ ^9 a' Q - 9 h9 P r1 i$ |
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0 _5 ?! ~7 C! A: F8 _' o: |
- ) q: }+ _) Q0 j9 d" \
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:+ M0 M' L5 f8 v+ v7 Y- K0 D* Y! o
- mount /dev/sdb5 /mnt/ljp1
+ m# g; i( N* Q: K# _1 R
* q9 s% O1 z- P1 ^- [! f# W- mount /dev/sdb6 /mnt/ljp2
复制代码
1 u; d9 ~9 ^; @* a6 E
, t/ z& N6 c& V$ ~
8 t+ Y: I: P$ I( r% j- I' R |
|