|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
' ~( F& I: L$ g% X# u8 Q5 L' ~ or: fdisk /dev/sdc (for the third SCSI disk)
% |/ m! { K1 j f; c# S or: fdisk /dev/eda (for the first PS/2 ESDI drive)' A$ R- B! J- S8 w8 S3 q
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)% ~3 l5 T7 F4 r* t: D
...3 x, x# r0 {# F. r0 Z# C
- df -k
& D% c3 T5 ?9 `5 ~( F3 D - df -lh
4 s0 Q; ^" M; l! W% r- n - 查看有几块硬盘:fdisk -l
- c; l0 O+ Z1 w8 o' E
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 l! \( f `9 m2 `1 |" e
/dev/sda3 3723848 705968 2828716 20% /; Z( f! r7 A6 c' p
/dev/sda1 101089 9274 86596 10% /boot- R% N! s9 p6 A& {# t0 ?
none 14520 0 14520 0% /dev/shm: u& N8 R n6 _& v
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用5 d. J7 ~/ o9 o" N* J
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel6 A: r, l% h; ~3 x" g! L
Building a new DOS disklabel. Changes will remain in memory only,
6 ?7 l8 C3 I4 c4 n until you decide to write them. After that, of course, the previous m$ @* d- D( ]
content won't be recoverable.& X; r$ N& ~: C5 K
The number of cylinders for this disk is set to 8322.
) i' p6 K8 i8 u4 m& ^& p. \1 L There is nothing wrong with that, but this is larger than 1024,
# k/ [. a' \2 U0 ]& U8 ] and could in certain setups cause problems with:' v$ n2 o2 t- @
1) software that runs at boot time (e.g., old versions of LILO)" ^# J+ Z: ]1 x6 r% Y: ^6 ?4 _
2) booting and partitioning software from other OSs0 x# o; k; L, V# \. K! U) l
(e.g., DOS FDISK, OS/2 FDISK)
2 t: p9 x( e& P- z" w% F' | Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)" j7 P# {2 x. a0 t
Command (m for help): p- h" |7 v* C: i. z
Disk /dev/hda: 4294 MB, 4294967296 bytes% Q: \# D* e4 b
16 heads, 63 sectors/track, 8322 cylinders
8 `% r7 w) C0 {0 @3 `- f, | Units = cylinders of 1008 * 512 = 516096 bytes
4 C7 N( t# j8 w8 z2 R Device Boot Start End Blocks Id System
% o" ^% r3 T% W8 d+ _8 X Command (m for help): m
8 l4 R' `# k4 k5 H Command action
: _- _' k6 ~4 ]0 G a toggle a bootable flag
# s" y: w* A3 X# C A, b- R b edit bsd disklabel
7 C# u& A( c) }0 j+ J c toggle the dos compatibility flag+ B* \. s0 Y3 \/ m
d delete a partition, N9 R% ? R6 C$ t. C, M
l list known partition types/ x( Z6 `/ d8 W/ ^ l# U
m print this menu+ g. E2 D8 r8 b
n add a new partition; Q1 u3 ~/ U- `
o create a new empty DOS partition table
& V- s+ T$ a' I p print the partition table
& I0 u* V# _# g: Z# K q quit without saving changes+ W: Y) i/ a3 T) g
s create a new empty Sun disklabel5 m* }6 E; k& G, @# @% }$ u7 Q* z
t change a partition's system id
) M) q' J, u' l; W% k1 N u change display/entry units3 W$ z- P4 z- `2 P6 y
v verify the partition table
( x- r2 I" B8 s' g5 L i3 I) A) e9 w w write table to disk and exit4 k5 U% }+ ~, @" Q. F4 p8 i
x extra functionality (experts only)
3 p2 n& N9 V2 y* a Command (m for help): n+ `1 E9 r" y' Y s: K: J* T
Command action1 D7 a# M$ O6 M) K" t$ v2 J. c
e extended. n0 x& ?! m3 R6 x9 H
p primary partition (1-4) P! W$ f9 ~0 [
p
8 s# g$ e/ ^9 @, O: ` Partition number (1-4): 1
2 ~ m: J L6 f+ q1 A First cylinder (1-8322, default 1): 7 g6 K( G! p0 U u+ y* S
Using default value 1
0 Q1 Q& u) s1 E- z# `9 K, i, {* q Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G/ |& z2 c$ T y% {7 O
Command (m for help): p
( t5 r, w2 J; _( U Disk /dev/hda: 4294 MB, 4294967296 bytes
- M/ @3 e2 U6 G- d+ z 16 heads, 63 sectors/track, 8322 cylinders
, f9 b6 O- {; E4 A5 T% } Units = cylinders of 1008 * 512 = 516096 bytes* a$ f! p+ R4 [, n! p! d# X: I
Device Boot Start End Blocks Id System
/ a6 D1 K8 @. Q( U( @ /dev/hda1 1 1000 503968+ 83 Linux
, a6 L3 j6 u% s- K* R3 y, {+ Q Command (m for help): w
* a' }9 F+ R' k( X' @$ J The partition table has been altered!
( R, G ], ~6 q$ Y Calling ioctl() to re-read partition table.
, e7 H5 z1 R$ l# R" G Syncing disks.
w: a! O1 i Y4 I //格式化新分区& R& l: U$ c8 u' m ~* r; |; ~
mke2fs 1.32 (09-Nov-2002)
5 H# k/ \' h5 u, m! e. m Filesystem label=5 q8 x) x( p: E Q L! [* S
OS type: Linux
$ p0 N- t: a( p; ^ P L; w5 A Block size=1024 (log=0)7 f/ a4 P: J9 I6 s+ }3 M! @) W. g
Fragment size=1024 (log=0)4 e# }- ]2 k- L5 m4 \7 [: F
126480 inodes, 503968 blocks
; z' W' e8 x: q% L6 F& E 25198 blocks (5.00%) reserved for the super user
& C# m4 O4 J3 y First data block=1. Z2 m L% E( B1 ^ Q0 g- |
62 block groups6 F7 z6 r. j* I
8192 blocks per group, 8192 fragments per group
( F7 ^, D! i! F- X0 _+ T0 v; ~ 2040 inodes per group! [* `. f1 G8 {; ~4 b D1 M$ E8 V2 H
Superblock backups stored on blocks: , Y$ S1 M+ E2 H ?; V5 s" N: R
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409( b/ ^& T) ^2 E9 j8 s. P9 U" |
Writing inode tables: done
6 B$ B; a0 ?2 o/ O& W- ~9 m Creating journal (8192 blocks): done
! W1 V K7 i6 z; ^0 r1 l; w Writing superblocks and filesystem accounting information: done
m' K* S- \5 N+ Q6 e6 ^ This filesystem will be automatically checked every 30 mounts or# c3 T3 D3 [; w# ^8 C L7 _& R F
180 days, whichever comes first. Use tune2fs -c or -i to override.$ E6 v7 O( S+ \5 D# R$ H8 J
文件系统 1K-块 已用 可用 已用% 挂载点
: {" g5 j0 l- V. k! m9 n /dev/sda3 3723848 705992 2828692 20% /5 I' P. [! O9 k+ p7 C$ B' Z
/dev/sda1 101089 9274 86596 10% /boot
. Q) f- u/ O* { none 14520 0 14520 0% /dev/shm! `+ q6 s' z$ ?( s8 E* K/ `
//挂上新分区/ Z% }3 S/ {6 X+ v/ ]
- mount /dev/hda1 /home
4 \* \- C% q& {3 k& u& Z e2 {- d - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 t' Z" H9 S% ]4 Y+ u
/dev/sda3 3723848 705992 2828692 20% /
, o4 ^: E9 |: U. R1 ~8 F& [9 X$ D /dev/sda1 101089 9274 86596 10% /boot
$ ]1 v; ?) ?' X* l none 14520 0 14520 0% /dev/shm
; Q8 I u6 F: ], s( `% i4 t) y* c5 b /dev/hda1 488006 8239 454569 2% /home
/ A# E+ s: N! f9 f0 s$ x1 p: y
( s$ c" Q7 R6 D6 c2 q/ X8 q自动挂载:1 P( U+ U) G6 `) B) C% J
- vi /etc/fstab0 Y5 s2 k& |" a% N3 l0 i
+ E' V6 x# s& A- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0% o2 B V4 m: C- C! m
- & Q# K! k$ K2 \6 i/ T; s1 s( o
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
; Q6 [* z/ P' [: ? w- mount /dev/sdb5 /mnt/ljp1
3 U9 H0 c5 ^6 ` - 3 a$ N3 r( W$ z& D' W- n' u6 L+ K
- mount /dev/sdb6 /mnt/ljp2
复制代码
}& X4 ?% C) @7 z! l: U* @2 q( a* k4 b4 u4 y
! |5 T4 {6 F/ n4 F/ [: n* B
|
|