|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
2 [4 s! H: C, ~' s& _ or: fdisk /dev/sdc (for the third SCSI disk)
! S0 ]3 e% Y- O1 c or: fdisk /dev/eda (for the first PS/2 ESDI drive)3 U& t/ `$ H- P( G) ]0 \
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)( n4 v/ S3 X0 [8 d
.... a, L) l" H* h5 i% E+ l
- df -k
0 w4 C' i' ]7 \3 q& M. n - df -lh3 k7 P Z. n. J9 X1 ^4 E, ~
- 查看有几块硬盘:fdisk -l
0 g5 _! K+ P$ s& _4 C2 P- m
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
# v2 s$ X9 }5 Z /dev/sda3 3723848 705968 2828716 20% /
7 Z f3 \4 B# a5 H7 m' S /dev/sda1 101089 9274 86596 10% /boot% D6 A: @ |# C$ O+ |' W2 Y
none 14520 0 14520 0% /dev/shm( l2 p3 L4 d x% [
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
4 q6 z. ~9 w* C: O+ H: s. SDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
" W: {7 V; S, W8 K2 {5 n Building a new DOS disklabel. Changes will remain in memory only,
3 w \" a; C0 R9 n2 Z7 G5 X until you decide to write them. After that, of course, the previous
0 D% S0 W1 F% t) Q# m content won't be recoverable.+ t* l; ~5 a' B n! i" S; |2 }3 P
The number of cylinders for this disk is set to 8322.
4 q. J3 ^$ ? v5 b$ U6 l There is nothing wrong with that, but this is larger than 1024,
; K/ r1 d7 D0 |2 F0 J' N( I* H8 i and could in certain setups cause problems with:5 w: G: y9 r. @$ {
1) software that runs at boot time (e.g., old versions of LILO)
" d& b6 j; ?) [5 z1 r8 R 2) booting and partitioning software from other OSs2 p% ?' N7 G7 j. p6 f) W9 U
(e.g., DOS FDISK, OS/2 FDISK)- Z* K2 c- C6 j) f
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
( ^; N, @/ g! S Command (m for help): p4 `# H% ~% q) s; g! l2 z! H; ]# i
Disk /dev/hda: 4294 MB, 4294967296 bytes
: h1 g: w8 q3 g! z4 y. B 16 heads, 63 sectors/track, 8322 cylinders
9 M* t4 f% \* t! j; \4 S' L/ j Units = cylinders of 1008 * 512 = 516096 bytes
# V# [/ H4 ~0 Q: w Device Boot Start End Blocks Id System8 {' x, F' B* I0 {
Command (m for help): m
6 m9 g1 Q6 L5 A- e8 F Command action
M# ?7 i3 U# N3 I" N L a toggle a bootable flag
& y5 l* [0 ]/ n% G4 S; ] b edit bsd disklabel3 V9 {, {. Y* ~ w& d; X) F; \
c toggle the dos compatibility flag6 s% }: {$ k9 q& C- U
d delete a partition
: N, F- v) S0 i5 M/ l4 {7 k l list known partition types
7 p4 B' d; R* w- E& B m print this menu! P$ Y% l; H' D, T. K/ R% N
n add a new partition
* `& p- K( @. i$ V2 r o create a new empty DOS partition table% Z( d5 v4 q' H! ^: Q& s
p print the partition table
( Y6 C, A7 r( O% j7 j q quit without saving changes
( t ]: y" ~0 t' q s create a new empty Sun disklabel4 H& Q. X. K2 N+ G0 } r/ z! `
t change a partition's system id& V9 A' W9 S2 Q2 c K- \% p* z
u change display/entry units
, Q o9 \8 i4 N6 M1 y( R3 u6 P2 }" s v verify the partition table, ]$ D$ s- Q/ U) x
w write table to disk and exit
. O! h/ L- D3 A x extra functionality (experts only)6 Z( h) K, S4 x: U8 g- i* I0 v
Command (m for help): n- q0 d+ x( [8 i8 s
Command action
) ~) ^# @# v; Y$ A# ]7 }: x: J e extended
+ M, S. R- e, s( ^' w5 D p primary partition (1-4) x* \7 o3 k0 N9 n0 g2 ~
p8 m; j$ ]8 C! L
Partition number (1-4): 1
# {" A: h$ D- @7 w* E$ V First cylinder (1-8322, default 1):
& n* K8 F2 a5 @# b A Using default value 1
: o0 X% D1 C6 A3 S Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G) U, U* S( t0 Y
Command (m for help): p# W* t4 c1 m* p5 O0 A& }
Disk /dev/hda: 4294 MB, 4294967296 bytes
% K( z& |7 e' D/ e/ X! s2 o) p 16 heads, 63 sectors/track, 8322 cylinders
. R' {7 @( j1 @" s* ^2 F4 ` Units = cylinders of 1008 * 512 = 516096 bytes
4 {* P5 \7 n$ A; k Device Boot Start End Blocks Id System5 g0 g- n* H9 @
/dev/hda1 1 1000 503968+ 83 Linux
7 e$ c+ l% Z1 h* G3 V+ q; w/ w Command (m for help): w
4 j: @8 L4 ^ [ V" @ The partition table has been altered!
1 Q$ Z! _: p9 h) ^ Calling ioctl() to re-read partition table.( u0 T2 G) w7 L; h9 ~
Syncing disks.! f9 U* N% V1 n3 t+ _# }
//格式化新分区
; M- ^+ n6 w) P/ r4 E! {1 x- ~( \mke2fs 1.32 (09-Nov-2002)
2 Y# ~. V; H" B3 k0 c1 s$ _ Filesystem label=
5 R6 m% T/ L+ \& H5 Q+ {5 z OS type: Linux! p; A! n9 Q* v2 A5 S* v2 V9 H
Block size=1024 (log=0)* |. j. B `" x- a+ y* [
Fragment size=1024 (log=0)
$ i9 M% I. g& f' H0 { 126480 inodes, 503968 blocks' L5 B4 w. s6 Q- t, ]3 }! B: T. i
25198 blocks (5.00%) reserved for the super user
* }$ ]$ ?7 ]: i! R! a, [& n1 y First data block=12 S& C& w7 M& w+ e/ j) j, x
62 block groups7 V7 |* R2 s1 R1 f$ Y. w7 k5 L* B& f
8192 blocks per group, 8192 fragments per group5 C. S( J& y, C1 X6 }
2040 inodes per group% Q! j' R5 S; A( n$ T0 }
Superblock backups stored on blocks:
7 p$ ^2 j* Q$ |6 ]( M/ S0 R5 | 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014090 o: C7 B4 P6 B& @1 J! F2 Z+ P. [6 g
Writing inode tables: done
9 U* ~ P. [$ @( C Creating journal (8192 blocks): done# g6 ^# `$ f+ C5 P1 P H1 [
Writing superblocks and filesystem accounting information: done
2 v2 J3 p/ U6 |" e, [( U This filesystem will be automatically checked every 30 mounts or" c. D$ i6 q7 e* I: A" ]- E3 z8 \
180 days, whichever comes first. Use tune2fs -c or -i to override.
3 |" _; |7 r5 y0 y" L文件系统 1K-块 已用 可用 已用% 挂载点" P+ F, s2 o* \# E8 ]
/dev/sda3 3723848 705992 2828692 20% /
* x% O" s+ @6 r: } /dev/sda1 101089 9274 86596 10% /boot/ `' Y, O/ q K7 i& u* P. D* W& N
none 14520 0 14520 0% /dev/shm
$ U! M6 O3 ^2 m& n- S, p& B //挂上新分区
: R- k' }3 W/ P- mount /dev/hda1 /home
" P4 b3 W, M5 z - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点- Y- ]/ z; K' u7 x+ @, Y
/dev/sda3 3723848 705992 2828692 20% /
0 n& P9 n* q1 l5 k& d+ t% I) f /dev/sda1 101089 9274 86596 10% /boot) c5 q% H/ B/ I% X
none 14520 0 14520 0% /dev/shm
5 R7 r0 Y, d j% S4 |; p /dev/hda1 488006 8239 454569 2% /home
: E( T; u8 u" P9 X- }+ v0 _8 q3 _6 t0 k* G' i* a4 _# r5 x
自动挂载:
* c# X5 U2 }( c4 L& v- S8 X1 J- vi /etc/fstab
3 B! {' r$ V! @+ W# K
$ C/ V4 z: T8 }: O Y; |- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 03 O0 F3 Y+ o8 c' A9 S a9 H6 m2 Y
, x1 |( o9 S. ~- u8 o- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: r1 n6 z: j; O6 E; n" F7 A+ D
- mount /dev/sdb5 /mnt/ljp1" a% F! [ K/ @
8 B, q; M) ^5 P3 n- mount /dev/sdb6 /mnt/ljp2
复制代码
0 M9 H+ X8 n: R! t% g: O
- B' ^& P; z y) E1 A2 n5 _
1 O8 V+ ^2 t5 h- L6 ~, c$ Y+ o. t |
|