|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
6 J; N, _/ Q l5 n/ S or: fdisk /dev/sdc (for the third SCSI disk) I! M" [1 N" E
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
! `, Q* }+ v: z4 P/ ? or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
; ]/ N) h+ X" D* s ...' P v( y5 g9 x0 [+ `
- df -k
6 W4 N. s$ M7 r$ m) X' G, H# y - df -lh" R: p; o, ~; O/ R: k
- 查看有几块硬盘:fdisk -l
: N. d, ~( L4 P" {
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点6 j6 D+ g) _4 ^" I
/dev/sda3 3723848 705968 2828716 20% /
# q# ]+ F) b1 `, [+ G, V2 E" B3 M. d /dev/sda1 101089 9274 86596 10% /boot9 r: M& [9 g' s: x3 d! U& B
none 14520 0 14520 0% /dev/shm! m( @6 G1 Y7 |$ A& t) h. `; H0 R
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
* a Z( C. r3 y MDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel& b$ v' g" q; \" B! `! q
Building a new DOS disklabel. Changes will remain in memory only,# _0 V4 D6 Z) X* J
until you decide to write them. After that, of course, the previous/ C& x5 a D9 W- D& m
content won't be recoverable.5 T% d" Q* u8 ~# T0 J% l3 B
The number of cylinders for this disk is set to 8322.+ m7 v( D$ O& U0 f; @1 Z- ?
There is nothing wrong with that, but this is larger than 1024,2 v0 t% {% I' r/ l$ r! R
and could in certain setups cause problems with:
& f3 F, P9 c/ w& a, I( K4 A 1) software that runs at boot time (e.g., old versions of LILO)
: G. V& H, D- e0 t9 U, r 2) booting and partitioning software from other OSs% I7 L9 t. H! g$ U
(e.g., DOS FDISK, OS/2 FDISK)
: I* ^: i3 C' L/ B Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ K1 Y" K4 `9 h2 f7 z- D. P Command (m for help): p5 P* H( g. w& P4 a
Disk /dev/hda: 4294 MB, 4294967296 bytes9 ]/ M! a( ]' O, D
16 heads, 63 sectors/track, 8322 cylinders
4 H( e- D9 y. e7 j6 N4 O. q Units = cylinders of 1008 * 512 = 516096 bytes
% h0 Q$ A4 I B3 h: J/ E- } Device Boot Start End Blocks Id System
) ~& c5 e+ N, b3 y Command (m for help): m
1 \# C7 y3 t6 {6 S. j: h; ` Command action
5 t( w; S/ J+ P0 Q; [* T7 @ a toggle a bootable flag
* C* P6 a: T& g. q b edit bsd disklabel
$ J+ c1 c. n, A$ z M8 h) A5 E c toggle the dos compatibility flag
; v9 {* U1 A, G* P I4 c d delete a partition
; B* Y7 O' T1 p1 n l list known partition types4 s0 P7 ]5 E0 T0 ~
m print this menu/ \3 P+ Z* g' u% w4 ]" _
n add a new partition7 n/ i, R6 y% o! ~. p3 r* k- ~
o create a new empty DOS partition table
# s5 | r2 R2 N* c& p p print the partition table) F/ a% I0 a/ l' e9 q' p
q quit without saving changes
2 R+ Y" M: W( g7 c3 x s create a new empty Sun disklabel o' g% t. [+ _
t change a partition's system id
7 f2 ?0 A) M: L1 @$ F. V5 W u change display/entry units- |) f! A8 g. k' d
v verify the partition table
1 a& I7 b/ S/ ~+ i3 D w write table to disk and exit) `" v. V- C: G
x extra functionality (experts only): v- }9 d0 [. O; }+ G; H
Command (m for help): n
, b2 W: ?2 {: u/ |/ t5 ~6 ]4 p4 K% S Command action/ v) s0 i5 X8 j& S% p
e extended) S! c' T+ T5 h \4 X {" `+ }
p primary partition (1-4)1 `/ I( S# X4 Q4 m" c9 N9 _
p
% V" d% y! C0 b f# V. d Partition number (1-4): 1
# B9 n+ G8 N" K7 j First cylinder (1-8322, default 1):
. @& ?3 n# e2 T7 M4 { Using default value 1
! o# J* |' y; e: w6 j1 V( l Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G' D7 v" T7 `+ C' y
Command (m for help): p$ S. n$ ^0 M9 M, ]# q
Disk /dev/hda: 4294 MB, 4294967296 bytes
/ j+ o ~7 x! {# f5 _ 16 heads, 63 sectors/track, 8322 cylinders
2 V8 z( R6 d( `1 B) L0 s- j: r Units = cylinders of 1008 * 512 = 516096 bytes
3 j/ d+ [% ], m! P B4 ]" ` Device Boot Start End Blocks Id System) V0 ^/ a" H0 [9 g4 _* q
/dev/hda1 1 1000 503968+ 83 Linux
/ \# P0 X' ]$ S" V" \1 D) Z Command (m for help): w
# s/ D% K3 K# ? ] M: I The partition table has been altered!* A& o$ k+ M7 @3 i+ H
Calling ioctl() to re-read partition table.
9 x" M! h) g2 }6 i1 n+ U0 N+ ^ Syncing disks.( o, H' s2 I1 I- B3 |0 L
//格式化新分区% f3 f, Z) z- `2 g% W% K
mke2fs 1.32 (09-Nov-2002)/ Y6 z9 O: R# n1 @; h$ ~5 G" o$ J/ C
Filesystem label=) m8 }8 ^- M. L. v6 l
OS type: Linux
, W' }2 X# k1 ?3 O0 b' x Block size=1024 (log=0)$ E9 D$ M& ~8 P3 ~- J0 o b
Fragment size=1024 (log=0)/ h0 \/ p% H- Q5 {3 e# D
126480 inodes, 503968 blocks
9 E8 ^$ A- `% e- ^- K 25198 blocks (5.00%) reserved for the super user$ ~, x4 W% \1 l* U/ A: n
First data block=1$ P5 k7 Z0 }$ h& E, }2 [& j
62 block groups4 M5 K% z7 I1 A
8192 blocks per group, 8192 fragments per group
- L4 |+ f$ f {7 Z" D 2040 inodes per group
) X- q/ o1 H6 I1 R Superblock backups stored on blocks: * _: x- G$ e4 C1 N7 {; [9 l: ^
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409; ]' ?! D, L" W- l' A" q
Writing inode tables: done 9 N$ \1 q7 ?% f# E+ _# o
Creating journal (8192 blocks): done
1 c% w2 n# F/ D& t4 R1 J/ U4 ] Writing superblocks and filesystem accounting information: done
! R$ x& g# P+ h9 r8 B This filesystem will be automatically checked every 30 mounts or4 z( w2 U9 y- @" f5 K
180 days, whichever comes first. Use tune2fs -c or -i to override.
C, |- `1 U8 F# l z# n R文件系统 1K-块 已用 可用 已用% 挂载点
. ]2 Q' [. T+ _0 j$ Z( m+ W) J /dev/sda3 3723848 705992 2828692 20% /& U. F4 r+ R3 G9 k
/dev/sda1 101089 9274 86596 10% /boot C# X- T. `; i7 r
none 14520 0 14520 0% /dev/shm' u5 f1 z0 W! Q
//挂上新分区
% o) q- v& P+ b9 t- mount /dev/hda1 /home
3 T# `* K' k) X - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
6 u. n- ^3 {$ b2 k! J* r! x* t /dev/sda3 3723848 705992 2828692 20% /; `% ]2 j2 Y# q9 k
/dev/sda1 101089 9274 86596 10% /boot6 V, E3 z0 b$ V6 g* D
none 14520 0 14520 0% /dev/shm3 x7 O% F* V+ A
/dev/hda1 488006 8239 454569 2% /home
0 F; g- t7 F$ y- B- u8 n. B+ j6 V/ M5 N
自动挂载:& I8 s2 o; f4 l- g+ c7 j' l
- vi /etc/fstab' @3 i9 \/ `; \* y
- g5 w4 f2 T: }6 e- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
( K' Q! e# t' b* n' m9 Y2 Q
3 U6 f+ H% a1 k1 y$ L- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:% b* ]6 A( L- \) @0 F
- mount /dev/sdb5 /mnt/ljp1
( ?% _7 O$ `2 ^. o& Z
8 ~4 P# V c1 z$ @- mount /dev/sdb6 /mnt/ljp2
复制代码
7 p5 o1 x' Q. D% r3 l u" Y1 |5 z" {
3 Q- M( T- Z2 \ |
|