|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)$ g8 C) v/ f& ]$ M. s
or: fdisk /dev/sdc (for the third SCSI disk)7 s1 J" {- ^1 V3 _. }! X7 @
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
1 N/ Z. ?: @+ q8 f0 f1 Q7 R or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
) Y" y6 E7 C2 W9 P3 W$ a ...
% w' N5 m6 O, z& u2 S: o" ]4 w! I- df -k
, @0 D j6 g& |* i - df -lh& o: M2 d& P9 q6 m0 u2 c
- 查看有几块硬盘:fdisk -l$ b! e* C7 M3 e2 U% q" C
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
6 Z; P7 b. D0 [3 h/ }, `/ ` /dev/sda3 3723848 705968 2828716 20% /! y: V3 n" r7 J& h+ b% Q: w
/dev/sda1 101089 9274 86596 10% /boot
, i% n% E- H) y- L9 A2 Q8 o none 14520 0 14520 0% /dev/shm
2 d) a' d C0 m+ \: a 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用. Z- h* l7 Z- v7 e) H
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel" J7 A4 G' V& h
Building a new DOS disklabel. Changes will remain in memory only,3 d' _1 ]( M( E; p Z; [- H
until you decide to write them. After that, of course, the previous
( b6 p& \- @# Q W6 I% D content won't be recoverable.
: J; u+ S( B6 Y. Z5 f# F The number of cylinders for this disk is set to 8322.
# Y8 o8 k/ S9 f! S1 p; p2 W4 p6 s There is nothing wrong with that, but this is larger than 1024,; a, F! h8 [- V |& v7 _4 X7 W
and could in certain setups cause problems with:. y ]; |) w) S- E" n" l9 {5 N0 v
1) software that runs at boot time (e.g., old versions of LILO)
8 c4 d. c+ P$ q7 z! Z 2) booting and partitioning software from other OSs7 S1 j9 f ~! K: |5 ^
(e.g., DOS FDISK, OS/2 FDISK)! |4 f' s$ ]$ _+ V$ M# m5 `0 y
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
# ~& M# @- S" k+ R3 E Command (m for help): p
1 [7 x' S+ t. ?: y+ S5 i Disk /dev/hda: 4294 MB, 4294967296 bytes5 n, y3 h0 a" [- E! _% z5 j# q
16 heads, 63 sectors/track, 8322 cylinders
* _) y! F4 o6 S3 ^ Units = cylinders of 1008 * 512 = 516096 bytes7 p: E; `& L6 w0 E3 r4 O
Device Boot Start End Blocks Id System# `9 Y% U8 C) r+ J1 P+ F
Command (m for help): m# f8 e9 {7 u @: |' |) Z; s, G5 ^" Z
Command action6 y6 d, g' Y7 b& G5 ]6 F
a toggle a bootable flag
6 z) S6 h4 C4 q6 T! Y b edit bsd disklabel5 `4 B- c1 ]% z# @1 q2 F/ `- G! `' R
c toggle the dos compatibility flag8 v+ z. B+ L. ~3 q4 V, \$ F- y
d delete a partition+ |9 o* o7 t' x1 }2 I! R
l list known partition types9 ] z, B( D, h4 B3 r F5 g) d! C
m print this menu
+ T- u+ f8 m k8 u. k2 u/ w n add a new partition2 R$ j$ H* r) l1 N% e6 s+ U5 z
o create a new empty DOS partition table3 Q) c; t2 C+ {1 Y. a
p print the partition table, ~) f' z) w$ i4 b$ R3 V, m' |
q quit without saving changes
. {5 \2 W0 A, r N4 z# }5 P s create a new empty Sun disklabel
# [+ ^ e& L$ {% w6 A: I$ H w2 a& } t change a partition's system id6 B: d. M" V X# B, C. R: U
u change display/entry units
2 v+ F j& j* l/ t" h P v verify the partition table
X0 D9 |! W: e- C9 C3 j3 U# x w write table to disk and exit0 T' }/ G/ `2 i* B9 v1 k' w% E% a
x extra functionality (experts only), C& b# p4 h1 d
Command (m for help): n
& S. H4 @: Y0 J) V* y3 H0 Z Command action
; L" B" m2 \; p! U4 j- i e extended
' u# V \4 [5 b; k4 R, t4 q# g8 A p primary partition (1-4)2 a, ~) a5 M% y4 S% ~
p6 B2 \# d" o: W5 H$ q
Partition number (1-4): 18 ~" h: o( I5 h+ p: |/ T
First cylinder (1-8322, default 1):
% X9 W$ i- T& D- S9 U! F$ v Using default value 1
# u8 ?. U+ T) R5 W- t5 Q Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G, W# C4 r! x: `3 j+ M% q
Command (m for help): p
0 g2 y* k5 X s9 g1 r Disk /dev/hda: 4294 MB, 4294967296 bytes
! t; z" V0 ^3 E6 C B; y 16 heads, 63 sectors/track, 8322 cylinders
6 T# o* U/ a3 g4 P# U) E Units = cylinders of 1008 * 512 = 516096 bytes
! e6 a3 X0 i- R4 C! t Device Boot Start End Blocks Id System/ F1 y* a; q/ x) Y
/dev/hda1 1 1000 503968+ 83 Linux" i% d8 A | q
Command (m for help): w( P9 R+ f% M/ Z$ c0 [4 E c& B6 z
The partition table has been altered!! O; o; ]0 v$ n+ F& p9 q* y
Calling ioctl() to re-read partition table.9 \- G! K+ Z- ]# t4 O
Syncing disks.
( l% {" z( F; h4 `# z8 Z& A6 ]; v //格式化新分区
/ n A* x7 }- u/ }) b4 o2 \9 Pmke2fs 1.32 (09-Nov-2002)
a* i6 [ z7 F2 R/ H; [1 e8 Z Filesystem label=! \5 _, k. W' x) d
OS type: Linux5 u2 r3 a3 d+ E( _& k
Block size=1024 (log=0)
+ g3 `* t! U' m$ [ R Fragment size=1024 (log=0)
# z5 ?( D$ E) f' D0 @ 126480 inodes, 503968 blocks/ C- h0 J& w2 M4 B0 R9 q& z+ a
25198 blocks (5.00%) reserved for the super user) i3 j0 q) s, M; E: Q
First data block=1
3 y: ^/ v, y0 P" i1 B 62 block groups5 ~; Q3 i0 z3 M" s
8192 blocks per group, 8192 fragments per group8 z4 A! M; |4 I9 [- T8 c; y7 p
2040 inodes per group
% ]7 ?* i6 ~$ p6 f Superblock backups stored on blocks: 2 a! s% _# w2 i* t8 t0 [* ~
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
$ s- }" y# V" b( p- S) j. J$ P Writing inode tables: done & s, q' c- U. E1 i2 a
Creating journal (8192 blocks): done+ L# Q* v( Y7 l- P
Writing superblocks and filesystem accounting information: done O1 R6 y& x! }0 m
This filesystem will be automatically checked every 30 mounts or: W; H8 z/ D- y
180 days, whichever comes first. Use tune2fs -c or -i to override.
* [! U5 k3 P1 D4 P/ { G文件系统 1K-块 已用 可用 已用% 挂载点* B) H+ q B" U, y. A% ~" S" q; D
/dev/sda3 3723848 705992 2828692 20% /. `8 F' k+ [4 b0 X
/dev/sda1 101089 9274 86596 10% /boot
7 q5 d2 x$ d" j& Z* f- F none 14520 0 14520 0% /dev/shm' b% V- i7 J& w u; V& z% s1 ~+ g* F
//挂上新分区
' q, @0 v' s! Z1 m- mount /dev/hda1 /home/ D6 ?% t9 o2 L/ P) r, Z& [
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
- D5 F; K; \. ~- M; j. M) a /dev/sda3 3723848 705992 2828692 20% /( |2 m/ F8 _% J
/dev/sda1 101089 9274 86596 10% /boot
/ D; y$ w" Q c- m none 14520 0 14520 0% /dev/shm# i! E6 p9 Z% V; q ^5 K
/dev/hda1 488006 8239 454569 2% /home
2 u9 h5 P1 w2 {* u" G
' V0 L3 T) x; z d9 M- B$ ]1 H, G自动挂载:
. U* K3 W& r+ `6 {- j* B# P6 W0 m- vi /etc/fstab
, ]+ r% S) j. F8 G; K, a) ^ - z! ?- V1 N! i4 r/ S
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0# J* y3 |. K; o# o7 U$ i
- $ x4 H# q) n" T. k; b
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
1 l* d: k# y+ ~5 t# s1 ^- U. O% d- mount /dev/sdb5 /mnt/ljp18 i) Z k1 X" N% v Z! D% f
! e$ h r4 i9 q; V- mount /dev/sdb6 /mnt/ljp2
复制代码
1 T S$ P. D3 v" _- v6 K0 S* S7 r- T$ p3 [$ I; O
' F: f- F( g, A! H' m, r5 b |
|