|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
6 O7 h! q' c, M; T9 I1 p or: fdisk /dev/sdc (for the third SCSI disk)
, J5 v- Q! [0 X' o2 A9 Q+ x7 L0 z or: fdisk /dev/eda (for the first PS/2 ESDI drive)3 k2 r! s+ ?% U$ o4 K
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
2 E$ P0 n( }/ ^2 e- o( S1 ]+ i ...
3 D" o# ?* T" P) T: {9 R- df -k' Z i W% |" a8 k
- df -lh+ a" u. c' F2 V! D* v; `& m& h
- 查看有几块硬盘:fdisk -l+ g0 r1 w% H& _7 X9 g
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
1 M; u9 J, G, x7 m9 g /dev/sda3 3723848 705968 2828716 20% /
' B. {4 U \; q- r \7 { /dev/sda1 101089 9274 86596 10% /boot) A* Q m# M" U$ A9 s$ q! ]5 g0 _& U
none 14520 0 14520 0% /dev/shm) I8 X- G5 R2 G; f* Y
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用# j$ ^ F' o- }: _) \) p" M) J
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
& K+ u/ L* k9 }2 @ Building a new DOS disklabel. Changes will remain in memory only,) f) L2 i f' g" n
until you decide to write them. After that, of course, the previous* g6 Z8 N% F5 Z1 R0 I$ |; M" v6 \
content won't be recoverable.
+ a1 r: D+ L. W( m2 I The number of cylinders for this disk is set to 8322.
9 P' `+ C' h( p% f: E There is nothing wrong with that, but this is larger than 1024,
, T8 }7 O s0 M and could in certain setups cause problems with:
) F9 m1 Z+ q3 p4 V5 a4 S1 s 1) software that runs at boot time (e.g., old versions of LILO)/ ~. K/ g& Z6 d ]
2) booting and partitioning software from other OSs
6 a e9 f& L& y2 ` (e.g., DOS FDISK, OS/2 FDISK)
% @, m" j" j3 h$ K. O a# n Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
3 k" w! F$ z/ a: }8 w/ U2 Y Command (m for help): p
: k' K/ z% M v# o* | Disk /dev/hda: 4294 MB, 4294967296 bytes
1 A0 h3 u8 s/ l: c 16 heads, 63 sectors/track, 8322 cylinders$ ^+ {; o( f: ]. Q# O7 s8 [
Units = cylinders of 1008 * 512 = 516096 bytes ?. r z- b/ Q$ D4 Y8 [
Device Boot Start End Blocks Id System
2 E$ [( P1 Q- M5 e8 L Command (m for help): m
1 l, b% l# f, Y) l& a Command action. _# O6 o: \ [, u
a toggle a bootable flag
9 A; F* | t8 O. h S- ?1 f0 f6 v8 D b edit bsd disklabel1 C: {' r1 ]6 T' V: P6 _$ c- P
c toggle the dos compatibility flag) y9 H0 N1 k/ o' m6 m% }9 r0 O
d delete a partition
5 {* e3 a% E7 _5 L4 Z9 I/ ~3 u; |; _$ O l list known partition types$ {+ C5 N4 F8 t0 ~( G! p
m print this menu
/ `* c) K" o6 z3 N0 Z7 c* N5 Y n add a new partition" a/ u2 Y4 v4 f+ x5 K- O
o create a new empty DOS partition table
6 {# z5 z* o+ u p print the partition table
8 V: v& U# K' w0 t q quit without saving changes
8 H: F7 q3 m, k. O+ J! G s create a new empty Sun disklabel, z. h7 J9 R+ K! A
t change a partition's system id
+ p2 b. O D, T0 Y& \ m* r& V7 x u change display/entry units4 C I& s4 d* ]/ k% u% `# M# M
v verify the partition table+ o D( U/ y. V/ I- R! `; _
w write table to disk and exit7 d v- W9 B5 B" }2 w7 a% p
x extra functionality (experts only): i/ W8 G( z$ E$ Y" P8 ?
Command (m for help): n
V$ Z$ c! F5 r- b& \2 Q Command action
8 _+ C O+ J0 D/ N( v e extended
, f+ {- [7 z% p6 D* U% b* x1 ] p primary partition (1-4)+ W7 y' X( m5 ^/ [
p* @4 t0 ?, S$ x) S
Partition number (1-4): 1. O, n, V( Q6 ~, @6 ~7 v1 C) n& z
First cylinder (1-8322, default 1): . v1 F: X2 Z/ n
Using default value 1
# b- n8 Q+ D& o& m7 `$ u5 q; | Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G6 S, s$ t: |# h y
Command (m for help): p: K8 [) M! n& U$ H
Disk /dev/hda: 4294 MB, 4294967296 bytes: i4 t! O# U. A8 ]$ C
16 heads, 63 sectors/track, 8322 cylinders5 O$ ^" H0 T" v8 ~4 Y' v7 t
Units = cylinders of 1008 * 512 = 516096 bytes2 F* J& W B2 I5 L, |% G! V W
Device Boot Start End Blocks Id System" ]' s& {- E: N# F; v3 Q* J) f
/dev/hda1 1 1000 503968+ 83 Linux
/ l- W( V$ ~5 m% ] Command (m for help): w# e; e& I Q6 Q' j( M
The partition table has been altered!
- l8 }' U( c# I: n Calling ioctl() to re-read partition table.5 j: N2 T: ^; I( t) o
Syncing disks.( o3 D V1 c4 v& s; G* [
//格式化新分区
7 U5 H+ U- a5 y# Gmke2fs 1.32 (09-Nov-2002)+ a( E5 P% F) T( k3 c
Filesystem label=
5 w z! Z4 X5 m: u" P _ r* u OS type: Linux t6 f0 Y& R7 w4 N, A' m
Block size=1024 (log=0)6 p, @3 M) t% l: m
Fragment size=1024 (log=0)
5 k# \' X7 U. ]7 Z 126480 inodes, 503968 blocks
?( O- d# k% v+ {+ h! H* ?, r 25198 blocks (5.00%) reserved for the super user
$ x" d' a& G8 d% { First data block=1
& ]$ x5 U. Y! @: h+ |! b" n 62 block groups
! h, y, Y- M) y4 V% K9 n7 J* ~1 d* ^( y 8192 blocks per group, 8192 fragments per group7 w% G9 F. U# D# _, N' V5 Z& D
2040 inodes per group
0 [7 U$ C+ a- u Superblock backups stored on blocks: ! d! A [) s* k( s% m3 e5 l' s
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
! T7 e. E9 z7 x8 t2 |. m z Writing inode tables: done
, H9 G G( H( {# u5 r Creating journal (8192 blocks): done* G2 ^6 [0 U* q2 S- V) c+ V
Writing superblocks and filesystem accounting information: done
* g# Y' O* k; M9 |$ ] This filesystem will be automatically checked every 30 mounts or i) \8 `' K4 m- O& e6 G
180 days, whichever comes first. Use tune2fs -c or -i to override.
& a$ y' Y. K k r- ?2 p文件系统 1K-块 已用 可用 已用% 挂载点% ^; R" l( l( K7 R2 `4 T- G
/dev/sda3 3723848 705992 2828692 20% /: w& ]4 s2 `" A" ^8 Q9 u- Q
/dev/sda1 101089 9274 86596 10% /boot: Y; Z8 X: G1 \6 D
none 14520 0 14520 0% /dev/shm
2 e+ ~9 ]$ j J4 k //挂上新分区* V' x0 V ]: \" h
- mount /dev/hda1 /home" T2 u5 Q- J$ \
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
# d1 K9 `2 b' R /dev/sda3 3723848 705992 2828692 20% /
: F) U: y+ C$ x /dev/sda1 101089 9274 86596 10% /boot
1 l8 M/ B1 I6 n5 R1 X+ {3 T none 14520 0 14520 0% /dev/shm
# n. C1 k! v+ h1 M& S+ \% I. {& g /dev/hda1 488006 8239 454569 2% /home
' ?. P: b( D) U* s
1 F, X3 I, q0 r/ d F+ E自动挂载:& n5 d3 n7 V5 l; r! G
- vi /etc/fstab) [1 E6 ?; t3 B2 W& Q$ R1 V6 K
- + f- u. v4 i8 D' a7 }8 X
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0' j6 G' g0 [$ f" k
- 4 S: f) t: g0 p. G1 p
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
; T- P" }$ }1 \! ]( O; n: n( t0 z% g- mount /dev/sdb5 /mnt/ljp1
& A! e2 Z; x9 R' {1 U* P - " S" l* c! s$ c* P
- mount /dev/sdb6 /mnt/ljp2
复制代码
/ z% u4 j0 Q1 @7 f1 D
0 {1 Q( {. P, T. m/ A: A- x5 i8 Q& w; v9 z. P- L2 P; P
|
|