|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
- r+ h* \5 D4 ^' \1 ?8 h# l6 X or: fdisk /dev/sdc (for the third SCSI disk)3 ^# z# h: K$ y! P; Y9 ^
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
/ W0 T$ W. ?/ ~0 i; B% D or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)- w, o, L3 Y8 a8 f' u! b
...6 O9 H4 q* E. U
- df -k, K( o( I# d1 J6 J0 d: h# q( g& B
- df -lh4 Y F+ m) l1 @+ G. C$ Y' J# S
- 查看有几块硬盘:fdisk -l; p0 b! q- q! D$ m( E* O1 q
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 H; }3 k' [( Q+ p, B
/dev/sda3 3723848 705968 2828716 20% /
" v8 v. ~1 b) Z7 q' z6 x /dev/sda1 101089 9274 86596 10% /boot
- \1 A* Z; L) G1 ?6 f8 } none 14520 0 14520 0% /dev/shm$ z7 [, c: v: N# g
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用" l+ {( K; ^2 @
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
2 ~! I3 }% K/ ^& C& L ^) O* Y Building a new DOS disklabel. Changes will remain in memory only,7 E: y4 p3 C2 l2 [! J; m: x" w h2 k
until you decide to write them. After that, of course, the previous
, e5 b4 Y& R: h4 O) Q9 Z7 {) Y4 m content won't be recoverable.
: C8 L' W, t% x The number of cylinders for this disk is set to 8322.0 r4 R3 i, W+ r* y3 k |, d
There is nothing wrong with that, but this is larger than 1024,4 c' r# [& ]% t& u" L7 D
and could in certain setups cause problems with:+ G) N6 P: P$ V' d. r8 }
1) software that runs at boot time (e.g., old versions of LILO)# l- E, K( V r) E! D a
2) booting and partitioning software from other OSs
' B% c# R+ n; \6 z* V4 N (e.g., DOS FDISK, OS/2 FDISK)
) K' v' m4 H# X+ k: @" s( _# ~ Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)" g. T" ~8 i% E0 W
Command (m for help): p2 o* O$ k, o/ ~+ a7 @8 N
Disk /dev/hda: 4294 MB, 4294967296 bytes9 L+ I/ x: _& r+ D
16 heads, 63 sectors/track, 8322 cylinders$ r: R, z# [3 Q+ _8 u, |
Units = cylinders of 1008 * 512 = 516096 bytes
5 z, ^* i. w9 V+ q% p Device Boot Start End Blocks Id System) A; [4 H2 ^ [6 ^9 c
Command (m for help): m
! A0 i+ _# L1 E. k+ q& t. T0 ` Command action
% j# \5 @7 J; M" P# f# G/ U4 l a toggle a bootable flag
2 r+ ~+ T* D/ g' N. _ b edit bsd disklabel8 W% B9 j9 N% Y/ C* o3 D
c toggle the dos compatibility flag
) x- }! ~, h& ?1 d; G d delete a partition( X& D' f' p$ N) W, w
l list known partition types: A$ }+ A# [" ^$ T. x) b- d
m print this menu
( V8 B& e3 r) Z6 E, o4 ]) _. E n add a new partition+ N* z* m9 y4 s, a- d% ^( f$ [! i
o create a new empty DOS partition table
9 I+ ?9 {. |1 \9 s! a p print the partition table$ B) g% T; g% U7 D
q quit without saving changes% c5 g+ J1 a8 T- ?
s create a new empty Sun disklabel
3 h6 L1 E8 r [* [ ?( Q8 D t change a partition's system id
2 A# p0 f6 {" m9 G9 R u change display/entry units
: u% S- e# u3 F7 h0 K6 K v verify the partition table
% ]( c, A) f. m0 Y* C w write table to disk and exit
* _' [& O8 U8 x5 A2 y x extra functionality (experts only)
+ l2 ^" M* C& J0 \1 p& N Command (m for help): n G% o! `+ |8 ~) s# }" J8 `
Command action) C% [( S. {1 p3 z) C
e extended# |5 E7 F! p, H) @
p primary partition (1-4)
7 O6 j% t3 R& Z8 m$ n% L8 l p' z. x2 V! M$ G$ x" T: V
Partition number (1-4): 19 U2 n" Z' G6 h9 C# O1 H" I
First cylinder (1-8322, default 1): 9 T& A3 I* V. P
Using default value 1
/ X& c/ h! r, t9 x w8 M4 m- C Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G% T7 L, @, W/ f. `; f0 C( |7 a
Command (m for help): p% {+ E& ?! k* B- j
Disk /dev/hda: 4294 MB, 4294967296 bytes
6 Y$ \' } W/ H; \# e 16 heads, 63 sectors/track, 8322 cylinders, T+ C6 e2 r' i) v
Units = cylinders of 1008 * 512 = 516096 bytes( h& V. ?" _1 s
Device Boot Start End Blocks Id System
1 B1 ]3 G0 r9 H /dev/hda1 1 1000 503968+ 83 Linux
$ m+ W/ b& s2 e- X Command (m for help): w6 `) s7 c( _! S" q1 i' x
The partition table has been altered!( r/ x- {& I. f# u2 v
Calling ioctl() to re-read partition table.
+ ~5 n' [: o5 L2 h Syncing disks.
v: u6 _- k7 ~4 I& [( h //格式化新分区! G/ d4 M# h; k8 N3 L6 _
mke2fs 1.32 (09-Nov-2002)
$ @/ ?5 `) }5 ?) E' W" G8 S Filesystem label=* _& V# N2 z# K
OS type: Linux3 `/ E" B0 @, b$ Y9 G5 j
Block size=1024 (log=0)
( Q- l. ?4 H& k v6 Z$ j Fragment size=1024 (log=0)
, w) W% x" X* N, ]! V9 E 126480 inodes, 503968 blocks
1 g/ m( k- v% q- D 25198 blocks (5.00%) reserved for the super user
' L& @8 {# f9 ~' Z& l/ F, P First data block=1
, Q& l9 D6 i. J( ?9 w2 k 62 block groups& }$ b W! P8 [4 G
8192 blocks per group, 8192 fragments per group
, [$ k/ f; Y/ @& e" ]( X) G8 `" K0 I7 ] 2040 inodes per group
* w ~) l9 p; G; o Superblock backups stored on blocks: w6 @ g. f/ ~/ K- {4 @2 ~7 l+ y5 p' P
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
8 T6 r- k8 K+ Z" P1 U/ B% N Writing inode tables: done
2 H2 b4 ^) L- `: H Creating journal (8192 blocks): done
9 z# C+ ]& }* x0 F8 S8 a Writing superblocks and filesystem accounting information: done, S, D' Y! N! e8 \; H
This filesystem will be automatically checked every 30 mounts or4 t* N$ f* V. \7 @$ p
180 days, whichever comes first. Use tune2fs -c or -i to override.
+ N4 |3 u0 N$ R: {文件系统 1K-块 已用 可用 已用% 挂载点
* E, h0 f- l) W7 R& E /dev/sda3 3723848 705992 2828692 20% /
) C2 }; l q! D \" a( ] /dev/sda1 101089 9274 86596 10% /boot
( q# y L: O/ t; s+ w8 E" Y. b( p% O none 14520 0 14520 0% /dev/shm
* @9 D" H' l* r7 c //挂上新分区9 k$ a. x5 i' H; {
- mount /dev/hda1 /home
8 U. | V* A) v$ I/ f! ^# q - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点6 H+ g- K* H" o& q: ~! P5 A8 [
/dev/sda3 3723848 705992 2828692 20% /
% O- o! w/ f! G$ ]+ L /dev/sda1 101089 9274 86596 10% /boot% y m$ I' f) q) M
none 14520 0 14520 0% /dev/shm
, n+ J; W* k7 _% R: x& F /dev/hda1 488006 8239 454569 2% /home
) u: ?8 s% w! ^" `# A/ B* v. S. f) f" ?
自动挂载:( L) i2 `% B. {& i" F
- vi /etc/fstab* t/ y7 t) F; j( S3 B4 {+ o) S. U
* n' S3 v L, {: P- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
1 J6 `! O$ u$ r6 c" Y, h8 x+ H3 g. y
. a. M7 E1 `3 V# }) h- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:. {2 U( G0 o/ g3 ?+ S- b
- mount /dev/sdb5 /mnt/ljp1( D0 p$ T b- U
- ( z1 F5 t* A0 u' ?' x
- mount /dev/sdb6 /mnt/ljp2
复制代码
8 a0 z4 Z" P2 g' y! h, G! _% T8 C% b. X
, Y5 [2 I3 p1 O, K4 I ?
/ o: ^% t+ x4 M: n w8 e |
|