|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
+ c1 d1 r5 c% d$ X) G) w or: fdisk /dev/sdc (for the third SCSI disk)! y9 Y! S1 w2 `
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
: t5 A* F: Y) l5 }! X or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
% R# |/ o! `; ~5 [% ^8 Z ...
% `/ L2 O( U0 v' Q4 N- df -k
/ f' M$ ], d2 B; p9 x+ b# C - df -lh
) w, N6 J/ | v) b& Q - 查看有几块硬盘:fdisk -l
: d4 [( w; p3 i1 j% U8 x* u/ h
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点) V. u8 c$ c1 e
/dev/sda3 3723848 705968 2828716 20% /
. I0 w! J) O0 t /dev/sda1 101089 9274 86596 10% /boot( `$ V: m4 E) w/ E
none 14520 0 14520 0% /dev/shm" ~* f' d/ v3 Y/ o2 h* Q
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
6 e. X; t7 r. r$ |" S; A) _9 Y7 R4 EDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel$ h* k# s9 }# u/ C) E4 M7 B$ B, a
Building a new DOS disklabel. Changes will remain in memory only, q# \0 T4 c, G+ n6 f6 P
until you decide to write them. After that, of course, the previous! @0 D2 F$ P- Z3 Q9 {6 n
content won't be recoverable.
+ E6 B8 r& s9 e2 w3 X1 X; l6 j The number of cylinders for this disk is set to 8322.1 P8 ^6 d7 k/ W0 d7 b' m
There is nothing wrong with that, but this is larger than 1024,& w# z4 C' d) N3 \2 p9 N
and could in certain setups cause problems with:
" B2 C$ b7 c+ T* J" ] 1) software that runs at boot time (e.g., old versions of LILO)
! l4 \% y* Z y4 ~$ g4 }+ o 2) booting and partitioning software from other OSs
9 |6 k7 k* q" g6 V; [* f& }! A. e* }. ^ (e.g., DOS FDISK, OS/2 FDISK)
5 _+ z) V7 _$ N$ [4 r: b. V" O% W Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
' |$ q; x2 P" k( H7 ~. \* u9 g Command (m for help): p
7 y' z0 E: W7 }+ F3 a% P) K Disk /dev/hda: 4294 MB, 4294967296 bytes
7 d" t+ @5 a6 X0 x 16 heads, 63 sectors/track, 8322 cylinders
/ a* l9 |3 G) z( z" I Units = cylinders of 1008 * 512 = 516096 bytes3 d9 Q$ g1 _$ a& J
Device Boot Start End Blocks Id System
' _" o7 y9 t$ Y Command (m for help): m6 m& X( ]- O# j \' {) e7 ]$ H
Command action% L# [- N- w( g5 R# F
a toggle a bootable flag1 a2 z, U, n+ s
b edit bsd disklabel
( b3 W) q4 A( v, Q x9 t$ n8 ~& t" ` c toggle the dos compatibility flag
: `. ^2 A1 G, i' ^5 D# ?8 \' g- ? d delete a partition$ f; B/ s# a/ _& o! h5 N
l list known partition types
h% D9 ?* i3 g4 Q3 p m print this menu1 R+ @0 y' T( i7 f+ X' T
n add a new partition) c# Y, H, J/ R- T4 i' t8 B, i
o create a new empty DOS partition table
' r& E4 S$ @0 D7 G/ C p print the partition table
% r% l& H8 |6 `/ a7 z q quit without saving changes4 m4 S+ {" r2 j1 ~' k2 X
s create a new empty Sun disklabel4 b! F. K6 U$ z+ R
t change a partition's system id8 g, x0 y' B8 n$ i( {
u change display/entry units, f8 q8 C+ @! o: s/ S
v verify the partition table
8 ?* B J3 ?1 i0 v( l3 P w write table to disk and exit8 y& {5 r0 r! |6 h6 T5 E$ N
x extra functionality (experts only)
! K3 G a8 k& \' r' `3 f. G% B8 S Command (m for help): n0 y# O+ J1 _& [) j- B7 S, y
Command action
! e5 h* t) `3 H$ l* t e extended% w' x: ?. K- X" {+ `
p primary partition (1-4)) v0 Y& O% b. {1 o
p
/ ]- P$ G2 E6 R3 x! K Partition number (1-4): 1* w+ s" j8 o) f
First cylinder (1-8322, default 1): 7 f, U! U6 A w
Using default value 15 o" _7 G+ A& F# B
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
1 F* L& i4 t/ L2 b Command (m for help): p
! _6 B+ _, `& W8 c) n9 {! g Disk /dev/hda: 4294 MB, 4294967296 bytes
, i. a& ^6 }& w! F; E 16 heads, 63 sectors/track, 8322 cylinders7 E) K Y" d3 A/ b
Units = cylinders of 1008 * 512 = 516096 bytes
9 Z! X# Q7 d T Device Boot Start End Blocks Id System
' [7 h+ G1 \0 y$ [6 v2 o7 k /dev/hda1 1 1000 503968+ 83 Linux
; m* l$ T/ C: y# Q' q9 V) W' d Command (m for help): w
1 w: _; ^& M! n y$ n; ?$ ~ The partition table has been altered!* {' C& j, I# `! ]# e! N& T4 U" `6 q
Calling ioctl() to re-read partition table.
$ t1 W8 x0 G s5 N' F+ t& ] Syncing disks. z9 O" S: B7 T5 U! N
//格式化新分区
' q+ M) b* R" @8 m& o2 H2 D4 G) omke2fs 1.32 (09-Nov-2002)$ G2 u+ C$ x: z% q7 {5 Q
Filesystem label=
0 W& I6 T7 N: W( K% d+ M OS type: Linux: \8 Y9 E7 B, P; [( f! K
Block size=1024 (log=0)
) W9 K7 ^ W; O; C k8 | Fragment size=1024 (log=0)) X' z$ U4 s' a( g3 X
126480 inodes, 503968 blocks
; Y% Q4 _0 Z' w% K 25198 blocks (5.00%) reserved for the super user5 t, V" r1 k V: \$ ^
First data block=1
( D: U; _6 I: M1 ]+ }+ p8 ~ 62 block groups
8 L* o0 x8 f0 a. k( u 8192 blocks per group, 8192 fragments per group5 `! u( d* [+ e% d9 _
2040 inodes per group
0 H" W/ X) r7 D+ Y" { Superblock backups stored on blocks:
- J# W9 `" D8 M0 o2 X 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
3 O: l! b! ^" w! l- v9 y Writing inode tables: done
+ Z$ k9 P# q' h# t+ T$ K Creating journal (8192 blocks): done, X* u- J8 a0 r! a c
Writing superblocks and filesystem accounting information: done- o; K& |( H( @9 x i p
This filesystem will be automatically checked every 30 mounts or- m {/ y6 E$ `0 Q2 u
180 days, whichever comes first. Use tune2fs -c or -i to override.
7 E0 i5 O0 ?6 K文件系统 1K-块 已用 可用 已用% 挂载点
W6 b2 N+ N. H- Z( \ d /dev/sda3 3723848 705992 2828692 20% /0 c! g; b7 _! V# [6 l% u# e0 j5 D
/dev/sda1 101089 9274 86596 10% /boot$ t$ d B% F+ [
none 14520 0 14520 0% /dev/shm! p5 L3 j" e2 P3 y4 G
//挂上新分区
+ b- ]. T. |3 p3 r+ P- mount /dev/hda1 /home, Q% H% Q" H2 J7 }$ ?: _
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点3 Y$ O: d$ y0 y9 J0 ~+ s* A+ I
/dev/sda3 3723848 705992 2828692 20% /
, ]* K2 J8 B: H4 Y, V F /dev/sda1 101089 9274 86596 10% /boot
& n0 J4 R# W4 y) D8 H none 14520 0 14520 0% /dev/shm
% ~7 T! j* A# {0 t# w9 w% d& _2 ~/ T& g /dev/hda1 488006 8239 454569 2% /home5 W3 U- a. R7 R3 [
! N( a1 l# ~: u6 X自动挂载:9 |- S$ K" C, e' v* r0 h0 W
- vi /etc/fstab @$ A5 B, z2 }9 b8 N
- 3 M/ J5 S" A3 a) t" [! _! G
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0- p0 O) {3 ?. d! y! A( n v
- ( r3 y1 E6 I A7 a0 o( M L. M
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:2 [# W; C/ b8 V
- mount /dev/sdb5 /mnt/ljp1: ^0 w. ~1 g8 Y' T; j. d; ^
- , {9 z; U( I9 _- X1 l
- mount /dev/sdb6 /mnt/ljp2
复制代码 . E' Y' C# F: X% b7 B6 c
8 K1 f. G# x- A
, b. N3 b3 Q" V' z9 T |
|