|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
o" F! U* R: L Y; M' J+ \! z$ @ or: fdisk /dev/sdc (for the third SCSI disk)
2 Z- Y9 Z. o+ ?; z( n or: fdisk /dev/eda (for the first PS/2 ESDI drive)
* X5 k' o/ t" F" u! V& \% { or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
2 ~; `! {6 P; {% L* x" I8 y( j, X ...0 N+ C. E7 n1 u, H1 |
- df -k1 R' r) v% R6 ]5 g) q4 M" J% ?
- df -lh
, j0 c% n) E# V7 t - 查看有几块硬盘:fdisk -l4 ^9 d: q# i2 G" d
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点$ N# c `4 G/ P8 x( e, F
/dev/sda3 3723848 705968 2828716 20% /
7 _* w& g: e$ ^1 }/ G8 K/ Y X /dev/sda1 101089 9274 86596 10% /boot& L! _( a$ ^2 n% y# v7 w8 F; K) ~4 k a
none 14520 0 14520 0% /dev/shm
: O7 l5 c9 ] C* ~6 f E- y% ^ 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用8 l* O; b7 f. h0 c4 r7 J0 F
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel# Y9 t7 `) P/ Z5 ^ G8 ^
Building a new DOS disklabel. Changes will remain in memory only,
" Q3 V( x, {# ]! M D" V( F1 e until you decide to write them. After that, of course, the previous
2 k k9 m% |$ B content won't be recoverable.
9 v5 i% @ F' }+ J& v The number of cylinders for this disk is set to 8322.3 Z9 k4 v- a! p* r" ^3 |( p0 \
There is nothing wrong with that, but this is larger than 1024,6 K. ^$ X1 C1 O- \4 d
and could in certain setups cause problems with:# Q" y, t0 n/ `
1) software that runs at boot time (e.g., old versions of LILO)
" \) s3 u1 | z" [. n4 i' W 2) booting and partitioning software from other OSs
7 M( x8 e' V7 H* V; h$ f (e.g., DOS FDISK, OS/2 FDISK)- E. e. b# Q0 Y5 v4 z0 D* U8 Y
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
, G1 f6 o2 I. O8 P- O# ^ Command (m for help): p
# H" Z; W2 n& D2 w' g. ] Disk /dev/hda: 4294 MB, 4294967296 bytes# }, X7 n& a1 q6 B. {/ i0 m, @
16 heads, 63 sectors/track, 8322 cylinders
/ z4 F3 M, ^! L( J( l X, b% y Units = cylinders of 1008 * 512 = 516096 bytes- q0 g, @. |8 o% B% F
Device Boot Start End Blocks Id System
5 I, I4 k$ X6 n( h Command (m for help): m
, }& O' J. ]" d1 B7 S6 P Command action+ c0 ~# E6 h- x2 h
a toggle a bootable flag# n/ e$ u+ C! X9 f: v2 ~- ?2 ~5 q
b edit bsd disklabel
/ @7 ^0 r0 S* P* s; @. k; v' v2 D0 E c toggle the dos compatibility flag
! _* y L& T. s% k Q d delete a partition$ R) W- }/ P7 n8 H7 M- L
l list known partition types* [# C/ C3 j0 N+ K6 f9 `' B
m print this menu+ h* O H! e1 j: h) D
n add a new partition# j' T. V2 o3 N$ R& Z' L! u
o create a new empty DOS partition table
. d, o& S0 W0 Z7 r p print the partition table' _1 e+ f6 W8 t1 B
q quit without saving changes
& k) l- }0 i( i8 [% w! q2 @+ V s create a new empty Sun disklabel7 T* |' f% N, v/ s
t change a partition's system id* r/ S* {6 Z5 R3 z7 l7 _
u change display/entry units
9 B; a0 ]$ f; B. A/ Z# _ v verify the partition table$ I4 c, O, s5 b( v5 ]& m
w write table to disk and exit
# q- a8 C- [7 ?( p$ m x extra functionality (experts only)
* A- O: T7 O# l: \' v* D1 g Command (m for help): n1 w" f2 q; B; ?3 w, Q) E$ e% g( g
Command action& J% s. q8 _5 ?) k
e extended' C# c% U7 D5 n
p primary partition (1-4)5 }: _( J4 Y$ p/ c6 D( ]: k) u
p
) k# O5 h4 P8 A: [$ e) ~ p Partition number (1-4): 1+ H) X" _0 I8 A
First cylinder (1-8322, default 1):
: O8 a9 [; y3 Y Using default value 13 N3 w; t0 N" X7 d3 S2 M
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G! s+ {8 x) d. x
Command (m for help): p7 G5 D) c' W, y1 d# I0 @' N
Disk /dev/hda: 4294 MB, 4294967296 bytes
( x) ?3 o) Z4 o. U$ _: `* b& k 16 heads, 63 sectors/track, 8322 cylinders( S" P. Y) M& E: {3 \, m
Units = cylinders of 1008 * 512 = 516096 bytes+ z- T# p) t: T( ]: | _
Device Boot Start End Blocks Id System
! c: ]3 V* Z: }' n/ q( C& I' W /dev/hda1 1 1000 503968+ 83 Linux# L ^# T1 U& _. X0 T& G
Command (m for help): w1 b! u. w# m" N% P, Y
The partition table has been altered!
6 d5 _; U0 E9 j Calling ioctl() to re-read partition table.
! R( \6 K4 l0 ?" I% T2 C) d: W' D" u. b Syncing disks.$ \5 s% O$ L; q- D$ X. q6 R/ v( L% _
//格式化新分区
) L: _- B/ M! zmke2fs 1.32 (09-Nov-2002)
8 R7 s# Y! T- ]3 T2 O# D- l* Y# @ Filesystem label=% o. Y2 ^% o$ q: S" @9 K
OS type: Linux
& g0 k, i* a% N: J, p. q& ]3 M; C Block size=1024 (log=0)
1 C3 l" g$ q. c& p7 N M8 Z Fragment size=1024 (log=0)6 I K: S8 R; r$ [% l$ [
126480 inodes, 503968 blocks
' x' s' O. I3 V3 i* {& P3 l) G: J3 t- T 25198 blocks (5.00%) reserved for the super user
r8 M; [' X8 s6 l* d p First data block=1' o, k2 j$ o6 m4 R# ] j+ F% [* k
62 block groups W! c( |$ J' I* G" F/ v8 E2 z% p
8192 blocks per group, 8192 fragments per group
! s. J3 U# h2 x4 n 2040 inodes per group+ [& W g5 u+ Y- F; {( z2 Q
Superblock backups stored on blocks:
# m! E8 j& q: A. x# N! W, n 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
0 V& c9 s/ m) K4 \8 G Writing inode tables: done
9 ~; t; H( s+ g+ w Creating journal (8192 blocks): done
' n0 _& f& `) G T- r8 Z% Z Writing superblocks and filesystem accounting information: done
, n/ ] u s9 m This filesystem will be automatically checked every 30 mounts or
: [$ `+ e0 `$ C8 o' G1 T" N* r8 T 180 days, whichever comes first. Use tune2fs -c or -i to override.
" }! n; ~- u3 H; @* M9 G4 k9 |文件系统 1K-块 已用 可用 已用% 挂载点
" r. G/ a, k, ^6 g( Q /dev/sda3 3723848 705992 2828692 20% /9 ?& G1 F) W6 u
/dev/sda1 101089 9274 86596 10% /boot6 y6 D+ s* ]9 o- G; C+ F
none 14520 0 14520 0% /dev/shm
: T. S, o0 _8 T6 {0 H6 L //挂上新分区; {; {/ z* F! k# Q
- mount /dev/hda1 /home1 q v4 r% v, O( r0 b9 c* R- O+ r
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
1 O- I) ~- L$ l* ^) ?; n /dev/sda3 3723848 705992 2828692 20% /
( y7 v4 S4 \& |, L' K( Z) n0 r /dev/sda1 101089 9274 86596 10% /boot
/ X. w; B9 W$ v none 14520 0 14520 0% /dev/shm" d9 C$ Z1 M/ p. x
/dev/hda1 488006 8239 454569 2% /home
# @- f$ w; \" X
8 R! F# L5 `2 o. o' y& M, y9 t5 M自动挂载:
' I h# H6 _6 i- vi /etc/fstab
; V, K; ^1 N! i$ B0 q
' T8 L7 f" g/ O$ ?) q! ]- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
! x( s5 c' v. ^ - : c5 a. c4 F2 G7 I* J8 X3 _
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:; z! e9 d3 l" X; _4 n$ Q
- mount /dev/sdb5 /mnt/ljp1
( K- m& R$ O( _0 f - * T- ?1 V$ u: I) s, }2 Z: u: X
- mount /dev/sdb6 /mnt/ljp2
复制代码 ( j% Y. w8 o0 Y+ A
/ K. \# r1 y& K; a/ {1 _0 i
3 \- @, v; y4 z2 i3 M
|
|