|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)$ V" i q# O* V, D
or: fdisk /dev/sdc (for the third SCSI disk)
; d" _5 ]) a0 o; o, z- l or: fdisk /dev/eda (for the first PS/2 ESDI drive)
/ {6 m) L7 C$ o9 J/ }! e or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
& F6 c1 G3 c$ b+ Q ...
1 t" g5 {2 ]$ `% H- x- df -k
" ?. d, r5 H8 b - df -lh8 Z9 s6 _3 j1 u/ R( h( H: C, @: h
- 查看有几块硬盘:fdisk -l
+ a7 ?2 ]& f3 L4 T+ D J
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点( O4 l4 u# O* q$ k7 w
/dev/sda3 3723848 705968 2828716 20% /! b0 d3 _7 i' u% ^
/dev/sda1 101089 9274 86596 10% /boot
9 L0 N% J7 T6 w none 14520 0 14520 0% /dev/shm
! O, c0 @1 N6 u4 i4 P/ E, \) t- C% U: n 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
# q& \( s; y: @1 L# N( [( t D* EDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
! A# E% ^: M \0 i- L/ Z Building a new DOS disklabel. Changes will remain in memory only,
4 U6 y+ ?6 M" Y7 O* b/ u" x until you decide to write them. After that, of course, the previous; o- v+ Q* _% Z8 \8 s* H4 F. R
content won't be recoverable.. F8 ~8 j& r+ E. M# S
The number of cylinders for this disk is set to 8322. l5 B; r; W% s9 N
There is nothing wrong with that, but this is larger than 1024,4 c( C) {. b' D7 v1 h
and could in certain setups cause problems with:
& | J" x: o0 H! f 1) software that runs at boot time (e.g., old versions of LILO)6 k. @' S. U+ N5 V
2) booting and partitioning software from other OSs1 i$ x$ O. o h7 Q0 C$ `: o
(e.g., DOS FDISK, OS/2 FDISK)) f3 c$ Y3 d2 X5 s
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
( C) F4 r) x6 M5 _( u$ a1 {' z, S Command (m for help): p
$ ^; d$ M9 a9 Q/ _ Disk /dev/hda: 4294 MB, 4294967296 bytes9 ^$ j( e$ n0 N6 B
16 heads, 63 sectors/track, 8322 cylinders- {" |. p5 c' d3 R$ j% [
Units = cylinders of 1008 * 512 = 516096 bytes
% y0 u8 y/ T. o( Z Device Boot Start End Blocks Id System
, G A& F+ z$ x& l! v Command (m for help): m
! N% x4 Y' j. j4 H& Z% S Command action, c( N4 `4 O l& P3 Y8 R4 A
a toggle a bootable flag) b; W8 U/ U, ]6 N- Y+ n
b edit bsd disklabel5 w) T" d! ~2 D7 z# R) y# r& r
c toggle the dos compatibility flag
- Y( @; ^1 F' p d delete a partition
0 |( O+ C. i& ~$ c& f l list known partition types
: d+ p" B6 K4 R2 Y1 _9 [ m print this menu9 G, v/ h, x2 N" \, O4 }
n add a new partition& w3 p! \" | h: H& p; q' ^) b$ w# U9 V
o create a new empty DOS partition table6 J j, v$ j8 K* q6 \* B
p print the partition table
" @2 ~- W0 \$ u/ N* { q quit without saving changes' G$ W. {' \8 p
s create a new empty Sun disklabel
+ j; c; X& X0 h0 ` t change a partition's system id$ a5 B( n: v# }! k- C8 ?& \: ^
u change display/entry units" R. ~4 U* E6 n' E
v verify the partition table
_' t! `* J+ M0 \# K, c w write table to disk and exit- {2 Q8 f- s8 _( j& |* I0 H
x extra functionality (experts only)
: g# q/ Z1 X$ X Command (m for help): n1 L2 l9 O8 v2 F% K* U# A+ K2 Q
Command action
$ @) E$ o# x% b* I; T; N, @+ { e extended- P1 ^% A. [! ^2 X# E; U4 s+ s2 a
p primary partition (1-4)
# E5 B/ m/ e" h1 O p0 M( `8 g: c7 L; O1 B5 C2 I @& M
Partition number (1-4): 1
8 V/ M6 z% @9 k4 Q/ z0 p First cylinder (1-8322, default 1): 7 m7 [ E" [* G1 {2 f
Using default value 1
- \9 b! z& H5 |! y8 v+ Y; G% T( s Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G% @, ?# P( f' G: b0 r) U
Command (m for help): p
! A) s( x* }8 D; H) V6 Y; K Disk /dev/hda: 4294 MB, 4294967296 bytes
, E& |7 W2 ?% `6 z1 z 16 heads, 63 sectors/track, 8322 cylinders
5 b1 n$ `6 \3 ]# _, f Units = cylinders of 1008 * 512 = 516096 bytes3 _; F: @2 { b* C7 I
Device Boot Start End Blocks Id System
) }( V& i$ k4 |6 J /dev/hda1 1 1000 503968+ 83 Linux# \, f V5 [7 E+ B B; |+ |6 K
Command (m for help): w
1 d! \' q1 A% S4 Z The partition table has been altered!' W1 V, Y1 M! S3 S9 ]
Calling ioctl() to re-read partition table.9 H) Q9 ?/ E; D! r7 U. Z
Syncing disks.
! u: x( z$ M" C* B9 ` //格式化新分区7 q0 }1 |- ]) V, Z
mke2fs 1.32 (09-Nov-2002)
) {6 I) e# L- f8 Y# H Filesystem label=
* ?2 o+ ?! ~7 I4 I OS type: Linux$ O) f0 ^ z9 ^: v. i7 f
Block size=1024 (log=0)% w' Z. H( x2 r+ U4 L! A
Fragment size=1024 (log=0)
# P0 ]; I& a2 v1 d5 g) x: M( ? 126480 inodes, 503968 blocks- ?/ T) E4 I- j2 y L
25198 blocks (5.00%) reserved for the super user
8 m. k( ~5 |" _$ O; q First data block=1) a! B6 ?$ m2 z5 z! _4 |6 L7 u- f
62 block groups
7 s7 a* y" g) c( R& }& S) V7 a 8192 blocks per group, 8192 fragments per group
6 H% W9 _ l5 f4 ]) s! @ 2040 inodes per group7 z9 K+ c0 B9 @" J
Superblock backups stored on blocks: * |: Q6 M' c8 z* b. V) H
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
4 F3 W. f2 t) P3 j- R Writing inode tables: done / t4 f- I% b& p( i' D
Creating journal (8192 blocks): done( I0 ~. O# M8 [
Writing superblocks and filesystem accounting information: done6 {* |1 m. x0 ~& l
This filesystem will be automatically checked every 30 mounts or
) Y s8 c3 l' S8 W 180 days, whichever comes first. Use tune2fs -c or -i to override.
; Y7 C% K! z; [" M: E3 N文件系统 1K-块 已用 可用 已用% 挂载点
0 Y! k' j/ O m* R% _$ D2 ^9 c /dev/sda3 3723848 705992 2828692 20% / t% d5 ~$ T8 l5 f$ b
/dev/sda1 101089 9274 86596 10% /boot% P) _# d: {9 B" ?
none 14520 0 14520 0% /dev/shm+ |0 N4 ^, @6 V" K6 l/ {3 W1 }
//挂上新分区2 ^* R$ q$ ~, k% k( I- V; @# F( s7 F# L
- mount /dev/hda1 /home
8 e( _' C, G M5 n4 ]6 G; F0 G - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
7 Z" e0 d& M5 a; j/ I /dev/sda3 3723848 705992 2828692 20% /
% E9 i8 h; p( K& @: {# c /dev/sda1 101089 9274 86596 10% /boot' T3 G) S7 N# d) W3 |( K
none 14520 0 14520 0% /dev/shm
y9 f: V- V1 d# Z /dev/hda1 488006 8239 454569 2% /home
" H7 X8 C# J, [/ m9 |$ Z9 W8 t* ~2 g
, V4 J" g3 G) V自动挂载:
, f# g3 b$ m" W P- vi /etc/fstab
8 x1 c; E0 ~ L2 `$ K# ]2 E: @ - - m H% m' S2 B1 Z
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0! x, d y1 @* [4 G8 J8 b0 F5 @' }
3 _8 [% q7 T) q- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
! m) Y4 b$ H) a5 l( f- mount /dev/sdb5 /mnt/ljp1+ \6 ]3 { E0 j/ h* `
3 R) e( U8 z+ i9 V0 V- mount /dev/sdb6 /mnt/ljp2
复制代码
' a2 L e$ p( X! l' F) D/ I( E9 g, j; c3 ?" X! E; D7 @
! I' y! T* }4 Q8 B
|
|