|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)& a$ o$ i3 B( X! P' p
or: fdisk /dev/sdc (for the third SCSI disk)9 ?7 B5 A3 U- E% ]. v/ j9 h3 d2 T6 ]
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
8 I& b. r7 Q9 H or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)% `# V) [3 V& m4 C( ?
...
; g/ n3 A( `8 K2 x- W9 y5 y$ i5 h- df -k
+ M; V% L/ n: F$ C, | y - df -lh9 a0 Z+ [/ o9 v9 \
- 查看有几块硬盘:fdisk -l
3 R) P- k- L5 _* b8 t
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
. U" R o2 I7 q) a/ {* C /dev/sda3 3723848 705968 2828716 20% /0 R- j! L" b+ p! I+ c
/dev/sda1 101089 9274 86596 10% /boot
+ z0 j+ G1 E6 b# ]- j7 y7 v5 x none 14520 0 14520 0% /dev/shm/ t5 n' i+ P6 K3 X0 J
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用8 u' r' s" ?- t# |
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel1 ?; ` @% Y9 A; x
Building a new DOS disklabel. Changes will remain in memory only,+ z; A$ P2 O2 L* A
until you decide to write them. After that, of course, the previous
8 h/ K, K3 f3 z. | content won't be recoverable., Y: ?; \( N# m4 ?6 u: V$ j
The number of cylinders for this disk is set to 8322.) E' S2 N. P! O% e( `1 g
There is nothing wrong with that, but this is larger than 1024,: L2 l% F. ~, A6 B; o |6 {
and could in certain setups cause problems with:
3 M: K0 B8 S8 }/ G 1) software that runs at boot time (e.g., old versions of LILO)5 g2 F& V" ]' l1 b7 j( p
2) booting and partitioning software from other OSs1 m5 w7 @: M. f: d' R& L2 q" f/ ~
(e.g., DOS FDISK, OS/2 FDISK)
. E" O0 W' Q; q$ G0 B3 z& v$ m Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
" {! D5 d! o3 @9 H/ D4 A Command (m for help): p
S! @8 D, |( m& r4 k Disk /dev/hda: 4294 MB, 4294967296 bytes, h3 {# x. v0 r, t
16 heads, 63 sectors/track, 8322 cylinders
1 o$ E% E! l3 c& B: {5 j2 o" j Units = cylinders of 1008 * 512 = 516096 bytes
0 A3 H* ~8 u x- N. _! E Device Boot Start End Blocks Id System* ^* a, U4 h1 j6 m6 M' z) W, D
Command (m for help): m
K: X7 I, A) s# S' I4 j/ j) y( i Command action* U* e7 M( ?% d, d8 J$ E1 v
a toggle a bootable flag
[9 c& c' s( y4 O8 ], g, q* o/ Z H b edit bsd disklabel( {4 H4 q* u- s7 {7 [2 J
c toggle the dos compatibility flag B- f. Z. k) ~, \5 c8 ^
d delete a partition" ~6 o! v$ n4 f/ E& h. i
l list known partition types
0 }8 ]: K" A3 m& Y, [1 b m print this menu
& B; d( M, A' @$ j1 ]* C n add a new partition/ F ?% w# u; T
o create a new empty DOS partition table# B5 f) [3 S! i
p print the partition table9 w# M% r! L; R: v1 [' W9 Z
q quit without saving changes
4 n1 j+ {3 K5 S7 L5 L+ R s create a new empty Sun disklabel0 ]! I! T$ S L- O$ I+ M
t change a partition's system id
0 i+ [! @0 \8 ]. F( e u change display/entry units* N: l4 w; n3 n$ U9 H. g [
v verify the partition table$ b+ x& s/ D# e) i& @5 T8 Z" C
w write table to disk and exit# R) @; O! o4 r* k( Q7 W
x extra functionality (experts only)% ~! c& k# p- Q+ O
Command (m for help): n
1 I3 x$ }/ J. J Command action
* C) C, Q: W; @& I; A- ^8 ^ e extended; L9 r! ?% ^) Z5 A& p
p primary partition (1-4)
2 i% J! Z' g( V3 H6 M- ~5 F p
! `4 e1 O* ^; a# S/ }1 o Partition number (1-4): 1+ y# b9 S# c) p
First cylinder (1-8322, default 1):
' I9 L- D* i5 O8 E2 E1 P Using default value 14 M- s! |! L7 {/ ^' s2 |. u1 Z
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
" b6 e9 [2 [7 i3 o) ?" t Command (m for help): p/ f) L H7 y" Z2 \
Disk /dev/hda: 4294 MB, 4294967296 bytes2 I6 ^6 W5 [& S$ i$ N3 o
16 heads, 63 sectors/track, 8322 cylinders
3 ^8 z1 u) o/ o1 ^8 W) e Units = cylinders of 1008 * 512 = 516096 bytes5 e! Y/ ^) r- D" W" F$ j
Device Boot Start End Blocks Id System6 }2 l* _$ `* g q |- r- u j
/dev/hda1 1 1000 503968+ 83 Linux- d: m3 g/ d5 O3 F, ~
Command (m for help): w
! f. [4 z1 e$ m9 Y8 m The partition table has been altered!( \2 F% I4 {9 s: R" F) [4 v
Calling ioctl() to re-read partition table.- ^5 f& q" {6 A- [* `5 A) b
Syncing disks.
% E# g0 F$ w7 o z: w% V1 q //格式化新分区# S( A3 i9 _+ ^- z% B+ }
mke2fs 1.32 (09-Nov-2002)6 \" ^7 q$ G% S$ y4 E2 |) D# ^
Filesystem label=
+ _: }9 R( C5 b) x OS type: Linux, i7 M" ^) Q" r6 K/ c
Block size=1024 (log=0)
; o' T b* f! E3 f: s. V Fragment size=1024 (log=0)& J! i! U9 f9 p* O
126480 inodes, 503968 blocks9 z& {, b l5 V, w& F+ u
25198 blocks (5.00%) reserved for the super user1 y& I9 l }8 w+ T
First data block=1- F" s) S# \, v T
62 block groups
# ?2 Z/ ]% E* |8 y0 ~ 8192 blocks per group, 8192 fragments per group0 X9 g3 s/ \- {9 q: U1 ?
2040 inodes per group
3 j `; J q. p0 F Superblock backups stored on blocks:
: I$ v5 b3 X6 Y% q. ~* K 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
9 R$ ~1 O: y- G$ |( J5 Y Writing inode tables: done % M r% h3 x6 g9 j0 K, c- @
Creating journal (8192 blocks): done
$ z+ ^3 D! Q% p. `7 O6 u# H' q Writing superblocks and filesystem accounting information: done
' k% S, P7 i* F* |7 K, a This filesystem will be automatically checked every 30 mounts or
8 U/ c& Q9 w# \5 I5 z9 O 180 days, whichever comes first. Use tune2fs -c or -i to override.
. I8 c0 d2 Q+ i文件系统 1K-块 已用 可用 已用% 挂载点4 ^7 F* @9 S' [) B4 k
/dev/sda3 3723848 705992 2828692 20% /
$ x/ i& \+ s2 y2 N- \* J /dev/sda1 101089 9274 86596 10% /boot
% A5 Q* c$ l. H3 b4 @ none 14520 0 14520 0% /dev/shm# {, Q q6 a% z' O. |& {" [- U1 W
//挂上新分区
& U; v" ^) U5 @ U5 O: y- mount /dev/hda1 /home
- g7 i' P# [0 h; L/ z/ m- G9 B - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点2 Y" i% e3 C% j5 _. t
/dev/sda3 3723848 705992 2828692 20% /
/ [2 V6 c, N. R2 k+ R /dev/sda1 101089 9274 86596 10% /boot z6 k' ]( b: U% M: @
none 14520 0 14520 0% /dev/shm
* ?7 W9 s6 k: {4 l4 t /dev/hda1 488006 8239 454569 2% /home
4 n' R6 ], z/ x$ g
' p0 \! ]& R. Q$ o$ f* d+ [& v5 H自动挂载:) Q4 t& y' B) R
- vi /etc/fstab* S: y+ H" L e) x- L6 y; R
- + H9 ]; I, Z" A
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0) B8 }9 A+ Y9 t' m, i
- ) g( `7 L' L# Q+ G p* n5 x
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
7 ^4 d1 d; g$ C7 \( N7 a- mount /dev/sdb5 /mnt/ljp1. Y" [" e b8 i( U3 C
- , _( g0 w+ ^6 Y! I' Z8 w, Y
- mount /dev/sdb6 /mnt/ljp2
复制代码 ( h( a$ U: G4 j% q+ F2 ^) S, k. E1 S
! v, f4 S3 E. _
1 a i" \) d2 r1 F9 t$ \ |
|