|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)& Q5 C m. _7 J7 D" e
or: fdisk /dev/sdc (for the third SCSI disk)
3 R9 w: K/ z8 U' e0 K7 c! e9 i or: fdisk /dev/eda (for the first PS/2 ESDI drive), o- {! F2 J, M8 @4 }
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
' _" B. L) t- S( _ ...7 e/ L5 i# k& `0 f# \2 c/ Q5 p; v: p
- df -k- S1 f1 {7 j# t2 [2 z( ?' o8 w
- df -lh
# {, Q0 ~& M$ b% `' c# w - 查看有几块硬盘:fdisk -l* ~! G, h% p" N [4 C7 c4 T: h
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
' X1 @) ?& A; ?6 V /dev/sda3 3723848 705968 2828716 20% /
" {+ ~5 B- j0 a4 V5 I; s" q& y- q /dev/sda1 101089 9274 86596 10% /boot( c- F2 V# a% Y5 A7 C7 e
none 14520 0 14520 0% /dev/shm" S/ [& m, V/ Q. w5 i
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用8 _& [$ p$ F. T
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel$ t0 I7 z Z- t5 g9 n
Building a new DOS disklabel. Changes will remain in memory only,2 \7 J4 h' z. E D8 [) F9 Z$ [
until you decide to write them. After that, of course, the previous
4 f: V& q- K- @1 a+ u content won't be recoverable.5 B# g/ @$ f$ c
The number of cylinders for this disk is set to 8322.
3 k, h' Y& j* {6 x( g There is nothing wrong with that, but this is larger than 1024,) O0 ? s, N8 L G
and could in certain setups cause problems with:4 s3 v# c% N4 F m$ W2 ^
1) software that runs at boot time (e.g., old versions of LILO)7 B( U6 o' n+ R# E% N4 `& p$ k
2) booting and partitioning software from other OSs% R4 b$ A( j- J) B3 q* N9 g
(e.g., DOS FDISK, OS/2 FDISK)7 r" H3 x6 X- f+ y( H- t
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
9 Y4 v0 K) g8 n+ }' B. J Command (m for help): p
3 k: d. }( M0 k4 f6 Z4 [8 h+ h s Disk /dev/hda: 4294 MB, 4294967296 bytes; _# i( S S* r4 d* M& Z
16 heads, 63 sectors/track, 8322 cylinders
# Z* y" K2 |4 | Units = cylinders of 1008 * 512 = 516096 bytes2 M2 q1 n# [2 ~% n0 j
Device Boot Start End Blocks Id System o2 b/ \; C7 `: P' `$ p
Command (m for help): m9 ]; D" Q- n, `7 l
Command action. E# _9 _4 ?- F+ T
a toggle a bootable flag% g& y2 x% Y2 e' }- c6 \& M
b edit bsd disklabel0 x6 O1 L* y& F% w8 d
c toggle the dos compatibility flag
H# ]. c$ r7 L; U) o d delete a partition& W8 q! _) H5 D' O4 V# p0 a+ `) B
l list known partition types7 C+ Z9 ?" N, ?& g7 x& o' g+ n
m print this menu4 B l* O, \' i; _2 e
n add a new partition
7 `2 j* w0 I9 y4 f( ^: B6 f! m/ T, L8 x o create a new empty DOS partition table
. _5 ~* d0 L7 O# X$ s p print the partition table
& K. \$ }) {6 d r7 C q quit without saving changes1 `7 x w% w- _& h' e
s create a new empty Sun disklabel, ?, G# _0 d D! y
t change a partition's system id
~8 |% T+ T6 b! `8 w0 N; V1 i u change display/entry units
3 F9 C0 P3 X" P# X8 X! W v verify the partition table
! d7 t8 Q% ?" A( M; {5 H w write table to disk and exit
) O* m, K/ V4 [. ~$ K x extra functionality (experts only)
8 ?) N. j3 D" o4 G+ T0 L Command (m for help): n. u' }6 v1 q! e' _
Command action' h) Y9 l4 l- [- S( H& o
e extended
: a: f: b7 ~7 L6 V9 t# p0 x p primary partition (1-4)4 O* h, K; s, Y# j) _3 P" F. v+ y
p+ N" I) s/ Z' d9 I" T
Partition number (1-4): 1
) g. _4 a' k: p. c, s2 p8 a& I; [ First cylinder (1-8322, default 1): 9 l. v0 g& @8 B! G0 M" I' g
Using default value 10 u9 ]% U$ ]/ v
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
' Y$ e# ]: [* W) R Command (m for help): p3 g' d! k2 m$ @
Disk /dev/hda: 4294 MB, 4294967296 bytes) o2 y; v8 C; V4 u( P* n
16 heads, 63 sectors/track, 8322 cylinders8 ], O: j* P' O; O' m8 f x. e
Units = cylinders of 1008 * 512 = 516096 bytes
! f" N- i, w0 ]4 x* o Device Boot Start End Blocks Id System; K- o0 i; D" d! w: X
/dev/hda1 1 1000 503968+ 83 Linux& R: F. X- p9 P" D9 Z
Command (m for help): w* [5 z7 h- @; E) G- {# H6 C
The partition table has been altered!
( L, |- v' s. N F2 Y' J Calling ioctl() to re-read partition table.
. d8 t% t6 K* ?) t+ X; U Syncing disks.
0 Z- T5 H( {4 A# ` //格式化新分区% Q8 Q' G5 m v
mke2fs 1.32 (09-Nov-2002): t, u; _1 T+ k! d3 }
Filesystem label=% H4 I; z& [. \9 v# l
OS type: Linux2 \4 L0 x- q- D Z
Block size=1024 (log=0)
) h3 `& R" N1 X- R+ j0 k% I" P Fragment size=1024 (log=0)
8 O" l/ O4 L/ |/ F5 A 126480 inodes, 503968 blocks' \7 D* Z7 i1 ?6 u! M; Y& b/ S# Z
25198 blocks (5.00%) reserved for the super user
9 w' [. I) S. V2 ` First data block=13 K2 ^/ r' s4 W: k( G$ U9 G6 v
62 block groups
1 m/ I1 s; k7 Y 8192 blocks per group, 8192 fragments per group
( M& C) {$ M1 n 2040 inodes per group( k, L& L7 x9 ]( v4 V
Superblock backups stored on blocks: ! ~6 l5 m; _( H4 v* c2 P; i) i: I7 @
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014098 ~3 c3 r9 N" n. P& P% @
Writing inode tables: done & O$ ~' F# n$ Z- B- b& u
Creating journal (8192 blocks): done) R4 W8 r- Z$ f' a, k% r8 M I
Writing superblocks and filesystem accounting information: done
/ J# B3 C8 e4 i! k This filesystem will be automatically checked every 30 mounts or
9 l4 E" c4 C) B% L: s; t8 E2 F 180 days, whichever comes first. Use tune2fs -c or -i to override.
9 T4 a% ?2 l W& G; l$ Z) q3 \" X文件系统 1K-块 已用 可用 已用% 挂载点
% l2 T. j% u0 }; \0 q /dev/sda3 3723848 705992 2828692 20% /
8 }8 U1 Z+ o( e% q9 @3 c( O! r7 @ /dev/sda1 101089 9274 86596 10% /boot& U% _% Z: z5 {4 u l8 T
none 14520 0 14520 0% /dev/shm
5 u+ T. g8 n8 r) k& r //挂上新分区5 h+ n0 k8 G5 A
- mount /dev/hda1 /home
) h; @# v, R' j( f4 r: h6 w* k - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点" F/ m) Q5 i7 A+ K1 q0 K, J
/dev/sda3 3723848 705992 2828692 20% /: m5 A: `: h1 S- {* s) O9 R
/dev/sda1 101089 9274 86596 10% /boot
& ^4 y( P# h$ g3 l2 m none 14520 0 14520 0% /dev/shm W* k1 `/ ^8 ]- e# V9 Q2 x# w
/dev/hda1 488006 8239 454569 2% /home
9 [% O% ]9 u% |* N; W- q1 [- L8 s G7 g' t
自动挂载:
& O* i% k4 N, D- F" _# P+ Q- vi /etc/fstab
( @- q, ]" O% B1 Z; z3 z - : ^5 B! Y. Z( o( n
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
: m6 p5 q5 F" S8 ?. p- m, m2 x - , G1 `+ b Z/ B
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
g* Z% V% w* V* k# A- mount /dev/sdb5 /mnt/ljp1
: K4 e F8 A7 N
1 z" {- y# n# F& x/ Z- mount /dev/sdb6 /mnt/ljp2
复制代码
* Q" J1 c1 n" |* M6 t P6 I- w7 b. k4 J
+ w) g3 x( T. f7 ~* Q- X+ E. f6 P |
|