|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
/ Q3 z& J7 m3 z* ?) g) f# { or: fdisk /dev/sdc (for the third SCSI disk)
7 _4 z( q4 [. _: m# ? or: fdisk /dev/eda (for the first PS/2 ESDI drive)
: w- d& r4 m: m3 c- Q8 X4 L, | or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
# U- _" `+ M4 {9 i; {8 v ...
: P, n7 W3 @& T1 `; u+ H( O- df -k9 R4 C* T, \+ j* E7 F, Z2 Q
- df -lh8 } ^+ o+ P9 z, H
- 查看有几块硬盘:fdisk -l m9 F& @' b$ j- K7 W5 ~6 N5 i$ i
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! W6 }5 g2 `9 [; H* N
/dev/sda3 3723848 705968 2828716 20% /
" H' t+ \$ F4 V! f; g7 F) \ /dev/sda1 101089 9274 86596 10% /boot
+ h6 L! O: a* f9 y, Z! S, q none 14520 0 14520 0% /dev/shm
; i; `5 i) i; G 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用$ `! C2 f0 R; _+ u6 _
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
8 ? K* y. L. g. v* ~( x Building a new DOS disklabel. Changes will remain in memory only,
% j; Q2 u& O- i" V- E! L* A until you decide to write them. After that, of course, the previous
, q# @/ b7 K, \7 l content won't be recoverable.
5 t& }; T9 i) `( b The number of cylinders for this disk is set to 8322.- `& ]( X' M, P) b5 h6 w3 g
There is nothing wrong with that, but this is larger than 1024,
. _% H% Q% e! T4 [) n4 ?. Y/ k and could in certain setups cause problems with:" _) @( I5 n! g3 L
1) software that runs at boot time (e.g., old versions of LILO)+ L" @0 X/ C0 o
2) booting and partitioning software from other OSs* B. r/ J6 M/ k% ^( W
(e.g., DOS FDISK, OS/2 FDISK)
& L3 T* ^/ C8 H q- H5 \6 w* i) X' ^ Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
! x6 Y! W$ ?5 N5 |3 u; A- ~3 I Command (m for help): p! r( W, k$ c) G3 U! {) F. i: ]; K
Disk /dev/hda: 4294 MB, 4294967296 bytes& y) Q6 X1 }2 Q8 w v+ n* [9 B5 o
16 heads, 63 sectors/track, 8322 cylinders
. P2 P- r0 I9 { Units = cylinders of 1008 * 512 = 516096 bytes$ c) k5 d1 N4 U0 \+ N J# a
Device Boot Start End Blocks Id System) L! d) c* S+ Z9 r2 P# k8 `- f
Command (m for help): m a, {" b/ U2 B8 J. X
Command action
7 M ~2 Q* m4 W' q, P7 a a toggle a bootable flag
6 _! l G9 H+ O' v* R$ ` b edit bsd disklabel. y! [+ J0 M8 x, S( m# X3 Z
c toggle the dos compatibility flag
, o; F2 E. k2 X' M6 M( m1 s d delete a partition
. x, y; ?1 G' x* `; I: `3 i l list known partition types
% C% R0 W% @. p; N m print this menu& c8 R3 G( Y9 ]& {4 F8 ?9 A
n add a new partition
) ?: A. o/ F; K% b5 \ o create a new empty DOS partition table
+ x( w/ ~% I3 m4 M( D8 R5 ~ p print the partition table
% R* ~# U8 r' s q quit without saving changes j8 P t' @0 X4 w/ }
s create a new empty Sun disklabel, R/ E5 b( U6 P& }1 n% W4 U
t change a partition's system id
, t8 ]* S" X# N4 N' { u change display/entry units
+ e) F& @1 ?# L; T5 b. l2 i v verify the partition table
4 \4 Y/ J$ G e8 \ w write table to disk and exit
+ ~9 e5 l! u Q( V* @- d" L" { x extra functionality (experts only)
7 ]8 H6 y6 C& g1 a; w; O. R- f; m Command (m for help): n
* d3 |, \. M4 G: K3 } Command action
2 R4 }8 O q1 J3 u! ~ e extended9 n$ w: J3 e' O" C
p primary partition (1-4)
3 y4 M' i" F$ c, u p. k A3 G$ }2 H$ Q' F/ F
Partition number (1-4): 1! B8 b$ X) Z: H7 m6 U, c# J* x
First cylinder (1-8322, default 1):
2 i1 t' u& }1 C; N7 e Using default value 15 g3 u! b' |* I; k9 `4 ?6 N* A
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
( E R% n/ f3 W; H* _8 j2 C0 }; h Command (m for help): p
9 J. B$ |5 e/ L5 ] Disk /dev/hda: 4294 MB, 4294967296 bytes
6 I, l2 j6 f7 {5 P7 I( |. k9 K( U 16 heads, 63 sectors/track, 8322 cylinders
@9 s% p X+ y' t9 ]" U Units = cylinders of 1008 * 512 = 516096 bytes
: k0 n/ Z+ ~: U; W% q4 T" `1 N! s1 V Device Boot Start End Blocks Id System" G* t, |4 b& L7 ?. r4 K
/dev/hda1 1 1000 503968+ 83 Linux
5 x7 \, }! u8 [/ E Command (m for help): w
, ?) `9 ^( m' v) Q$ Q& a The partition table has been altered!
1 N! s! L; `' i% V Calling ioctl() to re-read partition table.$ ~; \4 x' ^5 \7 | j, c& k
Syncing disks.- s! |" a% e5 K# M
//格式化新分区
! R' r# I% F/ h- s' }) Emke2fs 1.32 (09-Nov-2002)$ {1 s& S3 u+ N8 ?* @6 K* }; p: t) T
Filesystem label=
8 L* i' c9 _: i, H OS type: Linux, X% i5 P; J \5 X, c9 ^: R/ @. E
Block size=1024 (log=0)
2 j: I+ k& I' y! E Fragment size=1024 (log=0)1 p9 d2 F Q+ g, A9 z' n. n: n' L
126480 inodes, 503968 blocks
# F3 ]" b7 |$ L6 l, M 25198 blocks (5.00%) reserved for the super user
3 D& }# O- L: c# _ v1 _ First data block=17 |4 q7 l' Z$ P) p1 L8 _
62 block groups- l; g' y; V9 R$ I( v) b$ ]
8192 blocks per group, 8192 fragments per group& F4 m# O" d. j; j
2040 inodes per group
4 @ A, ]1 s0 A* z% u! Y* } Superblock backups stored on blocks: 6 F2 D* @5 F& r5 l2 e
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
- v0 z) }0 J- Z7 q" x Writing inode tables: done
1 U5 L3 t" f' A- z Creating journal (8192 blocks): done1 [5 v# V- U; x
Writing superblocks and filesystem accounting information: done% F+ }2 j9 J5 |% {
This filesystem will be automatically checked every 30 mounts or7 h4 H. X9 I; O* ?) `* w
180 days, whichever comes first. Use tune2fs -c or -i to override.5 M. E" K9 G2 ^1 Q% @
文件系统 1K-块 已用 可用 已用% 挂载点; V$ e( i! s n0 d& P9 }
/dev/sda3 3723848 705992 2828692 20% /
3 z6 X8 N. Q+ @* G9 Y% P /dev/sda1 101089 9274 86596 10% /boot- h: _& x% F! j0 A* E3 C* L, t, D9 z- Q
none 14520 0 14520 0% /dev/shm$ ~3 L' S, F; \# C5 }( a( [ f. p( H
//挂上新分区# A M2 i1 A5 ]5 ]6 x/ r+ j# g$ |
- mount /dev/hda1 /home/ Y' G6 t! e* D! h L
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点: y1 f5 z) h9 E" n0 h+ K: Y
/dev/sda3 3723848 705992 2828692 20% /! n8 z3 l) N* h5 l
/dev/sda1 101089 9274 86596 10% /boot
/ [% g B, f; r$ Z. b8 p none 14520 0 14520 0% /dev/shm5 v9 j7 b$ @, U& P! p! K
/dev/hda1 488006 8239 454569 2% /home6 E% q, W" C8 g
; c1 K ~3 @' c
自动挂载:. @9 |1 c# Z* r+ D
- vi /etc/fstab3 J; k8 T8 _& g/ a* N7 m
% x7 i, v6 ?( o4 D) B9 a- {3 B! O$ ^- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
7 r& p, J9 t7 g% k
x" V- m/ I: `0 U) @$ W/ n3 i) U- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:1 E) s* i7 H5 V) f5 ]; P8 H
- mount /dev/sdb5 /mnt/ljp1$ _/ ?9 l& j) W6 g: c5 @
- 9 S3 Y! a2 Y5 A8 z3 J, f. ]
- mount /dev/sdb6 /mnt/ljp2
复制代码
, M5 t7 {7 Z" U" @6 I- u4 m& O& `& ~6 Q& @8 O) ]6 i$ q+ P
/ s% r7 {8 M! _) e' O6 r |
|