|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
* `) V- p- K I5 l6 i% P M or: fdisk /dev/sdc (for the third SCSI disk)$ g1 ^8 O0 i% P. F
or: fdisk /dev/eda (for the first PS/2 ESDI drive)! K( u, m9 Y& l5 ], }& N
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)# z' w( N2 Y8 q) f0 a2 R0 K2 X
...
7 K, K: K$ y5 E; O/ R- df -k0 o& s! w _% y2 U- P% j6 t
- df -lh
5 j! |7 z/ ]; } P; } - 查看有几块硬盘:fdisk -l0 y. ^8 x0 W! k9 T, Z% s1 g
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 b" h% s0 Y7 |1 l9 P, J: _' u
/dev/sda3 3723848 705968 2828716 20% /9 K' M5 }& e5 ^7 m( \
/dev/sda1 101089 9274 86596 10% /boot
, x' l5 f9 r7 ]/ e6 s none 14520 0 14520 0% /dev/shm
+ X* s5 r2 O6 V) { 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
% q' j3 |# x! d3 u M: m& yDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel I" x/ H% E0 l6 T# O. g/ [, i+ {
Building a new DOS disklabel. Changes will remain in memory only,
% @) _' J* \* d% o# j" s until you decide to write them. After that, of course, the previous
8 `* f3 k' {( {% g' P content won't be recoverable.' V- ^& {- D' W' z/ l U
The number of cylinders for this disk is set to 8322.5 i5 s2 H* r/ ?
There is nothing wrong with that, but this is larger than 1024,
; E1 a4 n, z$ z and could in certain setups cause problems with:0 E7 g* }0 \! D" @( R& ~# D
1) software that runs at boot time (e.g., old versions of LILO) w/ u% q4 L {) s( v& [% A6 x: V& [
2) booting and partitioning software from other OSs5 C) @9 v. {7 @+ v3 x% p0 ]0 u
(e.g., DOS FDISK, OS/2 FDISK)
2 o7 x3 [5 j/ A! V Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- q9 o2 s" o- M/ X' W7 g- N Command (m for help): p
4 `- @. ]' g7 m, B, T/ X Disk /dev/hda: 4294 MB, 4294967296 bytes
" |" }5 q& O' A 16 heads, 63 sectors/track, 8322 cylinders1 |; h; }$ x3 ], _% z3 [: P" `
Units = cylinders of 1008 * 512 = 516096 bytes2 h: f& J: P& r8 c9 \
Device Boot Start End Blocks Id System
+ |( n/ a) j- @ } Command (m for help): m) ?3 ]! F$ B! E& Y8 A: z
Command action
% k' s' t4 r0 i% D: j3 [ a toggle a bootable flag& f9 x4 u: \' w9 y- S: ?2 l
b edit bsd disklabel+ O8 s, l' p( g- V0 R/ |7 [1 ?
c toggle the dos compatibility flag; s% v2 w+ S, F# F' Q0 R; L3 \
d delete a partition8 H( j* u/ f+ P4 P
l list known partition types
2 Z% O2 N% e$ x# K }4 b m print this menu1 |6 I9 Q3 s. [3 B4 L- I( w q
n add a new partition
: l. K L- |5 w6 p: ? o create a new empty DOS partition table
/ h( v9 G, T. e p print the partition table
( D l( V K$ R _, { q quit without saving changes% h3 i, ]; L: {1 J& H2 t+ y: _2 B
s create a new empty Sun disklabel
! s8 o, `1 {" `* r( [ t change a partition's system id& q# a [% H: s/ P6 `( T
u change display/entry units
. h/ D8 ]$ ^/ ~6 i$ S v verify the partition table. K: O s. U9 I, R6 ~0 V
w write table to disk and exit: i6 R0 P6 f: \" s- n6 ~
x extra functionality (experts only)2 K9 e. L( Y$ G1 P/ R P
Command (m for help): n( e+ _& ?3 J) f$ `6 F) W
Command action
7 l [( m1 R5 ? e extended; t0 w) e8 K5 B& V; ~. Q4 t
p primary partition (1-4)8 h) F* F6 _ Z }$ _! f* o
p. n3 `6 E6 W8 K, M$ z
Partition number (1-4): 1
7 F( \ X* L+ s' c6 b First cylinder (1-8322, default 1):
6 g2 ]4 w8 y/ w; ? Using default value 12 h8 _" c/ I8 e! _$ ^3 S( O
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
! I) D& [ K9 o5 o+ i Command (m for help): p2 |* G4 X. o( T- { E8 Y
Disk /dev/hda: 4294 MB, 4294967296 bytes1 v% E/ ]5 L$ E
16 heads, 63 sectors/track, 8322 cylinders" k) S6 `4 W% N( f" m5 S2 g
Units = cylinders of 1008 * 512 = 516096 bytes$ T4 m9 ^' E; K: M8 u5 M
Device Boot Start End Blocks Id System# ]1 {: m: A+ A
/dev/hda1 1 1000 503968+ 83 Linux2 b0 V0 v0 l3 B. F$ _
Command (m for help): w
" {1 S1 o8 D* E The partition table has been altered!
+ {2 r+ H/ b& y0 }( W& O$ ~" ? Calling ioctl() to re-read partition table.' \6 I0 E& `* b7 ]+ @) y% q- X
Syncing disks./ E- v" \8 E8 i% L8 h7 q
//格式化新分区$ `8 w6 i- Q3 T6 K
mke2fs 1.32 (09-Nov-2002), z. E" `" o( f; M7 V0 h
Filesystem label=7 e( @* A4 p! z6 u. B# i
OS type: Linux" T7 T, }9 e. |2 i6 w& B( H/ V0 V
Block size=1024 (log=0): ^ N3 l* c0 r( S3 b% |
Fragment size=1024 (log=0)
! F* D3 e# n, f1 X1 m 126480 inodes, 503968 blocks
+ H! @. x- i0 Z 25198 blocks (5.00%) reserved for the super user" X. g, |, v- X7 l3 W. P0 b
First data block=1* x' V$ ?5 k9 F& h# H
62 block groups
$ m4 h' a7 D' T; v5 p, n" z; {6 L6 M 8192 blocks per group, 8192 fragments per group# y6 y q ^$ Z8 a$ U7 v
2040 inodes per group
7 A( v0 x8 _ q* l Superblock backups stored on blocks: + T& c0 j, n. c0 ]
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
: i2 A7 K0 I: ~6 j Writing inode tables: done
& n6 [8 ?) h0 x' X7 n+ H Creating journal (8192 blocks): done
' Y' t, F' C% W2 N Writing superblocks and filesystem accounting information: done& o$ Y8 M( g( B
This filesystem will be automatically checked every 30 mounts or6 R# _1 U( @9 y
180 days, whichever comes first. Use tune2fs -c or -i to override.
3 _0 z: Y$ Q8 \+ u文件系统 1K-块 已用 可用 已用% 挂载点0 d' {1 Y; V7 G
/dev/sda3 3723848 705992 2828692 20% /
6 |/ L' }1 f/ X( l/ N /dev/sda1 101089 9274 86596 10% /boot$ u2 i3 j% f6 z2 J4 l
none 14520 0 14520 0% /dev/shm
3 i# {: ]- I) T" K2 W% S+ U) I% ? //挂上新分区
# ^& V+ R7 Z" O0 T( o, X- mount /dev/hda1 /home$ H: e; q! i, |" ^$ `
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点, ?$ {4 n3 _- B* A
/dev/sda3 3723848 705992 2828692 20% /
1 l! ^/ I" x, c2 y! D /dev/sda1 101089 9274 86596 10% /boot0 `/ p7 g$ `7 w4 @; L1 q
none 14520 0 14520 0% /dev/shm
# c( I' T8 K8 B# Z* T2 z' g8 Y /dev/hda1 488006 8239 454569 2% /home c2 ^- b& B4 c$ N" q( w
: c, F1 q1 W. T( P ~' q
自动挂载:
+ D0 `3 b% _0 [0 W9 f. t- vi /etc/fstab7 U7 ^" F& c/ e" H5 M& b# N
- & x2 h X6 b8 _+ I4 r5 @6 A+ _
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
, `4 A0 a% L% c4 N1 v" `8 ~( L - ; M' F( Z( x5 }" o) t( ^, r) m
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:& g$ s3 F3 h7 v0 F
- mount /dev/sdb5 /mnt/ljp1( x+ _* i! c2 j6 X ?
- 9 @/ O* X D5 p( j& L
- mount /dev/sdb6 /mnt/ljp2
复制代码 - q1 |+ R7 u) ^, g
# i- m$ P' S2 d2 l! O. Q3 u
) K9 p9 m& W- Z& u, F
|
|