|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk), d1 g) Q8 {2 ^- Z2 N8 s$ q4 V
or: fdisk /dev/sdc (for the third SCSI disk)# G7 r$ [* A+ f+ G& V0 t* E
or: fdisk /dev/eda (for the first PS/2 ESDI drive). n& b( j# p5 i) u( c; e+ j) `
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices). d' T J# A3 ? S9 B" l
...
) m! y, p& P+ X) j7 L/ _- df -k
- |5 l r- a9 Y& P - df -lh! c. p. b$ _. X/ m6 ^' ~8 }. w4 ^
- 查看有几块硬盘:fdisk -l
# x5 N) C* K, u# O: [
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! J) a; l& M5 {% g8 e* y4 ^
/dev/sda3 3723848 705968 2828716 20% /8 ^2 n7 {: I- D/ F
/dev/sda1 101089 9274 86596 10% /boot
) _- u! ?6 o% Z; F4 C9 c& p% M none 14520 0 14520 0% /dev/shm
; D; d# |8 H2 g6 v6 I 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
- z( w: g5 s v4 K+ R8 l& VDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel! g l: D4 _" C
Building a new DOS disklabel. Changes will remain in memory only,/ M- ^& Y+ }5 g l
until you decide to write them. After that, of course, the previous
6 C9 I: `9 }9 T/ c0 I2 g3 H content won't be recoverable.8 k- C4 Z! v5 r( X' r9 J; c
The number of cylinders for this disk is set to 8322.
7 _" f4 ^, w* a3 ^; T There is nothing wrong with that, but this is larger than 1024,) _2 ^; s/ \1 S' |# |) o- ^
and could in certain setups cause problems with:! v# v+ T/ W! q( o. c; N# c5 }
1) software that runs at boot time (e.g., old versions of LILO)
- G' G& r& c# X 2) booting and partitioning software from other OSs
s# h6 _6 v$ L9 U& ` (e.g., DOS FDISK, OS/2 FDISK)
4 u7 P7 z9 \" g Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)' d( z* r: K: O( u& j
Command (m for help): p5 j K: ]. p4 N$ Y& B
Disk /dev/hda: 4294 MB, 4294967296 bytes( k; Z* P" D( m' z0 ~
16 heads, 63 sectors/track, 8322 cylinders/ Q( e+ c/ ^( N
Units = cylinders of 1008 * 512 = 516096 bytes
8 M/ E% C6 A! _& w Device Boot Start End Blocks Id System4 S( `+ x) r& |, w1 M1 c6 l. I
Command (m for help): m- L$ r3 ]2 I7 X' M( Q
Command action
2 |) v# E1 w1 Q: J7 L# C1 D% K a toggle a bootable flag
6 Z$ Y6 ~! q; i( f4 t2 n b edit bsd disklabel" A I6 u. k3 w0 r8 o5 w" |& L9 O
c toggle the dos compatibility flag! S3 E* @, W) o, ?6 g& N# s3 ~
d delete a partition# n2 C* Q5 D5 C$ Y& ?7 X
l list known partition types7 {7 Q+ ?4 g3 U+ P7 |& {
m print this menu8 O! c( i% L5 B& c3 L* W
n add a new partition$ T+ k3 h' j: [3 P y6 s: v
o create a new empty DOS partition table; ]6 ~$ w* Y$ T
p print the partition table3 s- i8 K: q% Q3 U' [: `& R
q quit without saving changes
1 f: k" }( e9 g s create a new empty Sun disklabel& T0 X& f, f/ s3 g* i% y. S" N5 g
t change a partition's system id2 x3 F, A: O* H+ h& c9 { R+ z
u change display/entry units
3 q7 B V9 }4 F3 M$ m4 @ v verify the partition table
' N- V# E T' w& y( h! }% v w write table to disk and exit. A6 K# X& m/ i. Z. V- Q) G' H4 P
x extra functionality (experts only)
7 X3 @! ^ ?9 y, x Command (m for help): n& \. u/ i! e& L% y! {+ v
Command action4 A! R' r, k k2 k: b
e extended7 r" H% R1 b* J1 f: Y
p primary partition (1-4)6 w! X& L- x# K0 K8 Z
p
$ O5 Y# m7 i- o; V l% @9 j Partition number (1-4): 1+ p$ ~3 l, w- e' q
First cylinder (1-8322, default 1):
. p6 u4 J, ]4 o$ i1 l1 v6 N- f Using default value 1
8 o; U* @7 q- @! v) U Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G6 q% L# z K S1 ]/ `' p
Command (m for help): p3 n' M1 p g" ~
Disk /dev/hda: 4294 MB, 4294967296 bytes* j, f; g4 z4 r( V6 Y) c: k* S
16 heads, 63 sectors/track, 8322 cylinders
2 i+ a( ?8 O8 T" M8 E Units = cylinders of 1008 * 512 = 516096 bytes% k U: t0 [- G
Device Boot Start End Blocks Id System
4 K! K; s: d0 }( c8 w8 @5 Q# E /dev/hda1 1 1000 503968+ 83 Linux( D1 G9 a. E2 b1 @4 [2 E
Command (m for help): w( N# V4 S/ D3 R7 R3 X0 n
The partition table has been altered!$ x0 ?& y! ~7 V" `' [
Calling ioctl() to re-read partition table.
. M, e9 t4 g( w0 b0 i. V* @ Syncing disks.
" W5 v6 @7 G3 L! K% ` //格式化新分区
# i1 L$ e! d4 ~) q% Bmke2fs 1.32 (09-Nov-2002)
/ z+ q, B+ J, _* D4 S( u Filesystem label=2 c0 m3 p* X: {" X* w* A }
OS type: Linux/ Q+ ~( C, Q4 N& i* S
Block size=1024 (log=0)# T# ]5 }1 h9 x& v& a+ |
Fragment size=1024 (log=0)
1 B9 G+ x+ p: X" h; K 126480 inodes, 503968 blocks0 I! B4 c( V5 k
25198 blocks (5.00%) reserved for the super user
$ a% Y4 n+ f2 D First data block=1- ^( T @! w; L" c
62 block groups
+ b* k0 L. y: p. I; v6 W 8192 blocks per group, 8192 fragments per group) a9 C0 s/ Q% M, H+ l
2040 inodes per group! F) Y) B0 R( z2 w( x1 m
Superblock backups stored on blocks: ) n4 @! q8 S& D# V
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409/ C2 w; L9 D( i% [ x( X
Writing inode tables: done 8 u/ S' ^ V( ^+ R0 t
Creating journal (8192 blocks): done0 O0 U& j' S& `8 g2 e1 B% `# r
Writing superblocks and filesystem accounting information: done
C, a) g( u$ e- m This filesystem will be automatically checked every 30 mounts or2 y1 q( ]" _6 X" ]/ |# |
180 days, whichever comes first. Use tune2fs -c or -i to override.. d/ _4 V h% G: E7 w; x8 Z
文件系统 1K-块 已用 可用 已用% 挂载点
4 A+ n0 N8 b* c /dev/sda3 3723848 705992 2828692 20% /" g9 {6 ?9 L3 T9 h6 h
/dev/sda1 101089 9274 86596 10% /boot
# L7 Y+ u8 {8 ]' Q* U* J& x$ m none 14520 0 14520 0% /dev/shm
3 z/ N" W, W% v: ?7 L& R: } //挂上新分区
* y5 z9 d+ ]0 [6 ~* _+ `- mount /dev/hda1 /home
5 w% `5 ?9 n- c: ^0 W8 H - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
, `( P8 X) J3 c _ /dev/sda3 3723848 705992 2828692 20% /8 Z7 N; C% g8 _! W7 G; j3 G% u
/dev/sda1 101089 9274 86596 10% /boot
( A9 ]8 @9 R- c2 J. k" E8 V none 14520 0 14520 0% /dev/shm
5 L7 s- f' g# j# K /dev/hda1 488006 8239 454569 2% /home1 S) h6 O0 e' }. A- p% V0 [5 p
! n/ b4 Q) t- X9 _0 |1 _3 |$ \自动挂载:
! N/ i Z/ ]4 ]- vi /etc/fstab* {3 f5 H8 k4 q/ C7 d/ d+ @
8 Y j$ r# U2 E- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
& w: v+ \% n) x. h4 T
) C- ~* M* `! E& M6 `- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:* D+ j% d+ g; ?6 B7 ]" y! W0 t9 ?. E
- mount /dev/sdb5 /mnt/ljp1
; M# U7 J) @* z4 q3 n) m
# K8 d( d: f% I7 [# d; \0 x- mount /dev/sdb6 /mnt/ljp2
复制代码 + I$ H: `$ y3 d/ T) o
# o E! X$ T0 `+ x
h0 b5 T; y* g" w4 L |
|