|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
5 y% L* U5 p9 ^* _# x) I or: fdisk /dev/sdc (for the third SCSI disk)4 h/ T( w% `$ W, S& k. J
or: fdisk /dev/eda (for the first PS/2 ESDI drive)* S$ T6 l* }" C; b: I9 ~) I/ `
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)& m% Y4 R: z' b
...
9 n% E# a/ n1 f8 X- df -k" x. q/ F; X2 Q5 J
- df -lh
4 s0 R. f: T! @1 l4 j2 X/ N) J - 查看有几块硬盘:fdisk -l* P& f& K& f7 |" c
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
0 z# R1 P: I4 a+ U7 d /dev/sda3 3723848 705968 2828716 20% /
+ Y7 O* J, ]$ E0 a8 `. f /dev/sda1 101089 9274 86596 10% /boot
% ]) g T/ q, \, {, I( | none 14520 0 14520 0% /dev/shm
* N8 ~# x* O, s8 T0 C 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用; m# N& u1 i- n8 p; }! s7 s. u
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
# v0 J j( U" A" ?/ [9 I8 P: T, _2 d Building a new DOS disklabel. Changes will remain in memory only,% T1 j7 d. M# V$ K4 Z
until you decide to write them. After that, of course, the previous
# T+ X4 y- _- G! J5 e content won't be recoverable.) `( ]( N5 M$ ^
The number of cylinders for this disk is set to 8322.
4 u3 g/ G0 d6 `( z& j: a8 y There is nothing wrong with that, but this is larger than 1024,, O, Y+ B( ?3 r: r6 T4 }
and could in certain setups cause problems with:
; o9 F( I2 @/ p) }+ i' ?/ ?( W1 k 1) software that runs at boot time (e.g., old versions of LILO)
; N- i+ i! s- S9 y 2) booting and partitioning software from other OSs
/ I, X" {7 @3 g x8 F3 U: f7 ] (e.g., DOS FDISK, OS/2 FDISK)
8 Q+ p5 ?) e% z' g3 e Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
; e7 w9 l q. ]& s6 F0 U5 C! t: W Command (m for help): p1 r6 S+ K; ^- n0 X$ p7 ~
Disk /dev/hda: 4294 MB, 4294967296 bytes
( N: M; U) t& G# C& @( g" e 16 heads, 63 sectors/track, 8322 cylinders9 ~+ v1 d/ e4 K% {$ E
Units = cylinders of 1008 * 512 = 516096 bytes8 y+ l4 e4 i, u
Device Boot Start End Blocks Id System' w. ]$ y. `7 E' X# ]7 q
Command (m for help): m3 P7 E n# y. a
Command action
: i* ^2 ~3 V! v5 G1 r a toggle a bootable flag) M" i' k. V% K# X
b edit bsd disklabel. }1 n p3 V5 W
c toggle the dos compatibility flag
1 D$ N2 l' U* w* Y8 d4 Y d delete a partition
( @+ Y# \! ~$ e1 Y# R" W, l% w- ` l list known partition types
$ f8 c, L' S+ P5 K4 c* h* ~: O! l% ~ m print this menu
/ g5 W7 i5 C& u4 f! r) v n add a new partition
2 l W$ r3 U! m* H X1 F7 o# T o create a new empty DOS partition table
" P* V( G8 e9 ~ N" _/ C p print the partition table1 V# U+ Z4 R' T' q2 m8 C
q quit without saving changes
# J4 e; a6 r; h$ l9 }7 a. T s create a new empty Sun disklabel
9 q- y$ E2 u h t change a partition's system id# W- m# f5 W- X. H5 @6 u. }( [
u change display/entry units
. x+ B0 R. ^' d) i" X v verify the partition table
9 d, s8 U0 J8 ]. g* d- R( C w write table to disk and exit
* ~, Z: I9 I) I: D) r x extra functionality (experts only)
' T/ j+ U$ ]* w" V Command (m for help): n
" {4 t& a5 t) C Command action
. q. e7 O0 ~7 C& B6 } } e extended) {( A7 t: K4 Q+ v( V$ O4 z
p primary partition (1-4)
4 B& w' g' ~" B! F% X8 D: E [ p3 Y# Z p0 c9 X+ L( F; V p
Partition number (1-4): 1; R" I2 Z s) Y" A& i/ A
First cylinder (1-8322, default 1): : D/ y) q- z% K: [, ~( F9 l `* G! H' b
Using default value 1 O; U( Z* {$ I# v6 l( L0 Z1 z
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G6 @' M& H( D' }& t9 _$ \
Command (m for help): p8 d4 \5 a% i0 T$ \8 l
Disk /dev/hda: 4294 MB, 4294967296 bytes* Y5 |: X( v; l; `9 V. O/ e
16 heads, 63 sectors/track, 8322 cylinders
4 F) i/ Q, x e2 R7 I/ X* D Units = cylinders of 1008 * 512 = 516096 bytes
. l. q' b8 ]2 o j Device Boot Start End Blocks Id System z+ @: n9 Q& S
/dev/hda1 1 1000 503968+ 83 Linux
- \, Z: J8 @) f- _; i9 B Command (m for help): w
; h I" b: Z0 j The partition table has been altered!
# b/ n$ Z6 F& o b8 V0 L1 i! ~ Calling ioctl() to re-read partition table., p6 f, V7 `( b: }9 x5 y* N/ a
Syncing disks.- S4 O) Y a8 D
//格式化新分区* M+ N$ s/ b8 f6 `
mke2fs 1.32 (09-Nov-2002)
3 Z( B h+ F4 B5 a. p. i Filesystem label=
4 @2 ~% t6 X: a0 J0 c& Z! x6 o1 X$ ] OS type: Linux
. n2 E6 d2 f3 }5 l3 _9 U) i) Y0 ` Block size=1024 (log=0)
$ k! I- F# V# J5 G Fragment size=1024 (log=0)
( [+ D) x# I0 z( m+ l 126480 inodes, 503968 blocks
! y7 {9 [+ z z, \5 o6 A 25198 blocks (5.00%) reserved for the super user* P9 b; K( _6 [0 h
First data block=1) |5 P& ~0 A5 P$ h) Y; {( w q9 B
62 block groups8 c) m# ^. j. w
8192 blocks per group, 8192 fragments per group
/ M& H! U+ _0 C% F' z& C 2040 inodes per group' a4 H3 ~: Z( X0 e0 i7 K& O+ a
Superblock backups stored on blocks:
) a2 c! B% W- D 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409$ i. z5 x7 F P3 F: w, x0 H5 }
Writing inode tables: done 0 X* m- A0 C- ?
Creating journal (8192 blocks): done4 R! f* O) \/ C$ n, E
Writing superblocks and filesystem accounting information: done9 e$ m7 Y( r& n
This filesystem will be automatically checked every 30 mounts or9 ?! z; [ { ~# k5 H
180 days, whichever comes first. Use tune2fs -c or -i to override.
! w- r* Y7 @2 N, p1 E. e2 J! m6 W文件系统 1K-块 已用 可用 已用% 挂载点
4 E; I6 B" {0 J /dev/sda3 3723848 705992 2828692 20% /# a) T, A/ R" P, l& K" B
/dev/sda1 101089 9274 86596 10% /boot K, H8 N. p+ ?8 Y
none 14520 0 14520 0% /dev/shm
" u- }6 L+ U$ q2 Q! N- E4 |. B& H* L //挂上新分区: H9 Y3 B' G) r8 V Y2 y B
- mount /dev/hda1 /home+ b7 i2 G( g8 r1 o' J' |
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点" _1 M/ @1 p$ a. z0 t1 T+ z
/dev/sda3 3723848 705992 2828692 20% /) _; ]6 [6 ~8 B9 P- b
/dev/sda1 101089 9274 86596 10% /boot
) q P2 }9 z7 {5 f: N; h' g3 `. q none 14520 0 14520 0% /dev/shm- z z0 l' q' q, Q* R+ t
/dev/hda1 488006 8239 454569 2% /home! N/ q- M# q& X! _ {
! }5 `" }2 F1 j* h6 m5 G自动挂载:! ~9 @2 e) c6 p; f6 d. P# I+ E4 ]
- vi /etc/fstab
% `, y% y# _7 x! `3 P* l
0 U I4 _, H4 d$ P. o. l* D. M' o- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0) N! H/ Q1 w: d3 D# h6 K$ W( m
4 `1 X0 M' L8 |1 S! u s; e- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:2 l# O y1 t+ i; E) A
- mount /dev/sdb5 /mnt/ljp1
d ?& y& c* v2 Y/ _+ G - + L, G# }: f/ y# L
- mount /dev/sdb6 /mnt/ljp2
复制代码
; O6 W7 E# ^& D y5 K' g# A/ P4 W
5 G, g& l+ \, Y' r/ f( @! w. W- E) P% m% w9 o) J: ]( |2 Q
|
|