|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)4 L9 G7 g1 L' e6 ?4 F
or: fdisk /dev/sdc (for the third SCSI disk)
1 u0 a: f c# s" d6 v4 q7 F. z or: fdisk /dev/eda (for the first PS/2 ESDI drive)
. H2 @7 {! m @! H2 O2 L8 p. D or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
, ^1 \7 i2 Z; x6 o# r0 i9 _ ...0 o/ N) D! @, W' Q) g! E! K0 X) u% d
- df -k
- a" ?3 \3 }* Y/ Q! J/ z - df -lh; g( G8 e8 K% s
- 查看有几块硬盘:fdisk -l |# {+ f5 U% U p3 f) n
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) z v* N9 D, ^" A# F /dev/sda3 3723848 705968 2828716 20% /
2 r' c _# }; L3 N+ y, K /dev/sda1 101089 9274 86596 10% /boot- v) C+ _1 M( q1 ]% Z! ?
none 14520 0 14520 0% /dev/shm
2 T, F, H: u" h 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
K' n! [6 b4 B; RDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel8 S6 k4 t) g- n+ u) n& B
Building a new DOS disklabel. Changes will remain in memory only,
M( @' _9 g) w- p2 f until you decide to write them. After that, of course, the previous1 u+ H7 S, a2 |$ g. a; W7 d" j
content won't be recoverable.
& H* L7 p# k, o3 l4 R5 y The number of cylinders for this disk is set to 8322. h, X/ }7 X2 }
There is nothing wrong with that, but this is larger than 1024,, V; @" S% ~- H9 M @3 \# N
and could in certain setups cause problems with:
/ i* G( X( c7 ^. t; M ]) N# u5 X4 q 1) software that runs at boot time (e.g., old versions of LILO)
: i- Q. j! C7 X* Y2 c. f 2) booting and partitioning software from other OSs7 e$ I$ K. x* N
(e.g., DOS FDISK, OS/2 FDISK)
! r. k2 g& w3 e+ Q4 D2 Q3 t D Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)- N. w6 H4 G) T6 W) z
Command (m for help): p" c+ y: f9 I0 ^5 U7 v! T
Disk /dev/hda: 4294 MB, 4294967296 bytes
' M6 z/ Z, x9 X4 u 16 heads, 63 sectors/track, 8322 cylinders) E; g+ U7 t2 f
Units = cylinders of 1008 * 512 = 516096 bytes' e6 C- J9 W4 e1 E6 }# {
Device Boot Start End Blocks Id System
; Q2 I0 G2 j7 n; w Command (m for help): m# W3 J) D, z( G3 M4 g
Command action; f- k/ A! _' z- l- b7 R
a toggle a bootable flag. M, ]( C: {: g; q" w
b edit bsd disklabel
& d' J- R+ @& m, D c toggle the dos compatibility flag* A5 p+ j# M3 c. i6 P- g+ N
d delete a partition/ t2 Q* |5 r2 p! ~8 p
l list known partition types( p$ c) r( Q' U( U
m print this menu& B6 H" ^/ s' W9 _# E$ |
n add a new partition* T, h+ y, b0 m1 j: H# R' n5 E5 s
o create a new empty DOS partition table! ]8 _+ m+ s8 m: t1 c0 S# U% k
p print the partition table) r% }( A. Z7 E# l, m* R0 m
q quit without saving changes
- E8 C4 t- n5 J# B2 }$ `( Z; ? s create a new empty Sun disklabel
0 z0 I& K$ m* q, d t change a partition's system id! V- p; ]/ Z, {/ \: d& b
u change display/entry units% Q- \, _: a/ X* \3 E% L
v verify the partition table+ a: I) m9 g$ W M' F
w write table to disk and exit+ ?1 c7 M4 J d$ C
x extra functionality (experts only)
3 Q' [' t2 U7 T# Y. ?: P$ D/ r Command (m for help): n
5 D3 {5 j6 x* C1 ^- z) [& l3 o Command action
: r6 c# P" c" ]' _: r5 J' Z e extended' S& N6 J$ e! U2 S* O9 U
p primary partition (1-4), }6 T* N; V0 k
p5 y5 I: ^& b+ D/ E
Partition number (1-4): 1; M( H9 }' U+ t; ?' g, `8 N, g4 v
First cylinder (1-8322, default 1): 8 t0 S. t( F9 G) ~ Z" q# m( I
Using default value 1
y/ L* f, u) C& P* V3 ^" b Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G( `, J: ~( F. x% r; o2 |8 Q
Command (m for help): p% u5 r/ ?( \: }- U1 X, p7 ?) `
Disk /dev/hda: 4294 MB, 4294967296 bytes1 x+ Z' U. Z! b( J+ m! X( g9 d7 y
16 heads, 63 sectors/track, 8322 cylinders
0 |" L, W0 s( C- V. a7 |- K Units = cylinders of 1008 * 512 = 516096 bytes$ ~9 C) u% d/ e" f2 W! d3 @
Device Boot Start End Blocks Id System/ w( {8 X* @4 Q+ w) x2 r: b
/dev/hda1 1 1000 503968+ 83 Linux
1 Y, P; j) m% Q3 S Command (m for help): w9 V" q! J. A9 O" S/ S8 J. j; k
The partition table has been altered!
% b. D3 B& p1 F: L: R& Q4 Z Calling ioctl() to re-read partition table.
) }8 d T6 ~$ ? Syncing disks.
3 B* m* K# e8 w8 w //格式化新分区
/ R! ?( E/ z2 Q1 y' Vmke2fs 1.32 (09-Nov-2002)/ f0 S' X5 v. o- A& \
Filesystem label=3 M1 ^9 p. u" }& L3 j
OS type: Linux
5 l6 e, L" Z4 w5 ^7 A; o1 N Block size=1024 (log=0)
5 ` I# s$ C4 s ^& ` Fragment size=1024 (log=0)( {1 r4 ^1 d; R1 A
126480 inodes, 503968 blocks
4 C$ K2 @, M. Z# Y5 v! G& X7 |! d 25198 blocks (5.00%) reserved for the super user
4 o0 T8 \- @; t First data block=15 w( S8 W7 u" l1 b2 h( a; D. c% U
62 block groups
2 V3 V b. F( s c3 w 8192 blocks per group, 8192 fragments per group: w+ O3 @* W+ f; c/ o# t% M
2040 inodes per group
& v, |" w5 v* E; l+ N& R Superblock backups stored on blocks: , X9 S! ^ o# b) {4 B2 j5 ~
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
7 T& @0 a, ~9 Z Writing inode tables: done
4 F9 V9 @1 d. v4 B1 u Creating journal (8192 blocks): done3 ?+ b0 n9 T* b& E& {. }% O
Writing superblocks and filesystem accounting information: done
, G, o% R, B. c. d4 R This filesystem will be automatically checked every 30 mounts or3 R" _5 w7 k4 _7 w2 s1 F6 @
180 days, whichever comes first. Use tune2fs -c or -i to override.
% i1 t( H- L1 m/ R! ]3 G. K文件系统 1K-块 已用 可用 已用% 挂载点+ t1 h( ? C& j/ i2 Y; C6 M) D% s
/dev/sda3 3723848 705992 2828692 20% /
. x* i7 y- {* c9 ]1 }' K /dev/sda1 101089 9274 86596 10% /boot
2 C Q% d) L9 V none 14520 0 14520 0% /dev/shm
# X9 Y6 y0 t, `8 O0 w% h! f //挂上新分区
% h F8 N2 A8 r7 Z/ |- mount /dev/hda1 /home! {1 o2 x6 W0 V/ H. y4 E& Y X4 G# H. l% K9 w
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点, t: z) R+ _) Y* ?- `4 R
/dev/sda3 3723848 705992 2828692 20% /
0 j3 Y. i2 B# G' E( K) ] /dev/sda1 101089 9274 86596 10% /boot
# u# T+ B \) g( y# i$ m none 14520 0 14520 0% /dev/shm0 W1 J- L9 I R! b, U7 Z+ ~1 \$ r4 D
/dev/hda1 488006 8239 454569 2% /home
! n/ C* `8 y, x1 k/ p( Y
* ^0 A* ?6 h+ V( X1 U: J3 q3 P& o3 z自动挂载:8 z* b* i7 F: p6 n) v
- vi /etc/fstab8 g: |- x7 |" b; R4 T# ^- f
9 s* M1 q3 @7 ?- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
+ g7 M7 H2 w$ [4 O( f7 g - 3 _* t0 f& O% R# h' P: N
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
6 l5 j4 ~4 E! _8 i2 G9 L& D+ \- mount /dev/sdb5 /mnt/ljp1/ N, |! V; Q7 b5 E# r8 k: W/ |
- $ _) }& _4 n0 K, c+ o4 @
- mount /dev/sdb6 /mnt/ljp2
复制代码
: `6 p# L0 A. ]- @0 F q
9 W9 s: T- t/ m( ^( R7 k3 C1 E8 K* T+ V: G E
|
|