|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
5 A" B' C4 T/ x7 y8 c1 j2 s or: fdisk /dev/sdc (for the third SCSI disk): p6 F+ O/ X. s& D
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
# _) Y: {4 E! p% j( Q9 [' ] or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)' I# `/ J* J6 P- ]- D4 U; I
...
5 |2 c# v3 ]$ L8 d- df -k* a; U( ~- u1 G& Z& a
- df -lh
$ U, }: T0 Q# B9 \ - 查看有几块硬盘:fdisk -l2 U# o; W8 U! E4 Q) ~; r
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
6 {* T/ r, k& d) d4 V/ j: N4 d4 a /dev/sda3 3723848 705968 2828716 20% /! t, _& t; M$ e" f1 E
/dev/sda1 101089 9274 86596 10% /boot1 `- J! m! a9 ~$ i! d3 c [* Z
none 14520 0 14520 0% /dev/shm
. W _; n; V' S' m9 V# | 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用# i+ z. [$ g% K8 w: p3 N/ p
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
" I" _* X( ~/ j Building a new DOS disklabel. Changes will remain in memory only," F. d+ J6 M; A+ n& F! ^6 \# J
until you decide to write them. After that, of course, the previous
1 } i+ H/ B( \$ ], y content won't be recoverable.; ]5 G* k; r$ S& R5 p$ d0 f
The number of cylinders for this disk is set to 8322.
) v, k. k2 a( M8 a There is nothing wrong with that, but this is larger than 1024,
6 D% w9 P7 N3 u) c0 | and could in certain setups cause problems with:0 ^+ e' O# e% [ b
1) software that runs at boot time (e.g., old versions of LILO)
7 x [ r2 p: _$ z; z 2) booting and partitioning software from other OSs- Z j6 i- P' }' i: k
(e.g., DOS FDISK, OS/2 FDISK)& N: u- K6 d: b4 w) F( R
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
7 n- P3 a( K+ i, _0 h Command (m for help): p
a7 V/ N5 e$ i# P" E( [ Disk /dev/hda: 4294 MB, 4294967296 bytes+ ?+ L' W9 a/ ?, D# W. J$ o
16 heads, 63 sectors/track, 8322 cylinders; y3 q$ ^! p! e2 j8 Q% C1 [
Units = cylinders of 1008 * 512 = 516096 bytes
5 P, _3 e8 u8 n( h Device Boot Start End Blocks Id System4 I6 \0 ]" P# p
Command (m for help): m0 `8 \! L& J# n$ O
Command action5 r- n7 n. p1 e" z( o( [5 Q' N
a toggle a bootable flag2 g5 C5 r+ G. x* _- l
b edit bsd disklabel, K$ E2 }6 p3 T9 s6 C
c toggle the dos compatibility flag
$ W8 |3 w1 s. }7 R& x d delete a partition% d% N* ~' P6 K! g6 u% y8 L4 Z
l list known partition types& t- B2 q; L4 @
m print this menu
$ F5 R0 A% I7 A! c& M* U& K n add a new partition
# |* f/ h' B! l8 s6 | o create a new empty DOS partition table. }% H9 T8 R; a6 @
p print the partition table
' y) u8 e9 A( O' r# k5 F9 R q quit without saving changes) I- q9 H3 O0 \5 @
s create a new empty Sun disklabel3 b6 c2 F H5 L1 n0 g, }& B$ n7 g
t change a partition's system id/ ?; v+ f6 x- }: g' t+ b
u change display/entry units
0 _6 D8 d% V4 `; B$ h v verify the partition table
$ w/ V+ f/ s8 y9 z1 k9 j w write table to disk and exit. O6 Z4 X! J& s; a8 Z
x extra functionality (experts only)" K+ V( _ W4 m" K% N
Command (m for help): n) S% z: Q7 K; [7 h
Command action
9 e8 x& D" b( Z e extended7 I: s2 ?# F4 r5 R: n' F# Q, T
p primary partition (1-4)
$ t9 ^, {% G) s! }( l/ { p
0 T* D0 L" C+ \& W |, ^ Partition number (1-4): 1
; ?$ s0 q/ o- ?0 B& o( i: Y8 U( \ First cylinder (1-8322, default 1):
& I7 q2 ~- X& s, N8 V3 q- ^- J Using default value 1; c6 c* H" M& E
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
9 \: V; J& L/ ?- X- s) p3 N Command (m for help): p: Z! }6 _2 Y9 U2 E# d: {& ?7 x9 j
Disk /dev/hda: 4294 MB, 4294967296 bytes8 Y, J: C$ u; R$ Y& X
16 heads, 63 sectors/track, 8322 cylinders
& n% q1 E3 s6 m9 t6 k1 G2 L9 o" O Units = cylinders of 1008 * 512 = 516096 bytes" E& U5 I# ^ f2 Y6 ~9 N' Q$ s
Device Boot Start End Blocks Id System
$ C: h/ r( {9 P' r% h /dev/hda1 1 1000 503968+ 83 Linux- @* F; V( J5 O& l! m S
Command (m for help): w
6 C! v* a+ [4 E) D7 I% v The partition table has been altered!
) Y( R7 y0 e( ?, } Calling ioctl() to re-read partition table., r& b1 B# F" z3 w- O4 `, j
Syncing disks.
A7 c O0 @% A6 M5 F //格式化新分区
7 J0 e- d4 C' w( _) }mke2fs 1.32 (09-Nov-2002)
0 ?5 q& W8 p7 G Filesystem label=7 S) J) |9 _* `+ {( L! C
OS type: Linux
$ F- R! C* z2 |* x% ] Block size=1024 (log=0)
$ t4 N4 w; S" l h3 N Fragment size=1024 (log=0)) l+ R7 p" h! |3 E9 S/ e& V. @
126480 inodes, 503968 blocks
' `0 K4 T, v- Y! n L. |: M 25198 blocks (5.00%) reserved for the super user* ~1 s/ ^* ~+ m m+ g3 ^9 s0 T
First data block=1( A) ~, f* ^- v3 l( v
62 block groups1 A9 F$ l6 j& I# w
8192 blocks per group, 8192 fragments per group8 x- }9 Z; z2 t. B5 s
2040 inodes per group
/ k, B/ z9 K" m' _6 X @ Superblock backups stored on blocks: ' h/ K/ B U0 z1 m, ? s. s$ ]
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
5 u6 }4 X" k' @" P8 I6 E, `0 R: l& d Writing inode tables: done
* t B2 A5 v9 r1 ~ Creating journal (8192 blocks): done( u, q4 @# _* \% S% Q$ K
Writing superblocks and filesystem accounting information: done
6 D4 j0 j |7 d: q. N9 v This filesystem will be automatically checked every 30 mounts or
& y$ o1 c8 f0 t" Y; U5 ]5 N+ J 180 days, whichever comes first. Use tune2fs -c or -i to override.4 o; `8 j4 L5 y/ W# [7 g+ F+ H
文件系统 1K-块 已用 可用 已用% 挂载点
' O, V# u# \4 P! Y, q. W" I /dev/sda3 3723848 705992 2828692 20% /
6 s3 t% ?/ K; {2 D; e8 b; H /dev/sda1 101089 9274 86596 10% /boot
. l1 F p {5 o6 ?3 m! V+ z' F none 14520 0 14520 0% /dev/shm2 y) r v6 `2 o/ r1 R
//挂上新分区
8 T! {. d' S- K/ p( z! F8 W* S- mount /dev/hda1 /home
) J; }* M" ~( j% c# g - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
+ {4 y" l* [; C, D q1 ~* n- t /dev/sda3 3723848 705992 2828692 20% /
T0 X* P, Z$ ^0 N /dev/sda1 101089 9274 86596 10% /boot
' |! L8 H3 {* c& s/ E7 R none 14520 0 14520 0% /dev/shm
2 d2 z6 e8 I" G- H8 Q /dev/hda1 488006 8239 454569 2% /home
8 D* z/ s6 E- D+ d
2 ]- D0 K% a9 n3 r9 q x自动挂载:. g, h, |6 U; v3 x, ^
- vi /etc/fstab
8 i3 o; J( t! ^! U
2 o2 k7 c, }$ t" J! W: f- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0& \- N! @8 a. c Q! Q/ |8 a
/ I/ }# ?3 I8 k- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:/ J: q* c. z- ~! G& ?8 a \3 ]: ^# {
- mount /dev/sdb5 /mnt/ljp1
: d# O' m5 e- [; m# Y
( @% \( u" b) H( E/ C- mount /dev/sdb6 /mnt/ljp2
复制代码
; h# V( X% W7 t" v/ r3 c1 }. ?4 d+ n+ n2 e% i' b& _2 g, y
4 W/ j4 z) A& `, _. `
|
|