|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)# g0 u3 @3 B1 a1 R
or: fdisk /dev/sdc (for the third SCSI disk)
9 x# Z' I2 Q0 F# ?. h5 F( W | or: fdisk /dev/eda (for the first PS/2 ESDI drive)2 _, Z# M5 I- n& w+ K
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
' V( J6 E9 H$ ~$ Q$ h- p& P6 r ...
5 P* c! K0 D8 K$ D5 z7 {4 Q- df -k
6 I8 i1 L+ L# \7 H; p0 V W: d0 p! h - df -lh) c8 y3 Y$ C. M. y+ R+ L; C5 Q
- 查看有几块硬盘:fdisk -l& m; O* @1 ^; ?4 y4 p6 b
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点1 Y/ ? s* h/ e O$ @* y
/dev/sda3 3723848 705968 2828716 20% /) }. Y( `7 ~3 ?& @( W* G }
/dev/sda1 101089 9274 86596 10% /boot
. V0 z) T, K" H' J$ z: W& y none 14520 0 14520 0% /dev/shm+ z- k3 h* Y* t: W6 s- F0 }3 v
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
8 y% O: d9 K; y9 x- L! D5 PDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel7 S0 W, c$ [# c. e3 g
Building a new DOS disklabel. Changes will remain in memory only,
m! u& k& v9 }7 a: G# T" f/ m! h6 P" l until you decide to write them. After that, of course, the previous% r T, B% z* V! q) Y- A; l# W
content won't be recoverable.* g0 b/ v1 N: ?% a
The number of cylinders for this disk is set to 8322.
% Z( r- @4 {7 k' f( O There is nothing wrong with that, but this is larger than 1024,* O( r* g7 x1 f, y i8 c" m
and could in certain setups cause problems with:0 l9 W W5 y4 T1 V n: J
1) software that runs at boot time (e.g., old versions of LILO)3 w, c7 {6 R! u8 `$ x
2) booting and partitioning software from other OSs! t/ @2 I: K# r( ]/ O/ C( g
(e.g., DOS FDISK, OS/2 FDISK)
* z) C. E$ e: F+ b( y Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
1 w R* W. j9 l3 N i Command (m for help): p" s& t- k) a% P7 v% S
Disk /dev/hda: 4294 MB, 4294967296 bytes. i6 i9 ]/ V0 }: F- S& d& ?/ X, I
16 heads, 63 sectors/track, 8322 cylinders) J& u+ b$ x. Y& `' K' [% Q4 I1 c
Units = cylinders of 1008 * 512 = 516096 bytes6 a) f- [& x2 R1 R0 T
Device Boot Start End Blocks Id System8 f& d4 C Y* N; @# v
Command (m for help): m
1 Q) S) V: Z4 E3 c% F# k# e Command action
" v9 K, G, [/ _5 z a toggle a bootable flag2 _1 R' \; c9 K; ]2 W [: t. _
b edit bsd disklabel* ~' u/ L+ Y! f( n
c toggle the dos compatibility flag0 i& q! `- @4 k W( T) Y6 a4 ^8 f( z
d delete a partition+ H- D8 b. L4 B2 k j" o' ^
l list known partition types
" L# }( t3 B5 y6 u- _: X m print this menu q% M" Z' f# H( O& {- @ L$ i
n add a new partition
9 [+ r4 d6 x( i1 H; k: l0 c" }0 x o create a new empty DOS partition table
. e/ \& c0 w" h6 Z p print the partition table
( W% {: W+ E4 R/ \( n9 x q quit without saving changes( B; m# \. M' O& v8 O
s create a new empty Sun disklabel
9 M6 g) z: h- s6 A t change a partition's system id
& s: g, d! o8 t u change display/entry units" N/ ?- R1 U$ p- J
v verify the partition table
$ H# a3 {, L% H% q' e I/ `) y w write table to disk and exit7 e) U8 v; {' A1 t( X+ V; n4 K& O7 l
x extra functionality (experts only)/ m8 s' {- ~: _( y! {& a% O
Command (m for help): n
' d/ Z( u0 |( _1 {1 B$ Y Command action
. \. ?7 G) l. x# t6 U$ E' r e extended
) p6 v% Z5 z+ ~# d l p primary partition (1-4)
# r/ U! ]1 ], l p
2 N3 g2 ^; j# ~. \, K/ l+ k Partition number (1-4): 1
9 { E+ L' @/ E# y$ O9 U9 r7 F First cylinder (1-8322, default 1):
# O# D. M( O' B! e; `6 m6 F& p( H Using default value 12 o7 X/ `1 {) U) ?( [
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G3 H; s# i! r3 j6 \3 f+ V$ L
Command (m for help): p
( A& q8 p7 D( p1 I3 \ Disk /dev/hda: 4294 MB, 4294967296 bytes
5 B) O# R& L6 E& A 16 heads, 63 sectors/track, 8322 cylinders/ l: W- ~, B; k* |7 b: S# I
Units = cylinders of 1008 * 512 = 516096 bytes
5 u% F" c2 K3 p7 I/ e0 N$ `+ W Device Boot Start End Blocks Id System
- l( m% l( P( {' R* j w+ L! W /dev/hda1 1 1000 503968+ 83 Linux% w' s& m/ U( C( E! J6 m
Command (m for help): w5 d: x z4 z5 p$ N' r
The partition table has been altered!
5 T# h" S$ b5 a, V/ _ Q/ p! u2 s$ { Calling ioctl() to re-read partition table.+ V C( @( M R3 V9 v: s. [
Syncing disks.
1 B' L9 N. T8 f. ? //格式化新分区
8 g, z/ G- p! [; j2 D% Nmke2fs 1.32 (09-Nov-2002)
; E, a6 G9 Y! o2 Y3 y Filesystem label=9 ?9 Z+ V0 I2 x7 s0 }
OS type: Linux- p3 V1 U8 {+ m. g3 q- R$ Z& P
Block size=1024 (log=0)
; T# _0 e/ l5 R1 x* j& Y2 l Fragment size=1024 (log=0)
d; E G3 f1 J1 p% ^ 126480 inodes, 503968 blocks+ _+ K6 J) J8 z+ T3 g) u
25198 blocks (5.00%) reserved for the super user$ b5 ^, j! `5 o. l* v
First data block=1
/ m5 A9 ~. D/ W G- F 62 block groups9 g( I# y: X- n2 B# H( \$ B
8192 blocks per group, 8192 fragments per group
* ]" f5 y' c! P 2040 inodes per group
2 | C& b; y% m7 G Superblock backups stored on blocks: 1 s3 d( A' G5 y: [# }# o4 i
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014098 s8 a: |# T) h: p: r
Writing inode tables: done 8 V: V# ~+ j' m0 F8 I
Creating journal (8192 blocks): done. {" v/ l0 L( K+ f7 J: D8 D# N% ^
Writing superblocks and filesystem accounting information: done
& A3 D' [( ^( u. J' P" S This filesystem will be automatically checked every 30 mounts or
7 m8 f0 U6 l. U7 W: I 180 days, whichever comes first. Use tune2fs -c or -i to override.
* N V" y6 D5 I. V7 \6 W文件系统 1K-块 已用 可用 已用% 挂载点; k3 x! i7 J- n* }# ^/ z
/dev/sda3 3723848 705992 2828692 20% /! E. C* m, ]9 X1 K, Y2 e
/dev/sda1 101089 9274 86596 10% /boot
& `+ {1 d; E& z9 A# G; ?* m4 x! v none 14520 0 14520 0% /dev/shm
2 s7 \4 ~+ a9 ^0 l8 O //挂上新分区
7 w! |- A4 i# L! v# r* p4 d3 [- mount /dev/hda1 /home
- i. l- ]: ~. Z, Y2 x5 s3 I - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
0 N/ B6 X5 {0 ^4 H8 x- N" F /dev/sda3 3723848 705992 2828692 20% /* [% T/ P7 ]# R! z5 M# A7 T4 [
/dev/sda1 101089 9274 86596 10% /boot
' b" O- t& _9 E, ]5 g$ N none 14520 0 14520 0% /dev/shm; B; `) u; \' B( ]
/dev/hda1 488006 8239 454569 2% /home
. a* D) f# t" E% I/ f
6 O/ B, e& i( e自动挂载:
6 d$ Y& B% u% e, K0 N- vi /etc/fstab
4 d% G$ W7 h" N0 g; R8 j. l, j - 9 J- M! h+ I9 |
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0- j; v: s9 \6 K9 f l
+ W$ f3 P+ y- O# g- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
( ?8 O3 Q4 m3 n4 B% H) s- mount /dev/sdb5 /mnt/ljp17 S. ~% h$ W% d: Q# J& G
- $ r) j- f8 G8 e
- mount /dev/sdb6 /mnt/ljp2
复制代码 4 h L8 R+ d5 M+ b: A0 }
; p7 M) k& `6 ?2 H& Q3 m: j0 ?
$ R |/ [% k- q2 X1 N' n% A |
|