|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
7 A, j# B% z+ k- L or: fdisk /dev/sdc (for the third SCSI disk)
! L0 ?7 x3 V0 u5 K/ g or: fdisk /dev/eda (for the first PS/2 ESDI drive)( ]# h* N; v4 ?, ^& v
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
; \* z# g& |) z4 ` ..., }7 z5 i0 _1 i9 o3 [! r4 w
- df -k& W$ U5 u# v% g( {
- df -lh
6 r% P9 q+ k: P. d3 Y - 查看有几块硬盘:fdisk -l* ] ^4 u" M2 Q' e8 K0 j2 x2 k0 _* U
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) X8 {7 L5 k5 G; l8 u2 T; z# p /dev/sda3 3723848 705968 2828716 20% /$ f, \; m% Y. D' h! x7 x' N
/dev/sda1 101089 9274 86596 10% /boot+ g8 o) T. `! h; T1 ~: V
none 14520 0 14520 0% /dev/shm
& G% O% `- {( r# k D5 R/ A" ] 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用4 s) V! Z. w- u8 S! f) I$ X4 Z9 }
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel* N* @! j k2 W" Y; U }6 K
Building a new DOS disklabel. Changes will remain in memory only,
/ ~4 E4 z% G3 \' m until you decide to write them. After that, of course, the previous- G- u( T' v. k- n% x3 V
content won't be recoverable.
& r/ J7 b2 C1 \% `, Q The number of cylinders for this disk is set to 8322. c% t" z6 {3 Q( m- `3 n' Y- y' C
There is nothing wrong with that, but this is larger than 1024,
) I8 R! e! I1 L* s/ N6 L, }9 Y& m6 h. U+ w and could in certain setups cause problems with:
( v2 Z, }8 G/ C, o, n 1) software that runs at boot time (e.g., old versions of LILO)
, p: q* W4 L/ G% b& ~6 Y$ Q 2) booting and partitioning software from other OSs* `5 [$ V6 @- X: j& `
(e.g., DOS FDISK, OS/2 FDISK)
7 D7 k; z2 g( l Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
7 D. R2 h2 `0 _! Z- C! }8 E Command (m for help): p
% c$ c. J4 \/ i: T Disk /dev/hda: 4294 MB, 4294967296 bytes
" e0 `6 J8 i ]* v" c1 B( ]. v 16 heads, 63 sectors/track, 8322 cylinders; F$ w+ Z$ S/ e0 [
Units = cylinders of 1008 * 512 = 516096 bytes, G+ H) E% I* u2 K) {& d
Device Boot Start End Blocks Id System
! Z: s6 x; N: s% B/ @ Command (m for help): m( [ t; J5 a+ k% |/ [& L9 P+ P
Command action
& h3 h% X. a* d# r$ z$ O a toggle a bootable flag
- P o) E$ a$ s$ ^- ] b edit bsd disklabel3 z+ u5 l: [" Y; b8 j
c toggle the dos compatibility flag
* O, V' t, j' p' n ?7 _ d delete a partition
1 O$ R' ], [* B/ o- A l list known partition types
1 A# H6 r, n0 z m print this menu d" {- {( Y: p: |
n add a new partition
0 A% t v" S9 S8 r" Z o create a new empty DOS partition table
+ d I/ ~ w# n' L# u p print the partition table" E1 n6 G* \$ W; \6 H9 B, d
q quit without saving changes; s. @" |; A3 O1 k- A
s create a new empty Sun disklabel: C( N4 r3 w5 @9 H
t change a partition's system id; U8 P, y. A) j, }
u change display/entry units
% q- t# k& L2 a0 Y. ?# M V v verify the partition table% g. L$ @5 l8 R ]4 a
w write table to disk and exit
6 G @# u8 ]4 x7 { x extra functionality (experts only)! e5 F* F7 Z, A1 G& @
Command (m for help): n, ]) D3 x- u% b! A* j
Command action
! v w* ?3 |& e1 G5 \ e extended$ W0 ]1 a: ]* y! t# N. @
p primary partition (1-4)3 |3 J, K& L" L: ?6 m p
p) \8 F# s4 s0 B+ _2 ]& f. |: ^
Partition number (1-4): 1
* s) \- P- R ]" V8 r/ s First cylinder (1-8322, default 1):
7 D% n6 \* l$ G9 w% V: } Using default value 1
" Y9 _: _' b* ^+ a5 V+ C* P Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G- n7 G0 b, @2 `( `, K7 N0 @2 M
Command (m for help): p8 @# h+ L9 X7 y
Disk /dev/hda: 4294 MB, 4294967296 bytes2 q1 X E2 r( \9 f- Z K/ p
16 heads, 63 sectors/track, 8322 cylinders
- H! ?9 n7 b: r* S' n( Z Units = cylinders of 1008 * 512 = 516096 bytes V: x* j' K- c" |/ U3 F9 z: y& p
Device Boot Start End Blocks Id System/ `6 w7 O$ Z. Y
/dev/hda1 1 1000 503968+ 83 Linux
% l i% i0 ?3 p1 x9 ` Command (m for help): w
. w# k3 J" @( z# v8 n3 h The partition table has been altered!) L- b% e4 v+ P: b
Calling ioctl() to re-read partition table.
7 Z% z& K/ w- J A8 e Syncing disks.1 Y0 V- }: l2 t ?4 U
//格式化新分区
& Z D% z: m; h2 g8 v; gmke2fs 1.32 (09-Nov-2002)! D% p+ h. r$ D* u% m$ o
Filesystem label=
: G; h# _" f2 ]! p$ Z/ u OS type: Linux) T* f, g, Y! H! F& `7 ^8 n* x
Block size=1024 (log=0)
! J& P: r9 T" s* N! G( |& r Fragment size=1024 (log=0)
/ O6 ?7 f9 P1 y# q9 y 126480 inodes, 503968 blocks4 ~9 j! i+ ~; k7 @/ A& z) y+ {
25198 blocks (5.00%) reserved for the super user
% I# e2 k( q% d0 `6 l First data block=1
9 h, i+ B; D; N) S* Z3 B) v 62 block groups
E$ f+ j; ]" s5 j8 H 8192 blocks per group, 8192 fragments per group
W2 f' y6 Z$ ~# t% _ 2040 inodes per group+ D8 \9 _- O* t6 R9 h% [. Z9 D
Superblock backups stored on blocks: 3 `9 i- b0 l; w; r
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409/ S" w7 t1 ], P5 F. \
Writing inode tables: done
5 h$ K: x! y4 Z5 W+ h. [ Creating journal (8192 blocks): done
2 w( G) A0 Y2 b6 l Writing superblocks and filesystem accounting information: done7 x) D. |/ c+ e7 R* u* V/ n7 E4 M* C
This filesystem will be automatically checked every 30 mounts or
7 d B q; j* v. b6 d/ ` A 180 days, whichever comes first. Use tune2fs -c or -i to override." p4 S! `& h2 `# r' Y
文件系统 1K-块 已用 可用 已用% 挂载点
* j/ Q, E4 C) A' X- _ f /dev/sda3 3723848 705992 2828692 20% /
! |% H$ r- I8 g, X /dev/sda1 101089 9274 86596 10% /boot! {6 A6 h6 B! x
none 14520 0 14520 0% /dev/shm. K1 }( k0 b; p
//挂上新分区. ?* a- m* F9 v% V9 A& M- G8 V# w
- mount /dev/hda1 /home
2 k& j. Y7 V- _9 v$ N+ d - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
/ T/ |: a3 L( L. t /dev/sda3 3723848 705992 2828692 20% /
, | i! g* ]2 G# n5 ]; G+ h5 \ /dev/sda1 101089 9274 86596 10% /boot" v/ D9 a* R$ X2 e$ _
none 14520 0 14520 0% /dev/shm
9 `1 ], C s) S& m( o; I, J /dev/hda1 488006 8239 454569 2% /home' |+ h L: i% {* N0 y" A" O$ F$ P
1 R; R" h& N2 S( |) V! I* n) @自动挂载:$ o' M& h( m) }
- vi /etc/fstab
) r1 `. Z1 ^# t) ?7 d l
, t2 G$ |4 n8 Q2 x/ K' c- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
$ o4 U4 ]) }* I
, h9 s8 r3 M5 i- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:: X$ G; W1 R* `3 B
- mount /dev/sdb5 /mnt/ljp1' Q3 P& |% T' \2 C0 K
8 Z; K) i k; H! w3 w( G- mount /dev/sdb6 /mnt/ljp2
复制代码
* |- y4 U( V2 R
5 J$ ~ V4 R$ u% Z5 c; }4 C! Y8 J, x9 n$ f) w, I
|
|