|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
9 O+ b0 c" \! I3 b or: fdisk /dev/sdc (for the third SCSI disk)
3 u- U; q7 | O- p or: fdisk /dev/eda (for the first PS/2 ESDI drive)
" R: \7 V2 V; S& v/ l9 X or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
, a" P: f; w/ A z. n7 C3 b ...
6 k( X! V6 |; d$ t! _ ]- df -k9 y: ~ }0 Z' J9 ~' N% ^
- df -lh
, [# [! h* e2 d9 ^$ h - 查看有几块硬盘:fdisk -l
+ d0 }$ N# W3 N) e$ _" b
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 k9 F. g% L* d$ l; a% b! h, m
/dev/sda3 3723848 705968 2828716 20% /% t0 x( d' N/ | P$ q
/dev/sda1 101089 9274 86596 10% /boot
+ i* x% t- @1 M* C2 X- Q none 14520 0 14520 0% /dev/shm
0 @2 d3 x) X1 }' }! H 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
; H J2 G3 y8 b, A8 ]& N" NDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel& {8 W4 d( t# x
Building a new DOS disklabel. Changes will remain in memory only,0 F+ R$ T# I+ ]/ i: M3 C m
until you decide to write them. After that, of course, the previous
" V, T6 C$ p6 [4 l content won't be recoverable.
* U, K2 K7 [: g! O; q3 O1 I The number of cylinders for this disk is set to 8322.
% a3 ], k9 h/ c& B There is nothing wrong with that, but this is larger than 1024,
! {4 h0 L/ B, \/ q$ ? and could in certain setups cause problems with:
" H" e( V: n' G' Y" M" O6 c 1) software that runs at boot time (e.g., old versions of LILO)
# F2 { X$ ^+ o6 B, j6 f+ [ 2) booting and partitioning software from other OSs
" Z2 e1 P" g1 y- z h (e.g., DOS FDISK, OS/2 FDISK)
, }; ?+ V( M9 W+ h Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)8 T" _4 I- U _. z- J+ M
Command (m for help): p" H+ b m3 M9 a0 F. p" |9 A. @
Disk /dev/hda: 4294 MB, 4294967296 bytes! R$ f/ O6 ]9 a' g: z
16 heads, 63 sectors/track, 8322 cylinders' g1 _0 b! [2 `( c
Units = cylinders of 1008 * 512 = 516096 bytes
# b( c0 {' O& o1 l7 Q( O% \% a. e Device Boot Start End Blocks Id System @8 u W# }6 ~9 c
Command (m for help): m7 a# W- W" ~6 I; l" o& b7 }3 f/ t
Command action
' J# R8 m8 K8 V8 r; ^1 {% d+ K9 x) I6 | a toggle a bootable flag, F2 D' V5 y% `* x$ A7 v
b edit bsd disklabel V* n6 F8 b3 v* e1 J. O
c toggle the dos compatibility flag
. J. V/ V- W* F7 R0 U d delete a partition
' ~& ]0 \8 ]6 v" I+ e5 {* P H4 ^ l list known partition types1 \6 z: z6 D+ i1 D K
m print this menu7 m& R1 ^$ E. q# ^
n add a new partition% O' b$ R4 S* [" r6 ]8 g. J. H
o create a new empty DOS partition table
9 e/ H* G) N; }- b) t. b% g6 T p print the partition table
1 ?* v! p( |1 h; O0 _ q quit without saving changes
/ v1 X% y8 E8 F4 u/ M/ G s create a new empty Sun disklabel
1 G' i1 {2 A3 ^% J% w; {8 ? t change a partition's system id
" k4 M" d3 M, n. | u change display/entry units# A% P# V8 N1 ]- ?) y
v verify the partition table. @% V! N( G$ u( h0 W+ I* ^
w write table to disk and exit9 U, }, T& x6 O) C" u2 Z1 U# q
x extra functionality (experts only)
. n9 K) y0 h* d( u$ @ Command (m for help): n1 N9 S( j. [, i0 A. P; R
Command action
! V: k# \! f; v8 ?) c7 z7 I. L e extended
/ j! [- F. ^( g# s p primary partition (1-4)
- t3 J, q5 o9 h( R, C0 g p4 d+ N! g! q j& ^; q: Z# X$ J0 A
Partition number (1-4): 18 Q6 Z/ K b5 v, {0 \
First cylinder (1-8322, default 1):
0 d+ s8 \% }( U% k+ \1 k Using default value 1
; X+ A) h9 m4 k- }5 p4 N2 a& R, ] Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G5 R0 a" `) r( _) v2 |% V! Y
Command (m for help): p! E2 C0 n" U4 t" V4 J& G0 i7 |
Disk /dev/hda: 4294 MB, 4294967296 bytes: Q' K. E2 t/ D) P
16 heads, 63 sectors/track, 8322 cylinders
8 C) ]! p( A3 S- |( B& I Units = cylinders of 1008 * 512 = 516096 bytes' J \7 O/ W& E+ I7 V8 z5 c2 X- ^
Device Boot Start End Blocks Id System
2 X& ?- V* Q! O; N, h /dev/hda1 1 1000 503968+ 83 Linux
2 D2 H: h7 A" B" n1 n+ k" A Command (m for help): w( i; C3 S9 l' Q( u# b1 s. ]
The partition table has been altered!: \; _5 _% g, \0 ?
Calling ioctl() to re-read partition table.
2 {% Q" `! { c8 g Syncing disks.
$ k. `# Z& {1 | //格式化新分区
/ C- b+ x1 [, umke2fs 1.32 (09-Nov-2002)
f4 |! J1 A8 ]) M: j Filesystem label=/ c L7 a5 m- V! b m; B$ k
OS type: Linux
7 X4 t w# ^5 V% T2 ?, i) q# |8 e Block size=1024 (log=0)
0 T6 P+ N* _1 U9 @ Fragment size=1024 (log=0): I y; i0 _* Y" ~- q
126480 inodes, 503968 blocks7 U9 X5 h9 a0 N" |5 ]
25198 blocks (5.00%) reserved for the super user
. L/ v. A( l! t$ q First data block=13 t8 [+ p+ Y: r5 E& e0 m- r5 Y
62 block groups
$ r( Y/ z1 I. `8 O* K& E8 ?6 ` 8192 blocks per group, 8192 fragments per group1 u( q7 a- t. z& T, E
2040 inodes per group( e- n! @0 D3 S; y- t. ?% S/ s
Superblock backups stored on blocks: 3 h# y6 \ s* ^
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
/ l% w9 i( L8 x5 \" n0 w Writing inode tables: done
# O5 r& x! p2 T& L) B) F* {# l Creating journal (8192 blocks): done
; F9 s% t5 ^! l% V Writing superblocks and filesystem accounting information: done
/ o( t* ]6 ]% b9 H& z; q This filesystem will be automatically checked every 30 mounts or
' u$ {9 E R P' V) l, [ 180 days, whichever comes first. Use tune2fs -c or -i to override.8 p5 M& C+ U/ S( n3 {+ s, b: b
文件系统 1K-块 已用 可用 已用% 挂载点# ~+ d6 h" x4 x" `% U
/dev/sda3 3723848 705992 2828692 20% /
: Q5 b5 Q) S. z# T* Q% ]% o /dev/sda1 101089 9274 86596 10% /boot+ l' h+ `- N- c" c( v& G
none 14520 0 14520 0% /dev/shm+ y7 f& _ y- H+ x
//挂上新分区
X5 z( x! T( S. R- mount /dev/hda1 /home
/ B! X0 t- x/ D& X9 J, [+ S; k& X - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点7 O. f' h5 i; U2 t
/dev/sda3 3723848 705992 2828692 20% /3 w- W) k$ |, f/ n
/dev/sda1 101089 9274 86596 10% /boot
. z8 T" q; C5 T none 14520 0 14520 0% /dev/shm- o; L5 j5 P: D( e) W
/dev/hda1 488006 8239 454569 2% /home5 S4 j! p6 K7 ?: K
! [) T& s3 R' D( W3 j
自动挂载:
3 e8 j( s2 I( D+ [2 i) D- vi /etc/fstab
+ _ ?6 f3 X3 P0 p J - 9 j# Y# [- D1 m9 ^: |7 s- U+ N+ A
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
: z; g" `9 i \; [" {) \5 b2 v( s5 r
2 a( [- V4 A: A- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
& X. c; W7 P! Q1 i+ a! G" ]- mount /dev/sdb5 /mnt/ljp1: s+ z0 P9 i V" [( |/ ]1 C
) }% R" a% S: k7 S% ~. D3 [/ i1 b- mount /dev/sdb6 /mnt/ljp2
复制代码 9 I& J- K) z1 o/ D
I0 j8 S0 [, E' A T6 O3 `9 A" G, e2 G- s$ i) O0 ~
|
|