|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)- c4 l* y) X/ s" }! y/ k- t
or: fdisk /dev/sdc (for the third SCSI disk)
! p7 f$ a0 J" Y* T or: fdisk /dev/eda (for the first PS/2 ESDI drive)- i8 Y$ v* H/ j6 I8 u" y0 K# I
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)( h9 d3 {' j3 |
...4 \2 |% D$ D* k# A1 W% r# K2 L
- df -k5 I$ |4 O$ C( A/ u$ S$ x1 |
- df -lh
* [& u, V% Z, F$ P - 查看有几块硬盘:fdisk -l. s( ~5 t3 a; e% j
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 L% V+ a4 l' s' L0 l
/dev/sda3 3723848 705968 2828716 20% /7 R0 T! U3 D9 {! X& L
/dev/sda1 101089 9274 86596 10% /boot7 v6 U4 B/ Q8 |. N# d$ A3 A6 a5 a
none 14520 0 14520 0% /dev/shm ~: x0 ?. g! T( o
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
- {, n3 J" r- G: MDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
, b$ S( | \ K5 p. x& o; ]# g# X Building a new DOS disklabel. Changes will remain in memory only,9 R! {7 i2 b# Y# |% S. T9 ~& U9 L
until you decide to write them. After that, of course, the previous
+ ?; f7 S, N) s; ?; S4 r content won't be recoverable.. {3 K, x2 R, D/ c% v& O
The number of cylinders for this disk is set to 8322.8 N& Y3 x1 b6 u4 p/ @& T
There is nothing wrong with that, but this is larger than 1024,; m2 I7 t' K2 Y
and could in certain setups cause problems with:
) u/ |7 f* s9 z% A% l, z+ } 1) software that runs at boot time (e.g., old versions of LILO)* d2 y& Q' e8 a3 \$ Y
2) booting and partitioning software from other OSs6 P* g& G2 W5 X
(e.g., DOS FDISK, OS/2 FDISK)9 W6 m+ V" u: E/ t- A* H& y
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)- \; c1 \& p/ o3 {
Command (m for help): p
( v8 Q$ G% h/ Q Disk /dev/hda: 4294 MB, 4294967296 bytes
) N- b; Y* E S6 u" J 16 heads, 63 sectors/track, 8322 cylinders( K9 i- y" b3 |# [: Z, I
Units = cylinders of 1008 * 512 = 516096 bytes
# C8 Z: @3 {' V. c Device Boot Start End Blocks Id System
6 o$ i) }+ V+ v. s$ D: f Command (m for help): m& u# n$ ^* |" R1 d. a
Command action; j' \4 Z F, g+ y
a toggle a bootable flag
' t* b0 @4 ^, A( m6 J" q0 j$ P0 v b edit bsd disklabel6 I" \- ?. L1 O8 f- l {
c toggle the dos compatibility flag
3 W) Y; T# x! z" |% d! f d delete a partition9 h& q$ P' y+ x U; n5 j8 X
l list known partition types
* J4 ` Z1 \ z m print this menu
, O$ C3 }9 e3 \1 I# K. u n add a new partition
* e9 h5 f) ~% B o create a new empty DOS partition table6 K# c: ]6 |& k& c
p print the partition table
; v$ X- A9 Z) H- @7 q q quit without saving changes( l" J) b( d$ m) Y4 N0 U
s create a new empty Sun disklabel
5 e2 y& C0 A3 _' y$ P# n t change a partition's system id k. ~0 x0 u- k2 B
u change display/entry units; f u9 u8 \% w5 |9 f
v verify the partition table
$ c' o+ A9 H# z2 D. R7 C4 A$ @ w write table to disk and exit: a* ?- }# S6 k6 a7 w: k
x extra functionality (experts only)5 T5 }" I/ l* k0 j R+ P
Command (m for help): n$ B# c" ~, V' b! t; {
Command action h% j- K% P( u3 |2 l) V
e extended
( q0 e5 U( c9 U* o! P9 X/ B' V$ l p primary partition (1-4)5 q* k) x( ]6 V: b
p
$ Y% v+ G9 }. Q0 Q8 b Partition number (1-4): 1
& {9 v/ n6 \; h& ^0 A First cylinder (1-8322, default 1): , [: ^4 ?+ H1 k6 ?
Using default value 1) o, Z& U7 e, @3 ~! G: g3 N
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
7 t5 \3 h& R4 A: W( E: S& L! ^7 K Command (m for help): p
' `$ H1 ^7 c0 y% _ Disk /dev/hda: 4294 MB, 4294967296 bytes% {! x3 W; v: q+ Z
16 heads, 63 sectors/track, 8322 cylinders( l3 `: u1 y8 u: C! `& S) w
Units = cylinders of 1008 * 512 = 516096 bytes
! m3 e: o9 E4 E2 i% |' d Device Boot Start End Blocks Id System
2 D3 X( i# Z/ H4 {# L7 ?! H0 Z p /dev/hda1 1 1000 503968+ 83 Linux |% k! t9 V1 l
Command (m for help): w7 A. Q8 M( _% O P% x: ~: `
The partition table has been altered!
) o5 F( C$ T2 F2 t Calling ioctl() to re-read partition table.
6 N E* J- g8 R6 w& L* Q Syncing disks.6 x2 o* x& r: A+ Y% ?) w
//格式化新分区
" S+ }& m7 v" U4 ^; ]$ d0 M smke2fs 1.32 (09-Nov-2002)
8 Z3 d2 M& S9 @7 W9 s' A& l Filesystem label=
5 O2 D5 P; |2 p& v: M OS type: Linux9 y4 B* k! g; Q5 l | f" x' [
Block size=1024 (log=0)
( U2 |, u$ j" Q2 }! D; k Fragment size=1024 (log=0)0 B" W X4 |- M
126480 inodes, 503968 blocks- ? u5 Z$ }3 {& v' j: e9 @
25198 blocks (5.00%) reserved for the super user) b( F" }4 E! j1 |, L" P5 D
First data block=1- ^% B8 T2 w& \2 q1 R4 y8 z% R
62 block groups
; ^4 b& q2 e; _( I' l4 h& y& Q 8192 blocks per group, 8192 fragments per group
4 } d/ i, Q; C, y5 d. ~ 2040 inodes per group
2 Y; ^/ s8 n5 C, q- T3 H! o4 K Superblock backups stored on blocks:
! e. ?6 s# K( |( ^% G( H 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
2 w, Q8 `) T8 x9 [6 m' w Writing inode tables: done
) w! F( U2 L0 g) r Creating journal (8192 blocks): done
7 Y7 V: G6 y0 C! A- D Writing superblocks and filesystem accounting information: done
- a3 f) B- o! Y7 |/ `4 S$ @ This filesystem will be automatically checked every 30 mounts or
) I2 @" S% F/ C' j' f% Q 180 days, whichever comes first. Use tune2fs -c or -i to override.3 N& h1 @; \2 f2 l7 }
文件系统 1K-块 已用 可用 已用% 挂载点
$ z* T7 c# K/ {) P P# ^ /dev/sda3 3723848 705992 2828692 20% /
+ e* I. q" j8 `8 S1 o3 t /dev/sda1 101089 9274 86596 10% /boot5 e; `8 `! H$ {* T9 o) h# j
none 14520 0 14520 0% /dev/shm. v; H. c' [. o8 {& u( E( D
//挂上新分区. `& B K" v* |" B1 @* Y" Q
- mount /dev/hda1 /home5 U6 Y1 q$ Q7 T3 q' X* F
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
- M- r$ T6 R# H u4 _ /dev/sda3 3723848 705992 2828692 20% /& R- Q! Y; q4 Z- n: Q
/dev/sda1 101089 9274 86596 10% /boot
0 |5 q8 A: E% `( o6 @4 \4 ?1 ` none 14520 0 14520 0% /dev/shm
- y; b; Q% }8 h" ~5 x /dev/hda1 488006 8239 454569 2% /home+ q6 b! A4 ^* C
; U9 d8 W) m/ x
自动挂载:3 n) {" `! m' L
- vi /etc/fstab
, m7 ~% A5 w u2 b - ( Q6 m1 @* k Z/ H6 H3 M: `
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
. G7 `, r3 T+ V; L, J" [ |# w1 N - + G* d7 [$ T- P& }' I ^
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:5 m) V* ]" |2 S5 V
- mount /dev/sdb5 /mnt/ljp1
, }4 M3 B+ h2 t" x$ O - 3 \# `' [) h( C
- mount /dev/sdb6 /mnt/ljp2
复制代码 0 v) R8 ~' ~" j( b0 B1 ] s
9 m, p+ X) W( }& [! B( ?
) I6 t$ S* g' o3 D
|
|