|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
5 u; a$ Z3 h D/ t, n) }9 J8 D0 ` or: fdisk /dev/sdc (for the third SCSI disk)/ h' c/ b! @* y+ {* n& ?# f; |
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
% E! j# p- n) l& J7 e9 V or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
5 p7 [' S C- ~0 f ...& y7 N, x# I" Q4 g
- df -k
& z/ w9 M1 b1 L* j - df -lh) I! U" z8 o8 M4 K1 C0 {
- 查看有几块硬盘:fdisk -l2 Q6 _+ T! Y6 R7 f2 a( g
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 {3 w$ f4 j2 f8 L8 O
/dev/sda3 3723848 705968 2828716 20% /
4 q/ Q* h! x r6 L6 i /dev/sda1 101089 9274 86596 10% /boot( T5 a3 r: n) S) g r: X
none 14520 0 14520 0% /dev/shm* t* m F: M$ V+ k4 }2 L6 E
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用' f( b4 U1 c* p1 O1 _$ f8 o
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel1 Y# n1 u5 u# x' r8 S' T/ l: z
Building a new DOS disklabel. Changes will remain in memory only,
% s, k/ R, g; _, s, I7 m until you decide to write them. After that, of course, the previous
" C) y1 w. J* m) T r% m4 b, } content won't be recoverable.
, i% W5 D4 H+ e The number of cylinders for this disk is set to 8322.- C" m6 e1 Z. z9 U
There is nothing wrong with that, but this is larger than 1024,
. o$ g: ~% V+ f) ]3 E# p0 K and could in certain setups cause problems with:+ x# [& X- o+ T' z, q
1) software that runs at boot time (e.g., old versions of LILO)
7 @5 Y; C6 n9 Y" a; W7 T. F4 m 2) booting and partitioning software from other OSs
- z. Z6 T; Z; _2 G V (e.g., DOS FDISK, OS/2 FDISK)4 L4 U+ \) I( P Q$ `- Z Y& F1 x
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ K O, n# j+ v5 E Command (m for help): p6 T# d$ _. h- G" F$ ]4 T
Disk /dev/hda: 4294 MB, 4294967296 bytes
& W1 V9 L& }7 k4 W 16 heads, 63 sectors/track, 8322 cylinders5 G0 ^0 q# n6 k
Units = cylinders of 1008 * 512 = 516096 bytes
$ {+ G7 D* u6 ^7 `1 f Device Boot Start End Blocks Id System
4 g. p% H" \: L( H Command (m for help): m- f/ c! D/ Y1 S3 v0 T
Command action
% s# @& Q `- L! O5 i a toggle a bootable flag' o+ @. J. N. P- @7 m Y. g
b edit bsd disklabel
) M# D; ^" q6 Q' U7 D c toggle the dos compatibility flag
2 h' P5 V! @6 c$ r0 q. u d delete a partition
! `: B. M3 T2 ?* ]& E8 F! [ l list known partition types7 Z0 N, Y y. [" Y
m print this menu
; x! @. F5 ~: |% L1 J7 g) y n n add a new partition
# N- z) \# R* K O" } o create a new empty DOS partition table* e) W; M/ ~. \7 s% T3 C/ Y! }: z* r
p print the partition table- @8 W/ O2 e0 d8 e, H) r
q quit without saving changes; a1 ?4 ` c; [1 o2 U8 u h( i' B; F
s create a new empty Sun disklabel
$ W7 I9 h2 w) R; P0 ] t change a partition's system id
1 R3 ?) @6 f* k u change display/entry units
: q7 c; S- O0 B4 W* u3 V v verify the partition table
+ n, J* x' S( L+ ? w write table to disk and exit
' E p- Z6 h1 ~9 ^% N# W x extra functionality (experts only)0 ^: p# h' e0 Q) }1 q
Command (m for help): n- x+ ?2 A, H5 m$ x8 i( c
Command action
* C" h: ?: U& U! I e extended6 V8 u/ u% a6 ~" f- O# [ k
p primary partition (1-4)4 N0 L3 L5 G1 y- {+ D: \/ a
p" d9 X; e ]8 _6 C' G5 J8 u
Partition number (1-4): 1, u# |% J$ H# [, A
First cylinder (1-8322, default 1): ; P* T+ C: r! M
Using default value 1) k& r6 J$ H. Z
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
) E' B/ j# x% _: j7 ]( w Command (m for help): p/ E) j5 S: I) ^6 w$ f% H0 p
Disk /dev/hda: 4294 MB, 4294967296 bytes) V3 U" ~$ ^+ c$ b2 i, g# |2 g
16 heads, 63 sectors/track, 8322 cylinders+ P. E7 K% r. ?! x
Units = cylinders of 1008 * 512 = 516096 bytes" o1 B1 S; Y, h/ ^& d
Device Boot Start End Blocks Id System
, t( u2 T5 E N7 n6 { /dev/hda1 1 1000 503968+ 83 Linux, A8 m, O2 h% m; G* O6 `3 X# @$ d
Command (m for help): w T# O5 ~' e. B& ^- K1 u
The partition table has been altered!
1 Y9 O+ u- y: k6 w Calling ioctl() to re-read partition table.% H, l# c9 y. S8 k: U& n9 O; B ~
Syncing disks.) G3 [ r! Y! p$ K
//格式化新分区9 A6 h0 |. V. V0 _9 b4 A
mke2fs 1.32 (09-Nov-2002)
* S& \: ~! _ a, n Filesystem label=
- v3 Z; p$ s p1 I5 @0 ` OS type: Linux9 R7 u' o: C1 @* \9 U5 M* \
Block size=1024 (log=0)
3 n% \& M: x8 S% f Fragment size=1024 (log=0)" G/ g* C$ c- ^" m
126480 inodes, 503968 blocks2 a- Z2 ]2 r: K- s& {% X
25198 blocks (5.00%) reserved for the super user; P1 x9 ]3 n* N* }1 O0 ]
First data block=1
0 z/ T# d5 r3 [ 62 block groups; J: O) J' }8 S
8192 blocks per group, 8192 fragments per group; B: d8 K- ~( ~( B" k; G
2040 inodes per group
- E4 V" R% P$ y! B$ J' { Superblock backups stored on blocks:
; L/ i7 @- R- c8 t% W 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% x" d `# l# a* \) b$ `: q Writing inode tables: done
4 \/ u" S( Y. l: K' j2 J/ L8 U Creating journal (8192 blocks): done6 A* s3 R3 l5 } n$ g7 \1 C
Writing superblocks and filesystem accounting information: done) h1 d9 m# r, M
This filesystem will be automatically checked every 30 mounts or# L0 ~, a2 D+ A
180 days, whichever comes first. Use tune2fs -c or -i to override.4 e* H) ~' ?; a1 u
文件系统 1K-块 已用 可用 已用% 挂载点
0 k# E! k& M( R( i. ~+ y6 D5 c, J /dev/sda3 3723848 705992 2828692 20% /
, v+ z/ K/ g' {& w, j /dev/sda1 101089 9274 86596 10% /boot n& i* d# q' k E+ j ]
none 14520 0 14520 0% /dev/shm
( ~% V& j. N) c //挂上新分区 Y& E. ]8 M4 T% |. ^/ Y' q
- mount /dev/hda1 /home
# B i% d- h( D - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
( J( Y# f2 g: S" S( H- I% U6 |# t /dev/sda3 3723848 705992 2828692 20% /4 R( N+ g# j4 \, U
/dev/sda1 101089 9274 86596 10% /boot2 |- S9 r# o6 P% H. {- A0 q
none 14520 0 14520 0% /dev/shm7 N' v5 W% O% S' z
/dev/hda1 488006 8239 454569 2% /home3 ~/ ?% n1 I W4 n) \9 z
7 T/ j% E; ]1 h
自动挂载:
% P; Q2 ~! ?; I2 _# k5 `- vi /etc/fstab7 c$ D) B: n& X" L
# u1 G$ v+ K) g( r' f! a' T- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
3 V0 k1 Q8 ?, V0 Z7 R5 A g9 ? - / D. X) a: C7 h1 `: I
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
9 \/ `9 y/ y9 e+ e, j- mount /dev/sdb5 /mnt/ljp1
5 c( z% F$ q! a4 G! _# s% k- a6 J* U
' I# l5 B d9 g* S' G; G+ P- mount /dev/sdb6 /mnt/ljp2
复制代码
, `6 q3 O1 C! |
$ t( {- ^' {* F! o! a' j2 _$ K
5 @7 d" y" ` ~& Y: e" A, N0 G' D |
|