|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk), b) Z3 |1 ^7 }" m2 D. n' s
or: fdisk /dev/sdc (for the third SCSI disk)
- b* H. H# O+ W or: fdisk /dev/eda (for the first PS/2 ESDI drive); o6 z: L5 g: `) Q
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
. d/ }2 N" q& {3 k! X ...
c+ L& ?1 p7 H& ~- k! Y1 c$ q1 @- df -k
1 t* X3 q' ?8 E - df -lh/ I+ s, s/ n0 o4 y, S) R
- 查看有几块硬盘:fdisk -l% |0 u2 N7 x/ I; |0 ?
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! r' g4 ?: ~4 p J" ]
/dev/sda3 3723848 705968 2828716 20% /
2 v4 G$ ]2 m& O5 @6 @ /dev/sda1 101089 9274 86596 10% /boot& V+ k2 C+ e6 { ]+ ^4 L- t
none 14520 0 14520 0% /dev/shm
- J* \7 j# p- [" ]3 k: c 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用1 n' Q, I$ `. ]0 N% W$ }
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
2 f% ~/ c, N; P" { Building a new DOS disklabel. Changes will remain in memory only,
5 `# }$ o8 Y; t' c# }) j until you decide to write them. After that, of course, the previous% c X" H; A5 [5 |. O. b7 X
content won't be recoverable.
+ V5 {6 z- V& `3 Y The number of cylinders for this disk is set to 8322.
! _9 _9 I& m3 t6 P There is nothing wrong with that, but this is larger than 1024,8 e9 P% F! F( x7 ?* R8 X" s
and could in certain setups cause problems with:/ w& _; n- m7 y2 Q5 S9 u
1) software that runs at boot time (e.g., old versions of LILO)
9 d7 v2 k* R" f$ r# w( T' v 2) booting and partitioning software from other OSs) I/ g" L) _$ T& l8 |. k
(e.g., DOS FDISK, OS/2 FDISK)/ k3 E) n' @9 u
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ |0 |/ b A7 b Command (m for help): p
& Z$ m. M3 ^# V" @ Disk /dev/hda: 4294 MB, 4294967296 bytes
0 N* C" N$ X' m' B 16 heads, 63 sectors/track, 8322 cylinders% A6 ?3 _& U4 |: `) Q: J
Units = cylinders of 1008 * 512 = 516096 bytes* _6 x- O. x' U& \. N3 o6 ~
Device Boot Start End Blocks Id System
! z* t% Q8 p0 R4 y& e d+ Q Command (m for help): m
U- Y+ a- P3 A5 h& g( m3 h- j( o9 Z5 K Command action% {$ ?8 h; n a6 W) W a
a toggle a bootable flag( l) Z0 Z( S( H. w
b edit bsd disklabel
* E) f; M& h6 p1 h+ [ c toggle the dos compatibility flag6 [. Q" J6 {$ Y+ Y' W
d delete a partition
0 C7 _8 _3 B9 F9 r l list known partition types
7 N, w" ~+ N- ` F7 X m print this menu D# q) a8 j+ T
n add a new partition
+ j% x" v+ `' {. Z" ` o create a new empty DOS partition table: R2 A2 C) v- @8 X( o
p print the partition table+ n% c# W2 ?: `+ I$ U1 h1 x
q quit without saving changes
0 S D4 v) I- |$ ^6 W* E5 `' v s create a new empty Sun disklabel4 t `' z: K+ D' P( P* U5 e4 j* `; P* F
t change a partition's system id
, \) x6 |! p) s1 q9 t3 { u change display/entry units, e2 [6 m) d, G: g. U0 x
v verify the partition table
9 F) u2 @9 G5 q+ J w write table to disk and exit2 n ?: V4 l. h) C L3 M6 U( O+ i- d
x extra functionality (experts only)
2 b' {/ U3 Z6 X, L& ~. r Command (m for help): n% ~9 F S' R0 L; N4 n: {
Command action
@' P+ B+ R4 L6 _ e extended3 r9 V: f8 R2 C: y; s6 V+ c" y; y
p primary partition (1-4)/ P, N3 J' r0 A% P& s6 g
p9 H9 W, K+ [0 Y
Partition number (1-4): 1
& E# n7 {+ ~1 K. X n* R4 h First cylinder (1-8322, default 1):
E3 m. A2 ~% _+ K Using default value 1
. T2 l# k9 }* z Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
3 D3 x! D5 A" j. s/ \( r Command (m for help): p/ T6 d% L+ y* t+ Z2 ]& P
Disk /dev/hda: 4294 MB, 4294967296 bytes
/ W; \' O; y8 A 16 heads, 63 sectors/track, 8322 cylinders
) Y2 A! G% w2 x& V0 f Units = cylinders of 1008 * 512 = 516096 bytes
4 |' C, W0 t4 c* b, d5 P Device Boot Start End Blocks Id System/ B! n; p7 k2 k+ J p1 n, v
/dev/hda1 1 1000 503968+ 83 Linux
! s4 P3 C& Y! V! X+ f/ R Command (m for help): w5 G8 }0 s2 p' D: k; B0 @# }1 u
The partition table has been altered!
2 [' X, s* O1 A Calling ioctl() to re-read partition table.8 B0 Z$ A- O0 j! Q8 p
Syncing disks.
2 F8 h; a9 C$ u. {: Y" P8 w, {& X( v //格式化新分区, s( x1 D6 M* [& K) w" w
mke2fs 1.32 (09-Nov-2002)
. N2 Q( Z. j: K9 M Filesystem label=1 k$ H) W* g Y0 E8 \6 z& K5 c+ {
OS type: Linux/ p6 i7 u% m, S6 S; `$ q
Block size=1024 (log=0) P9 J2 Q, D+ i$ t
Fragment size=1024 (log=0)8 S& E- T4 s8 Z& W
126480 inodes, 503968 blocks- v R4 V9 c9 @
25198 blocks (5.00%) reserved for the super user) `5 l$ i4 d6 l+ v0 o
First data block=1
$ b3 H- E; T( n 62 block groups) D: q% o4 q2 e: V
8192 blocks per group, 8192 fragments per group4 j% i& b I# i( {# X5 C
2040 inodes per group
; B9 K3 r- U* G6 g Superblock backups stored on blocks: $ [/ l) | I- @8 C/ p
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409$ N; g* o* F2 a, y/ Z4 d5 {
Writing inode tables: done & V+ J" _ p/ N' Q
Creating journal (8192 blocks): done
. H1 F! e4 q* y( q W! z4 \ Writing superblocks and filesystem accounting information: done
0 `+ ~ e) C j, t2 a This filesystem will be automatically checked every 30 mounts or
9 o4 T& N$ E& s! ? 180 days, whichever comes first. Use tune2fs -c or -i to override.
* V% ]# l0 k9 b: @/ G8 o7 A& ?$ b: C" h文件系统 1K-块 已用 可用 已用% 挂载点
* d# ~* U% u+ _2 |# S9 s /dev/sda3 3723848 705992 2828692 20% /
6 D8 y( c' y* y# n% i3 C3 V /dev/sda1 101089 9274 86596 10% /boot+ X$ {/ C. V; J9 w. p
none 14520 0 14520 0% /dev/shm, V( @4 k# \8 U3 `" Q: T; M$ B9 v
//挂上新分区
" |8 s7 i$ v4 n* i9 Z$ K- mount /dev/hda1 /home) _/ i1 E0 z: K& h- @/ A
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点+ |+ e# }4 |: [- k g
/dev/sda3 3723848 705992 2828692 20% / G+ x U) B/ ~+ T. F. g
/dev/sda1 101089 9274 86596 10% /boot
; Y% g8 v# b' B# | none 14520 0 14520 0% /dev/shm
K" T: P+ ]& D2 w+ h2 y$ k /dev/hda1 488006 8239 454569 2% /home
, ]) `9 f2 O7 f" V" k/ M7 S8 B0 b4 o4 Y' M% t" ~
自动挂载:
3 Y$ ^( G7 g( f% i3 b& H) j9 H- vi /etc/fstab4 `) E2 ~$ c2 Y' U/ n5 `2 a) l
- ; c) V. P# K6 I: k5 c) L
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
. i+ v+ q; p0 H# ] - " c5 R3 i- Y5 v. j7 ]9 J0 I; L
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
* X. ^+ A- f4 ]- N# a0 V, o- mount /dev/sdb5 /mnt/ljp1, C8 J8 e/ P9 T/ B3 P* O* m8 r! \
- 1 T0 |. D1 X, W" m9 }7 |, a6 B
- mount /dev/sdb6 /mnt/ljp2
复制代码
% ]8 v. V# P6 |% H2 G p I
|) q( j1 Y; Q% [) f' f) E- k* M% C) J3 k% y5 r
|
|