|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)+ m& O/ r& I5 A% t1 b' O% ^9 \
or: fdisk /dev/sdc (for the third SCSI disk)9 K! T4 ?! A: A& D1 L
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
$ Q# U/ a; G L9 i or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)/ C/ b- U* T1 F1 {
...6 n% N9 t2 n" k4 t* d
- df -k
! H7 q% b9 L* }. J4 [ - df -lh0 S7 R& j- r! ~+ e
- 查看有几块硬盘:fdisk -l9 u @/ H% w) d+ O( _1 e. T8 U8 ?4 q
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点7 n6 G! U2 L9 N% M" J# o
/dev/sda3 3723848 705968 2828716 20% /* O6 A0 n' T, Y* R" q% B* R
/dev/sda1 101089 9274 86596 10% /boot d- Y2 e9 C! l/ T4 R
none 14520 0 14520 0% /dev/shm
! V0 r7 d6 k( {) k/ y- Q5 G 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
* \* B- I) I0 M( h5 _Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel6 H5 o x) D0 V1 b: W+ o* {1 a
Building a new DOS disklabel. Changes will remain in memory only,. Z+ z4 E/ h9 q7 [
until you decide to write them. After that, of course, the previous
( B9 Y5 i2 L. n8 y$ f, `6 _3 }; \1 e content won't be recoverable.
) k& Z2 G: V& `" o1 B4 f4 m7 W The number of cylinders for this disk is set to 8322.* t, L: g$ }7 ?/ Y: y
There is nothing wrong with that, but this is larger than 1024,) q6 e" x0 P7 B
and could in certain setups cause problems with:
4 T0 j; x" P4 u- O- J5 u" l 1) software that runs at boot time (e.g., old versions of LILO)
4 `7 j S0 x4 N1 s 2) booting and partitioning software from other OSs
" [! g+ M9 ]" p$ u% \ (e.g., DOS FDISK, OS/2 FDISK)
6 k% Q8 ^3 o1 m( g0 I Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite): [$ S! j; I. M$ u7 H
Command (m for help): p1 I4 u' x9 Y6 @7 o) h2 @ j
Disk /dev/hda: 4294 MB, 4294967296 bytes9 r$ U* e" o3 W4 R& k
16 heads, 63 sectors/track, 8322 cylinders' T9 v! h0 R- k$ l, O* f7 M( f# B
Units = cylinders of 1008 * 512 = 516096 bytes2 k- v: v$ T$ B* X
Device Boot Start End Blocks Id System
0 M! V# | i+ c0 I& H# M+ A Command (m for help): m
3 ^; N2 T9 J3 x1 j" r) b# } Command action
: }& w& u6 ^; U: M a toggle a bootable flag, ^9 w$ V9 x& D0 ^# i4 E
b edit bsd disklabel
5 |. s9 X& z0 @0 {$ X% C c toggle the dos compatibility flag
L$ y: k3 i* H% @" g5 n d delete a partition7 E1 y% V$ a8 b) B! v
l list known partition types( f4 ?4 g# }9 Y1 q. J% A
m print this menu
1 S8 s% {6 E, [. R* l- u; i n add a new partition% L8 L- R+ F6 M ^2 _
o create a new empty DOS partition table
9 {* t# d; d+ A8 G G9 `' ~1 l p print the partition table4 h8 y9 q; G, u- z
q quit without saving changes4 G0 ~0 h& l' y. @" E
s create a new empty Sun disklabel
. ?. P7 d% \7 f9 V$ P( k* R t change a partition's system id
$ b# ]; |6 H; F# l u change display/entry units. f* O& O% V0 o; q8 S( T
v verify the partition table) T/ W* u. O8 Q' r* F
w write table to disk and exit( ?& f2 a5 R8 w- u# J
x extra functionality (experts only)& w7 M, E2 I. H; X$ h$ D
Command (m for help): n
$ _5 s- h F0 x) Q5 O6 m- q7 j# } Command action: Z* q4 S- }1 b; }% o
e extended% s8 O' i+ _3 P o7 {
p primary partition (1-4)8 U: w" S* D( z6 Z( ~9 l( V
p
/ ]& R) h$ m6 X1 J8 F ~ h$ M Partition number (1-4): 1
9 J! b2 Y- g* J First cylinder (1-8322, default 1):
' O/ {- d0 z0 d! n n6 a( S7 w Using default value 11 n& Q+ e2 f" G+ \7 F
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
C8 k4 b( Q, R: q3 e: V Command (m for help): p }6 ?( y! l( U1 g1 O' R
Disk /dev/hda: 4294 MB, 4294967296 bytes2 f# G2 h5 ?+ o* Y& n/ b0 n* o- v
16 heads, 63 sectors/track, 8322 cylinders( \2 ^( p( t; u7 L8 f5 N: i
Units = cylinders of 1008 * 512 = 516096 bytes
$ }7 i7 T( k6 P4 w% j( @6 X5 L Device Boot Start End Blocks Id System' I5 b9 I9 P2 ?5 ^5 L! z) p
/dev/hda1 1 1000 503968+ 83 Linux
7 G1 L1 d! M) ^! W. f7 q7 C Command (m for help): w
& Q4 Y4 G1 a' y# l) d The partition table has been altered!/ ~- q* I6 z0 V7 V% a3 a4 Q
Calling ioctl() to re-read partition table.
$ U, Z+ I' P4 |( G Syncing disks.: }4 [ D* u; q" ~1 Q5 F) B2 }
//格式化新分区
8 q6 Z1 O+ {% Ymke2fs 1.32 (09-Nov-2002)2 g; n. ]! ?( z! l# @
Filesystem label=
e" L B) f" F+ u- Y OS type: Linux
7 y3 Z* T; c2 \, f5 z7 |$ y; s Block size=1024 (log=0)& Z0 [3 l( r8 t( z7 D6 O$ I
Fragment size=1024 (log=0)% ^4 Q3 h7 n5 b+ e
126480 inodes, 503968 blocks
( E$ k Q& w+ \( _ 25198 blocks (5.00%) reserved for the super user
; C! C6 P5 M& N$ |! W8 ?2 ], }; o First data block=1
0 ?8 W. }- M, W, O8 U 62 block groups. {6 v N+ C% X3 u) z) M
8192 blocks per group, 8192 fragments per group1 P3 c6 J d( ?) s
2040 inodes per group
2 \3 s X- c4 s/ @# K$ r Superblock backups stored on blocks: ( x! x' w& ]4 H/ m; m% r" M% {
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
/ L" z2 X2 M1 l2 [7 g" E1 N Writing inode tables: done 8 R: T: R% Y! X; w# n
Creating journal (8192 blocks): done
6 Q, d9 }" g' y7 D" l Writing superblocks and filesystem accounting information: done
' K$ b+ N% g# A, _( @) ]& z, t This filesystem will be automatically checked every 30 mounts or
\1 c. `( P, _: X% |; N 180 days, whichever comes first. Use tune2fs -c or -i to override.
, a5 y& {- D" ~- V! n文件系统 1K-块 已用 可用 已用% 挂载点
" B L' L8 I: b) }7 u, k5 P o /dev/sda3 3723848 705992 2828692 20% /. X4 \9 E* s1 q& K
/dev/sda1 101089 9274 86596 10% /boot- y4 n' ~! Q% x
none 14520 0 14520 0% /dev/shm6 O5 [1 F5 F; O% S
//挂上新分区
7 [# j) d! N8 F- mount /dev/hda1 /home' y' M# Q; e4 w, `" Q
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
: v9 S: ~0 Z$ g" Y /dev/sda3 3723848 705992 2828692 20% /
! E* ~( U/ Z1 k' u4 U1 v /dev/sda1 101089 9274 86596 10% /boot
; @/ |$ l- R8 m p( Q2 I8 D9 O none 14520 0 14520 0% /dev/shm& D7 h( I2 @: ^0 r) ^
/dev/hda1 488006 8239 454569 2% /home
2 u! x& E* L4 C& w) H1 ?7 E* i8 ]% D5 ~& h% U$ L0 A
自动挂载:
$ P) g9 y( D7 l- vi /etc/fstab0 u- _+ O4 j7 ~
- , |9 H) ?/ n" o8 X& S. [+ R
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0$ a% z$ A. g! \% `: d
( @1 m9 f ^$ f9 N4 X$ |5 |- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
. I+ O% c3 j+ e- mount /dev/sdb5 /mnt/ljp14 j: k" {9 y. j% q. T
- : V" K0 _- j. M" o" b: y @+ `1 n
- mount /dev/sdb6 /mnt/ljp2
复制代码 - |+ {( q: u2 A( v6 m
: }( W1 M6 D2 k3 T
, B& K+ c4 Y( F7 I4 S& h
|
|