|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
- U! G) v6 L" b+ P5 b9 S1 ] or: fdisk /dev/sdc (for the third SCSI disk)4 M% w4 c. b* E7 x( _
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
+ V& H1 }9 G& W, L' b6 U. g; _( R/ R or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
; T: ?5 u, _1 Y! r m8 j& s ...3 T( d) X/ ?7 {; S, t- i2 }
- df -k. y2 h5 I& ^$ n0 x
- df -lh
2 n9 c5 g3 Y% p7 h5 @. L& \$ | - 查看有几块硬盘:fdisk -l
: h1 v- i- T$ B
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 b4 W3 x! f& | G/ f* l /dev/sda3 3723848 705968 2828716 20% /
+ K" C ], {6 v, t /dev/sda1 101089 9274 86596 10% /boot( L4 C: x' `# j8 X# P: S$ k5 I
none 14520 0 14520 0% /dev/shm
0 R5 C6 q* h' G% p) b9 \$ c6 W* F# P 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
1 A4 ~8 @/ A) }4 ~2 `Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
A" E) ]8 d V. q% U. ^9 v1 i" }8 ~ Building a new DOS disklabel. Changes will remain in memory only,
, E8 J2 r0 `/ Y C# L& d$ ` until you decide to write them. After that, of course, the previous( v* x$ s# q3 S0 g: b t
content won't be recoverable.! c3 h5 f3 A$ H+ R( [' l
The number of cylinders for this disk is set to 8322./ X7 N# w, E$ ]
There is nothing wrong with that, but this is larger than 1024,
: X. a2 T; `5 J2 Q K and could in certain setups cause problems with:/ t% y) b( A! X) Z; E$ V$ J2 v
1) software that runs at boot time (e.g., old versions of LILO) c' V7 ]( x8 i5 m9 l4 G
2) booting and partitioning software from other OSs0 c' c: |( |# ~6 E8 a
(e.g., DOS FDISK, OS/2 FDISK)
* ?' K# c, Z. {* o# e p Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
% I. f0 o3 n+ u Command (m for help): p1 A" m. _1 g5 G; }4 p
Disk /dev/hda: 4294 MB, 4294967296 bytes
4 i/ N; h' A! Q) ~/ r9 o: L 16 heads, 63 sectors/track, 8322 cylinders* [2 e7 Z% v% `) A- H! b
Units = cylinders of 1008 * 512 = 516096 bytes
% s2 W) p; S, I Device Boot Start End Blocks Id System
; x( v @- r. T' V: f4 t* N+ g Command (m for help): m \' M: v3 p- T& B
Command action" B) {: @- Q/ m
a toggle a bootable flag
1 c p" B$ P$ z- U8 e% R' d2 } b edit bsd disklabel
! t* {1 K0 V$ j5 Y6 t q2 w% E c toggle the dos compatibility flag
2 K$ h, a# x: b* i P, o d delete a partition
% R- p) f y* C# a l list known partition types
2 B8 s- y' k; g$ j m print this menu
% ]- I! h( M/ R n add a new partition* d) w V) D. F" r1 O
o create a new empty DOS partition table
3 T* B6 Z2 E1 P% d p print the partition table
" @: _0 Z2 m# k) n) N, Z# j3 E3 i q quit without saving changes
4 E1 @4 p$ p8 u* W s create a new empty Sun disklabel
! Q4 U" B7 J4 O0 b t change a partition's system id. D4 x6 f6 g6 f1 Z: y5 X6 k9 ^
u change display/entry units
* |/ d: a6 _- }: `! _; q. D v verify the partition table
2 \' _- \1 j! z" @ w write table to disk and exit
, B6 v+ ?! g1 @+ Q3 [ x extra functionality (experts only)( s* y* I, y/ [! Y! {0 w0 U* R- V
Command (m for help): n S/ S3 C( |6 n
Command action. [' ^* K, ?' @9 V1 x5 h6 q$ K7 w
e extended
* l! W$ q+ H2 a, a, y6 P p primary partition (1-4)- c* j& k; u4 N O2 R% Y
p3 b( Z9 R6 @' i0 S5 v% R: t
Partition number (1-4): 1+ r" O% f* [* S x3 P
First cylinder (1-8322, default 1):
4 r( `0 N, I) S$ { Using default value 1
- E5 q# z) ~+ _9 `+ u Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G l3 m. u/ h# `# ~/ s- K
Command (m for help): p3 o6 X- _5 J5 _! w! q6 q: y
Disk /dev/hda: 4294 MB, 4294967296 bytes
/ w3 q" l/ B. T! M. x1 @ 16 heads, 63 sectors/track, 8322 cylinders% M4 i( \6 ]6 M8 Q( a6 Y
Units = cylinders of 1008 * 512 = 516096 bytes) }0 ~1 J8 S+ U8 L
Device Boot Start End Blocks Id System1 ]1 k) h- k9 M! X5 S& V% m
/dev/hda1 1 1000 503968+ 83 Linux" i$ ^/ i. o2 Z; T, e
Command (m for help): w( O. j6 Z* i" Y# n
The partition table has been altered!: G. H; A" G- ?8 g. h" K
Calling ioctl() to re-read partition table.
- w+ k6 q! u' o: j0 c3 u( ^ Syncing disks.9 e6 O0 a4 q4 H1 X" T
//格式化新分区1 T7 h j1 G A3 r0 l w& K
mke2fs 1.32 (09-Nov-2002)
) d6 n* y+ l3 W; J% p Filesystem label=
8 h2 \* Q: }4 Z OS type: Linux
) B7 K. D% |9 [ Block size=1024 (log=0)
; V; U6 p0 B' A8 `! D Fragment size=1024 (log=0)+ V, S: i y6 O# f
126480 inodes, 503968 blocks
, |& o0 G8 F' c% [1 K7 M 25198 blocks (5.00%) reserved for the super user+ B0 @, a$ u. T& ~6 A8 ^
First data block=19 h3 d9 F$ G7 R% a" Q8 ~0 [
62 block groups
4 P* c* y w" J" \9 {- m$ U; f 8192 blocks per group, 8192 fragments per group8 |; z$ x5 {. G' v
2040 inodes per group
: j; F2 R7 `! O4 K( x6 c0 S8 X Superblock backups stored on blocks: 7 | b* M& d- u) ]" W: i
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014091 Z) c$ n4 }7 w8 z; G5 X; o
Writing inode tables: done
$ E9 a+ Z# q0 h" d: v Creating journal (8192 blocks): done
, | Q+ H4 p" L9 E' ` Writing superblocks and filesystem accounting information: done
) {6 _3 A( z/ L2 ] This filesystem will be automatically checked every 30 mounts or
3 x+ _: b a. l- ^2 @! p 180 days, whichever comes first. Use tune2fs -c or -i to override.
0 C2 U! v* M# i& G0 \文件系统 1K-块 已用 可用 已用% 挂载点
1 X* m/ V- ^7 v! a$ n /dev/sda3 3723848 705992 2828692 20% /
( {; [" y5 K0 a7 ?8 _3 J$ e1 { /dev/sda1 101089 9274 86596 10% /boot& |8 V+ M% f% ^; F4 u! }2 z4 D( @: n1 O
none 14520 0 14520 0% /dev/shm
% \8 ~2 k9 R" Y( Q2 g( [, [ //挂上新分区/ U1 s7 n" @3 N5 _9 h
- mount /dev/hda1 /home
P u( q8 ]2 O5 I1 S - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点4 H6 J/ |# Q! B$ S+ i# r' u& `
/dev/sda3 3723848 705992 2828692 20% /
0 @0 N4 z+ u3 N5 P /dev/sda1 101089 9274 86596 10% /boot9 _( k& W+ |0 l9 v* w- M/ x
none 14520 0 14520 0% /dev/shm
q5 W4 J' D8 q8 a* A0 v, s8 q /dev/hda1 488006 8239 454569 2% /home, Z% K. E6 k# L3 `
' k* S) V1 P+ P3 w4 j: A2 |9 }4 v8 s
自动挂载:
0 v. N _- T/ w* }- vi /etc/fstab
% v0 H& {8 M9 G' C5 }5 H, M7 g( i
2 V$ y* o4 J0 P8 K3 O) V/ N. S- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 03 Y6 G/ g. {4 S3 m9 ?( \
6 |' {$ }. B5 A3 ~+ v) O- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
+ E8 t3 K+ e8 ^, U5 ~9 Z6 S0 e- mount /dev/sdb5 /mnt/ljp13 v) x$ H0 `' {9 ^2 e
- ; F2 H( w' U% H- ~* |2 z$ n
- mount /dev/sdb6 /mnt/ljp2
复制代码
1 }2 l& J) r) g: V' k0 v, D
) a6 o9 l; q9 B) v: i& W9 L* @! `+ y" J9 M4 y! J: C* X4 l
|
|