|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)$ Z) ]! |" x( l0 ]9 q
or: fdisk /dev/sdc (for the third SCSI disk)
# {3 k, b' S. g or: fdisk /dev/eda (for the first PS/2 ESDI drive)4 c1 \2 \0 i( p- u0 _& M& W; x. i
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
: D' I! t3 p1 y) I# K/ L ...
q2 v9 d j; g# v; I1 h, z- df -k' I. i! x9 }% y& \: X; n
- df -lh
h: `. F% \7 g* Y0 K- n" A - 查看有几块硬盘:fdisk -l
6 ~) K" ]4 l% O9 u7 Z
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点0 h F# G+ h) }- i U3 y
/dev/sda3 3723848 705968 2828716 20% /% c. k ^6 I: y6 L$ p& X5 C i1 Y
/dev/sda1 101089 9274 86596 10% /boot
% Z; B- c) @. [: ]2 _) N none 14520 0 14520 0% /dev/shm0 t; n* y+ z0 b4 T% K3 X0 g
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用' ]4 R2 k, D0 Q, w! ^
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
1 i. L0 b8 H/ A) u Building a new DOS disklabel. Changes will remain in memory only,7 Y& w/ m) l* }, t
until you decide to write them. After that, of course, the previous
2 h! Q3 p9 m: D8 A- a1 D9 U/ d content won't be recoverable.
. \3 `& J8 J' f a5 b- o The number of cylinders for this disk is set to 8322.
$ Y3 _. I0 j; U; |8 [+ ] There is nothing wrong with that, but this is larger than 1024,2 T* S8 v; Z. D2 d3 J1 e" f
and could in certain setups cause problems with:5 T) P) d7 ]& H4 R$ F
1) software that runs at boot time (e.g., old versions of LILO)
" E G4 O: s1 F 2) booting and partitioning software from other OSs2 B& v! j' p. q$ f7 _
(e.g., DOS FDISK, OS/2 FDISK)
9 h4 a7 f2 b: @6 I/ F+ s Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
/ a: q: P6 q2 f" V Command (m for help): p
7 z4 X7 x; q# m: b Disk /dev/hda: 4294 MB, 4294967296 bytes
! r; M. J8 @$ @* T! c8 i; C. v* u9 h 16 heads, 63 sectors/track, 8322 cylinders
+ y" t3 ?' i! M6 F Units = cylinders of 1008 * 512 = 516096 bytes# [0 T3 z: ^/ l( P: z
Device Boot Start End Blocks Id System8 j9 [% ~" p, r& k! @' e
Command (m for help): m0 Q% y6 P* D+ g- V, P9 @
Command action
7 O9 e) W) K( u, P a toggle a bootable flag
* u& I' x$ [& g* f2 ` b edit bsd disklabel. t9 D* N# u: ?2 c$ X8 f
c toggle the dos compatibility flag6 m/ P; J# |- N% k
d delete a partition+ b5 \) h9 s4 [9 F' c' q$ w' i
l list known partition types! x' m! h W2 u- e# A3 A! s
m print this menu8 C9 ?5 w% \7 w5 u( P6 @7 b
n add a new partition
$ ?* ~. l" h% E9 m7 y o create a new empty DOS partition table
% `. o1 P( y5 S) Y* s+ ^6 T p print the partition table
# ]7 w3 E3 J7 i q quit without saving changes2 ^ ?2 G$ U Z, Z
s create a new empty Sun disklabel+ Z4 S: J6 x1 ~* [4 D
t change a partition's system id% I% F w7 G. A, Y7 P" c) {
u change display/entry units9 W1 ~/ X+ d& ^: L5 n% M
v verify the partition table' y: x% p; W+ V1 B
w write table to disk and exit
7 g; ]! l' b) B x extra functionality (experts only)
M5 L# G5 f* D% c7 i1 i! v Command (m for help): n3 c2 Q: y/ a( y
Command action" V8 `4 Y# \2 g: h( n
e extended
( \+ N6 g, J' u X! Q8 ~ p primary partition (1-4)
, `, y# Q; R1 Y' n p- B% D* N# X/ i
Partition number (1-4): 17 m- N6 I- i% t+ X8 f3 {8 {6 D
First cylinder (1-8322, default 1): ' j* R$ s. M* c1 N9 W( P* I
Using default value 1: n; w" V# B1 W) R9 w' ?: V
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
; U4 a) S0 N9 d( H8 E+ E$ |1 ~ Command (m for help): p
. w. W$ v, G; O- A! b7 r Disk /dev/hda: 4294 MB, 4294967296 bytes6 e6 s' v' x# q+ N2 M- S1 I
16 heads, 63 sectors/track, 8322 cylinders9 n @- y }" { D, }
Units = cylinders of 1008 * 512 = 516096 bytes# |% E$ i* l3 ^2 C F; k
Device Boot Start End Blocks Id System2 r' e/ W+ J) A9 O9 V
/dev/hda1 1 1000 503968+ 83 Linux4 v3 k( }) j0 ?; X; ]1 n/ p# f# W
Command (m for help): w
# s0 o8 ^" q& ?6 O( X5 ^ The partition table has been altered!
- t) r3 Q. Z( V2 T+ {: G" z Calling ioctl() to re-read partition table.
$ ]1 g7 C: t) D" e2 x2 R" [ Syncing disks./ w7 C- L( ?9 t1 T
//格式化新分区7 D) G4 o" X# D( H
mke2fs 1.32 (09-Nov-2002)1 \0 G! @' f/ \( c; T
Filesystem label=
+ k9 V, _$ Q" D( K4 I1 Y. e- Y: B+ I OS type: Linux
7 p8 u; s3 a; S) I I Block size=1024 (log=0)) Y* {3 w8 i, B+ v8 D
Fragment size=1024 (log=0)
; u1 B h% x% Z4 S6 e 126480 inodes, 503968 blocks- j+ _: m2 U9 E1 ?3 d0 K$ k% p
25198 blocks (5.00%) reserved for the super user% `+ J, \4 g5 O5 @" i f4 v
First data block=1, r& G4 W- V7 {& ?
62 block groups) _& N: b. ~6 \0 M1 R2 L
8192 blocks per group, 8192 fragments per group
7 I0 {1 ^9 D5 |+ p' Q0 R# L; A9 {5 c/ r 2040 inodes per group7 y' l# d0 H" C, x
Superblock backups stored on blocks: : f7 ?7 D0 z: D o3 L5 @/ U
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
* W. {2 K$ L. u+ p/ P) p Writing inode tables: done
5 O4 |0 `$ u9 a Creating journal (8192 blocks): done
) ` k& ]8 I% g* D1 a5 S Writing superblocks and filesystem accounting information: done
& R' L& {. s; n; B; t This filesystem will be automatically checked every 30 mounts or
0 j9 g+ c$ V: D6 W7 _' F5 b 180 days, whichever comes first. Use tune2fs -c or -i to override.
4 Q) Y& X( U6 t, x; y+ d文件系统 1K-块 已用 可用 已用% 挂载点
6 _' H% Q8 p) u$ h. I% \ /dev/sda3 3723848 705992 2828692 20% /& V' M5 a8 x! b! f$ P$ p
/dev/sda1 101089 9274 86596 10% /boot
& L2 h) i7 ]* T) Y3 C" e4 ~5 ~ none 14520 0 14520 0% /dev/shm T2 R% ^2 r0 t% W$ v
//挂上新分区5 S; Y2 v2 R+ S! \
- mount /dev/hda1 /home( S/ Y+ o$ ]( ?
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点6 j2 j7 P1 Q! n% U/ @4 N/ w" F
/dev/sda3 3723848 705992 2828692 20% /
, c5 P: k, B% ^6 ]; | e' M3 Y$ m /dev/sda1 101089 9274 86596 10% /boot" _& r0 V7 F$ w) m
none 14520 0 14520 0% /dev/shm
1 ^) _2 X' i( }& Q- Y/ G( k) W /dev/hda1 488006 8239 454569 2% /home* D0 r4 G9 p7 V, ]4 g
5 @& a' ^( a; z$ ? e& c; {+ b6 G自动挂载:7 f. Q' Q) q- H
- vi /etc/fstab' i7 W; T$ u3 f# f. a: o1 ~
- F8 e X7 f9 _
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
" P; @3 t: y l8 [. E - 0 A$ r5 l0 O& p6 @7 I8 e
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:: E4 Q) s$ ?) s) o
- mount /dev/sdb5 /mnt/ljp18 G0 B( c8 b8 `
- ( L; R# @0 {" w% w# P4 k* N' n
- mount /dev/sdb6 /mnt/ljp2
复制代码 . q. n$ d- Y8 c/ {5 x' g& c! E
o3 y, E9 B. H6 @! e, x
o3 c+ [& @8 y |
|