|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)) j2 E; i6 {7 A5 B! [
or: fdisk /dev/sdc (for the third SCSI disk)
+ z- q* V1 P& P/ x7 y0 g or: fdisk /dev/eda (for the first PS/2 ESDI drive)' N6 M' k- c9 K2 E5 P
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices); i( o4 V( Z8 n6 l; W7 i" V
...
9 P& K8 x( w) W5 A" \$ }& ~- df -k
3 Y- f2 S) L0 n$ s- S# d( Q - df -lh
% i/ S2 ?" s6 A - 查看有几块硬盘:fdisk -l' @# c; C; V) |) n, Q+ N
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点; l/ p( ~0 h# T* t$ G# i2 K. X
/dev/sda3 3723848 705968 2828716 20% /" D: |$ N. x7 _7 O3 w
/dev/sda1 101089 9274 86596 10% /boot+ Y3 m9 G4 B; i a
none 14520 0 14520 0% /dev/shm8 N. j3 Y- n* S& X" d* L
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用) ]+ G. p2 _6 T+ W4 T1 ?0 ]( i0 Y
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel$ ]4 d' Q. i; E* a3 v+ e
Building a new DOS disklabel. Changes will remain in memory only,- t2 B7 o& K6 J7 ~
until you decide to write them. After that, of course, the previous
8 k; q3 o' O& K$ i! l content won't be recoverable.6 f9 L; x" _7 f0 |$ F3 X- @ J
The number of cylinders for this disk is set to 8322.) B9 t( c4 k) r( p
There is nothing wrong with that, but this is larger than 1024,
% Q K5 n9 C* X5 u and could in certain setups cause problems with:
2 k! t" d# o- |- @; { 1) software that runs at boot time (e.g., old versions of LILO)' ?3 h- F2 F4 W9 R+ T+ k+ Z
2) booting and partitioning software from other OSs
2 h- d0 W/ m" |" U s$ r (e.g., DOS FDISK, OS/2 FDISK), v: q7 X$ l7 `- g/ R7 y
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
' D! H/ ^9 m0 o7 ? Command (m for help): p; C: @" i+ z4 P. f" n) W. D' a
Disk /dev/hda: 4294 MB, 4294967296 bytes
) ]( q O- d3 l 16 heads, 63 sectors/track, 8322 cylinders5 ^# Q! P8 I2 o; y6 z
Units = cylinders of 1008 * 512 = 516096 bytes
7 ]' m! {/ `9 E/ a* `& r Device Boot Start End Blocks Id System
6 M: ~5 n. O" x+ W0 w Command (m for help): m
* y* W; H0 Q5 \! o4 F Command action
[+ O" \0 }; S+ P0 g2 r a toggle a bootable flag
$ {* q L$ V9 j/ `! N8 n b edit bsd disklabel
1 Y" b# E, w6 K" m% a c toggle the dos compatibility flag
4 C6 I, l- Y6 y2 W4 V5 y d delete a partition5 ~2 s8 K3 ^. e3 F8 h
l list known partition types
: i6 K9 t& L# B: i2 {! P m print this menu5 Z7 g, G; a4 G) f" Q, P" y
n add a new partition
8 x5 N/ u0 c' o; P) g+ p0 S o create a new empty DOS partition table( N/ e" F* E" Q5 F% h
p print the partition table
+ N2 O% M3 g3 |1 M q quit without saving changes
! ]% E7 M8 B) [4 u* J" t, b8 c s create a new empty Sun disklabel' c" y p+ k' b
t change a partition's system id% z4 @ O- {1 K5 G) d
u change display/entry units
3 U& O* u6 H% n: @! B- \ v verify the partition table
$ y2 U: r. y0 a# E8 m6 Q+ \ w write table to disk and exit3 ?* H& z/ }5 L' | ~# {
x extra functionality (experts only). e+ [" a, |6 T! i
Command (m for help): n+ |% t& t, w! T8 |& [$ H K
Command action+ m4 L1 n9 _4 \. {4 \8 i
e extended
& K& B- v! M: u* R: |, ]- J p primary partition (1-4)
: p7 z( d. ] `! K+ [2 C p C- ~7 b- y9 q$ K& C& r3 f
Partition number (1-4): 12 F: F6 _- p$ L: [# ?( B
First cylinder (1-8322, default 1): / m7 y! v8 `9 y2 ~7 k' g3 i
Using default value 1
5 ]. }2 z. |3 Y! f Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
- ^, r( U7 I1 y5 v Command (m for help): p* b+ z* u% t. E5 H& {2 a. m& ^
Disk /dev/hda: 4294 MB, 4294967296 bytes& g) L( r% d$ E7 h: @ c1 g
16 heads, 63 sectors/track, 8322 cylinders
8 b" m; C, M( ]: ` F) K7 r1 w X Units = cylinders of 1008 * 512 = 516096 bytes$ N, k4 I) D- c' K4 Z
Device Boot Start End Blocks Id System4 p. C- L4 }) D
/dev/hda1 1 1000 503968+ 83 Linux o! A. g" A$ Y% s. q" D0 ?( ?$ k
Command (m for help): w
$ {9 @0 C0 s8 J; [7 J" D The partition table has been altered!
% t( x7 \" W# ?( q Calling ioctl() to re-read partition table.
\9 M$ W b: v6 N0 C7 t- y Syncing disks.6 b* {0 H( S/ [2 X
//格式化新分区
' R+ z9 l) t ]& b: l1 w+ H8 omke2fs 1.32 (09-Nov-2002)
3 ~- I$ x5 I# e/ z8 `4 z* I Filesystem label=* i9 Y1 E9 Q) ]: Y3 M
OS type: Linux1 X Z+ O9 Y% X; Q( z2 |6 L! n
Block size=1024 (log=0)5 x4 i2 r9 @* `: o6 e" O" r: \8 g* h
Fragment size=1024 (log=0)
9 g) Q$ m# y# O6 g6 D9 M3 P1 t 126480 inodes, 503968 blocks
) c2 b) L$ n5 T 25198 blocks (5.00%) reserved for the super user9 |7 X' ^5 L9 U9 S# ^# q2 Z, f" f
First data block=13 [# D2 u8 z; o( G; y
62 block groups
; s5 {$ M# j e% ` 8192 blocks per group, 8192 fragments per group. P& l- c: N. ]6 x8 \$ @
2040 inodes per group
) }: q9 O# _2 } Superblock backups stored on blocks: * f) a, n7 l& s/ R. R) _
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409* x( O G- [1 n- t/ j& ~* C
Writing inode tables: done
* s% X9 i1 C5 G( C+ A Creating journal (8192 blocks): done+ U, l2 d+ ~. @' t+ C) U: M- D
Writing superblocks and filesystem accounting information: done
, Z/ W& f$ |6 l. g# e I This filesystem will be automatically checked every 30 mounts or
& r1 _* n" C" I7 f4 V 180 days, whichever comes first. Use tune2fs -c or -i to override.
& a6 ~& d9 @% @& m文件系统 1K-块 已用 可用 已用% 挂载点* h1 D: X( u0 T
/dev/sda3 3723848 705992 2828692 20% /
9 S1 E) f2 x! } /dev/sda1 101089 9274 86596 10% /boot
0 [9 G) }8 r$ H3 l% q& d0 O% o: z none 14520 0 14520 0% /dev/shm
+ W# z; g* H* n1 B //挂上新分区
8 u5 t/ d6 ~! h/ F% I0 {5 c) n- mount /dev/hda1 /home( O, f0 J. _9 |+ |/ }
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 _. i( c# Q$ N
/dev/sda3 3723848 705992 2828692 20% /
) [6 A" `$ S; g( j' t, f /dev/sda1 101089 9274 86596 10% /boot* D- c: u8 d1 F- G" f4 A7 g
none 14520 0 14520 0% /dev/shm
/ u: x3 ?6 {) v; i' S }6 b3 @ /dev/hda1 488006 8239 454569 2% /home8 L1 U" L) p, O- C3 H
1 a# l P7 r7 M' _7 H3 M; ?& Y7 R自动挂载:
% U. I+ ?7 l1 a1 _- vi /etc/fstab
; }6 o& J9 q6 t' a3 x" m1 C - : |7 w- ?8 q1 t# d( K0 J9 h( ^
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
* b5 _9 h; ?4 T! [: f
7 j2 h; d: ^0 l- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:6 z. l, u; X2 L, j
- mount /dev/sdb5 /mnt/ljp1 V( s ~( M, A# Y
- 1 S( q& z: ]. K4 \! W
- mount /dev/sdb6 /mnt/ljp2
复制代码
6 S$ @6 q0 q- N! `; k* T5 @5 u `) c/ e' m4 t5 b0 v0 q
b& k! f) v. o k! g! ?0 W& d |
|