|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)2 |) n7 u2 G/ Y+ h8 s/ F6 N! m# W
or: fdisk /dev/sdc (for the third SCSI disk)' D) i- W; H$ `( o4 t5 Y
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
7 M) u* s( F, F# _; }% ^5 O" d or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)0 ?+ R: a! \8 s3 l; S8 p5 p
...
, }7 @4 I- H2 {( G- df -k+ @+ J0 Z/ q( c) ~" P5 ?* `
- df -lh% ?- M6 M( ~) {! d! a6 A
- 查看有几块硬盘:fdisk -l
$ {# M+ `" I* H' T
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! F2 s# K( x3 e
/dev/sda3 3723848 705968 2828716 20% / }2 m9 Y1 h/ h7 V; X
/dev/sda1 101089 9274 86596 10% /boot
2 X6 R r# v, U9 a none 14520 0 14520 0% /dev/shm
/ L: [8 [) X# S& M5 p. a2 K6 [0 n# m 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
, M- M y; I g: SDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel* l+ c% v2 S6 u, A5 |# k
Building a new DOS disklabel. Changes will remain in memory only,- A7 A0 @8 i/ S& X5 {" z; V
until you decide to write them. After that, of course, the previous. D1 c( g4 a8 h3 G. g
content won't be recoverable.3 o5 U4 S: L! U
The number of cylinders for this disk is set to 8322.) X0 s7 D' D- A& h
There is nothing wrong with that, but this is larger than 1024,
8 y" q( n# W }: i and could in certain setups cause problems with:) {3 ]. H4 _4 v0 h
1) software that runs at boot time (e.g., old versions of LILO)$ f2 ^" q+ M7 @* Y7 p
2) booting and partitioning software from other OSs
|$ P2 j9 |4 S6 Z% L (e.g., DOS FDISK, OS/2 FDISK)
, g3 H7 R! N K$ S0 Y Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)2 T! T {* s0 b6 g X1 p' }7 O, K0 Y
Command (m for help): p
$ p3 ]) v7 O4 ~1 K' w, L0 |% u3 s Disk /dev/hda: 4294 MB, 4294967296 bytes
: L9 G" E" b3 B0 m& D, ?5 h( |2 N 16 heads, 63 sectors/track, 8322 cylinders
! l4 E+ `' q( ?; w- K! D# S Units = cylinders of 1008 * 512 = 516096 bytes6 N" I! R5 j2 @0 }# E
Device Boot Start End Blocks Id System7 }1 t& f1 s% t1 D2 j7 w1 R$ G8 l% A9 `# U
Command (m for help): m
( v8 u9 z8 c- w4 N Command action
w# m) Z6 q. p( ~4 \ a toggle a bootable flag
# R3 O: h6 v+ C& q b edit bsd disklabel
O5 X/ |- l8 o, n- _) Y c toggle the dos compatibility flag
& J5 e( Q3 F2 U% W0 @, d4 h d delete a partition
" s! b! a/ F2 @7 {( @6 o- L l list known partition types
- u, P, q4 Y* U, y4 H/ } m print this menu: H( F7 W1 h* G' I9 L& z+ n' v
n add a new partition) k6 I Z. O. S1 }2 N
o create a new empty DOS partition table
$ d7 j6 b. o/ g( j p print the partition table! Z9 |1 e) G! f% q* L& g
q quit without saving changes
; c% T1 I( H! ]$ O) q s create a new empty Sun disklabel4 G" \( S ^$ x7 r
t change a partition's system id
4 B a0 g$ A5 t$ j2 m u change display/entry units3 @; z4 I8 b8 h7 _) g- D. z
v verify the partition table
+ L" W* F" u! U8 H' I. D3 K4 L) g w write table to disk and exit
! y9 g0 W4 g5 Z: ]# d, B' n3 l+ V4 @ x extra functionality (experts only): G5 |! I* l. p- q- {3 l# I9 i
Command (m for help): n" y+ F d9 F6 J# Q" |' D: Q2 {9 l
Command action
! K& }4 w- W$ d5 n$ | e extended! E$ b) l& b! d O
p primary partition (1-4)1 s" C; U5 G9 }- V7 u
p
2 ^; X- `/ p) p- w, {, C4 y& S Partition number (1-4): 1
' q! R/ F# n- [2 H5 e1 f First cylinder (1-8322, default 1):
1 C. W, Q; f6 D" \/ A0 N Using default value 1
" R: O7 A# M! u/ m7 O. N4 X Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
: n/ ~* \. ~# B6 ]: b4 D Command (m for help): p
# n0 U+ v1 g7 L/ V) H* r( T/ O' ^6 ^ Disk /dev/hda: 4294 MB, 4294967296 bytes. u/ g; D3 k4 U
16 heads, 63 sectors/track, 8322 cylinders( X+ F: l8 D3 m7 f2 z
Units = cylinders of 1008 * 512 = 516096 bytes
- }. {8 Q1 D3 p( ? Device Boot Start End Blocks Id System
- _! V% n$ u1 r9 Z% i- e% Z /dev/hda1 1 1000 503968+ 83 Linux! Y( t9 Q0 \$ `, h
Command (m for help): w; [5 q$ e5 _+ Y+ k$ T& l, O
The partition table has been altered!. K3 x' ?% M) W/ P% \# Z+ m
Calling ioctl() to re-read partition table.
" P/ l! I" h+ @6 e Syncing disks.
; Z8 S6 a3 q: M5 N" K //格式化新分区
- ?+ r9 t; J2 H) C/ Umke2fs 1.32 (09-Nov-2002)
& f7 ?' R) T/ b/ X& G; | Filesystem label=0 V* J. A8 \/ B( i+ M% ~3 W
OS type: Linux
% T' x9 O6 n+ `1 I7 q Block size=1024 (log=0). Y* x0 x0 e8 n0 b* ?; d" B
Fragment size=1024 (log=0)8 m& I' c: ]* t) _8 N+ c3 K3 ~' K. W
126480 inodes, 503968 blocks
' ~, s) v+ K* F/ L% Z9 o6 v 25198 blocks (5.00%) reserved for the super user
- A; j* U6 Y l# [! x First data block=1
) t5 l' I' p+ f& k/ R, `/ B 62 block groups
- b$ d* O' A. Z 8192 blocks per group, 8192 fragments per group9 f1 ^$ T$ l* n7 V* N8 F
2040 inodes per group
" W" A+ l3 Y$ m* X* p" I Superblock backups stored on blocks: $ L' a3 q- C7 ^) p2 z
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409- V- O( v2 T" @* q# ^; @+ q
Writing inode tables: done " J$ v( i/ G* g! b5 ]# P4 E
Creating journal (8192 blocks): done
9 V9 n/ x5 F4 S8 {- `& ~* y Writing superblocks and filesystem accounting information: done
1 c5 \' A n v3 n8 y& G This filesystem will be automatically checked every 30 mounts or
% e: E! m: |4 c: E% {; @ 180 days, whichever comes first. Use tune2fs -c or -i to override.
1 O, U+ l( W3 H, t文件系统 1K-块 已用 可用 已用% 挂载点
' D' f% R9 R$ L& ? /dev/sda3 3723848 705992 2828692 20% /
5 S6 X6 J6 H1 E( E2 f /dev/sda1 101089 9274 86596 10% /boot
8 W9 Z/ E6 P$ ]+ ~' ^! x; H3 n; N0 ` none 14520 0 14520 0% /dev/shm; W7 r T; i4 e% }. e( i2 a
//挂上新分区
( {& \4 x7 n0 F. d( _# K3 s( n7 ~- mount /dev/hda1 /home9 ]) w5 ^7 _7 z- Y, C
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
' M* e( G; k$ y5 g. i& K0 V /dev/sda3 3723848 705992 2828692 20% /
, L& X% B/ p$ w( U4 O /dev/sda1 101089 9274 86596 10% /boot5 R* [+ q. G4 p# F. k/ a
none 14520 0 14520 0% /dev/shm% F* {4 x- H# o G
/dev/hda1 488006 8239 454569 2% /home
. m: N% n1 f8 X" B, @+ |1 n( I' z$ d! m9 f" x @3 e
自动挂载:
, D) A. j- f' p& o- vi /etc/fstab
: v8 y) j5 e3 n2 n, M% A - 8 D- S/ O7 i' S! N4 d
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
2 Q) X) k' _6 @/ H: x* S% h+ v# m
% V5 w5 o9 X8 v& g# N- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: |+ y+ H* b$ L
- mount /dev/sdb5 /mnt/ljp1
7 D! ?9 ^( ] ~. P
- b: ]3 t+ a6 c+ F% c+ F- mount /dev/sdb6 /mnt/ljp2
复制代码 . R& `, i7 u( J
3 ]# A, s( s' j9 {* b, _; [
a. M K/ E: V% e; E1 \( L0 s" ~ |
|