|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)8 f. ^: Q5 c, p* z" m I
or: fdisk /dev/sdc (for the third SCSI disk)
, O3 e J0 `; e- O7 m5 a or: fdisk /dev/eda (for the first PS/2 ESDI drive); L( W c0 q( `
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)9 u. z* Z! M/ G1 u$ G- [2 z
...
; b6 ~1 r2 ~" n* X) S( l- df -k3 z2 W9 q! h! L$ E/ O( }# u" |; Z
- df -lh( p: b1 M. N" Q/ i7 p9 Z- q' U' P
- 查看有几块硬盘:fdisk -l: |: ]& C* L/ X9 J
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
, m) F, B5 @1 j/ y' X /dev/sda3 3723848 705968 2828716 20% /5 @/ N' Y+ T* s; O5 a
/dev/sda1 101089 9274 86596 10% /boot
' R, E9 b3 g& Z+ H) u4 P none 14520 0 14520 0% /dev/shm, i4 M: R2 u( f9 {5 `: s; {; w1 F# Y
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
6 ]- `" m% K9 ?. @6 CDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel" j6 d6 H) o# ^' w
Building a new DOS disklabel. Changes will remain in memory only,$ `& T5 D3 c3 }" h
until you decide to write them. After that, of course, the previous4 a9 J% P3 t& \* u
content won't be recoverable.
* }1 v! W. B, |4 ?% Q( i5 d The number of cylinders for this disk is set to 8322.3 U" F1 I. @* { s4 u' H. V+ m9 @
There is nothing wrong with that, but this is larger than 1024,3 d5 B" q f7 u7 j; C( w% C
and could in certain setups cause problems with:
8 S, [0 t! r+ B2 t8 ` 1) software that runs at boot time (e.g., old versions of LILO) q3 ~9 N1 \7 n6 B N
2) booting and partitioning software from other OSs8 j7 d( n* b& ~! m% O
(e.g., DOS FDISK, OS/2 FDISK)
+ R( c' a7 _8 M4 ?$ G! E Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)# a. [* p. V+ S1 @
Command (m for help): p
; a+ f, u% R2 p$ z) L Disk /dev/hda: 4294 MB, 4294967296 bytes
5 t- q1 l3 n+ _$ G9 ^/ U 16 heads, 63 sectors/track, 8322 cylinders% U3 y1 |; f. M; T. r
Units = cylinders of 1008 * 512 = 516096 bytes% o- S. S+ B4 C" R5 M9 U
Device Boot Start End Blocks Id System
5 L* v8 [5 J) P- Z7 {" Z" Z Command (m for help): m1 u9 ]/ X2 n( F) n( h
Command action, d( A( V& v$ J6 D4 j, Q0 h
a toggle a bootable flag5 T4 \) a8 H. N
b edit bsd disklabel: n! m4 ?0 i9 T
c toggle the dos compatibility flag: s: d" K) r4 x
d delete a partition
8 R4 E& {% \; L5 `6 q' I/ u# E l list known partition types
# n. K4 r* K0 q m print this menu2 v3 v) p8 f* W- b, D
n add a new partition- q9 K1 {" S e" H5 H7 M, k2 f: F
o create a new empty DOS partition table& u2 l9 f: i& w1 \: ?1 ]$ f" C
p print the partition table( x; ]$ w- A. G4 w ? j. L! N% I6 z
q quit without saving changes' D' @) U0 Z# ]5 f1 [- `
s create a new empty Sun disklabel
G% {* I' i" V" l2 ^- v t change a partition's system id
" ]' w( Y) q" l2 W7 J/ @2 J u change display/entry units
O. ~, h% [* E/ k5 v% }' I! i v verify the partition table( Y& ^8 Z! e- t+ G* K5 R
w write table to disk and exit
( I2 P. U, O" A* J* P1 `+ v x extra functionality (experts only)$ \8 m$ M! L0 v6 S1 n2 n
Command (m for help): n$ k% F# P& p6 K3 j" u0 E
Command action! E7 B( k6 X5 b x5 ?. z
e extended5 w; L% |, K2 G# b
p primary partition (1-4)
( Z; x' ~( B! _. D p
# s/ ?: D% T9 d, m+ S! N Partition number (1-4): 1
' Q o! E, ^: o First cylinder (1-8322, default 1):
; U# ~3 z- F4 R- Q$ H& |3 y4 m Using default value 1
# ?4 |4 [# u; Z, \# K/ P8 n Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G: b) R! ~9 Q" a7 J8 L2 X: A5 z
Command (m for help): p
7 q: }3 i. W) A# ~3 m Disk /dev/hda: 4294 MB, 4294967296 bytes
6 W1 B# b, H- i* J 16 heads, 63 sectors/track, 8322 cylinders
. D7 j G2 @4 `( z, y Units = cylinders of 1008 * 512 = 516096 bytes1 U7 [7 g2 n) D% p2 ]
Device Boot Start End Blocks Id System" n/ w# H% ?: G+ S: `0 c* Z" @
/dev/hda1 1 1000 503968+ 83 Linux
2 O" v' u3 y8 p6 o: M6 } Command (m for help): w- b' u8 m( N+ x' f
The partition table has been altered!; ^! k7 n8 b9 E I5 U/ I- ]
Calling ioctl() to re-read partition table.
% Z% X2 R" l4 b* l h$ L5 } Syncing disks.% v m! H) K, Q5 s& v1 n
//格式化新分区( {1 }$ B8 t1 R( N" H# I2 r
mke2fs 1.32 (09-Nov-2002)- O. _2 l4 R5 \+ l: o+ |
Filesystem label=
' B) W% Z- T. h, x OS type: Linux
3 A2 F0 R7 [, l* F* M Block size=1024 (log=0)
+ ]9 T+ v- C; a, ? Fragment size=1024 (log=0)+ v8 j3 Q+ H% R F
126480 inodes, 503968 blocks
( ^+ c' J3 B6 {6 t, c& e6 | 25198 blocks (5.00%) reserved for the super user, `1 J: Q; A* u9 `" K* p. D" v
First data block=1) ~& G6 a% M8 _6 z* |; c
62 block groups9 j( i/ [( {4 \5 ~' ?
8192 blocks per group, 8192 fragments per group
x& j/ n" k+ q# }) P4 J 2040 inodes per group1 ?1 M" _0 A1 _
Superblock backups stored on blocks: ! y, e8 z7 ^9 s" Y* h1 ^+ e1 x2 R
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409% X, w3 X4 z" e8 a$ e
Writing inode tables: done . f4 e" W4 q7 I t4 P
Creating journal (8192 blocks): done; g& c5 Q/ V% s
Writing superblocks and filesystem accounting information: done6 @) Q, x5 E+ }3 T
This filesystem will be automatically checked every 30 mounts or
6 f" N& ]# x$ M8 G# ~2 C9 [2 R6 i 180 days, whichever comes first. Use tune2fs -c or -i to override.2 X! I# w1 v2 C O* i0 y- U
文件系统 1K-块 已用 可用 已用% 挂载点
- S( |, f3 C# ^: ?! b* { /dev/sda3 3723848 705992 2828692 20% /. m: V5 |. W8 G- q* O' }: k
/dev/sda1 101089 9274 86596 10% /boot
9 [- B# O% ]: ] E0 j5 O none 14520 0 14520 0% /dev/shm X5 o8 |6 o: k8 z- D: y# b" J0 i4 l# z
//挂上新分区# q! J7 p w- t0 @1 B
- mount /dev/hda1 /home
1 W5 P: Z5 f/ h4 L( R) s( n, d0 T: ? - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
3 D3 N4 k M# v3 y+ @ /dev/sda3 3723848 705992 2828692 20% /5 a* b4 m' f' j" X
/dev/sda1 101089 9274 86596 10% /boot
6 T/ [. g8 S, y0 z; [" r5 \ L7 \ none 14520 0 14520 0% /dev/shm4 J2 o: l0 i& o
/dev/hda1 488006 8239 454569 2% /home
4 q, o7 N1 u |$ Y
% k T" i. R+ Y1 _1 A; d自动挂载:% q P8 E5 u+ e G8 B/ `2 @
- vi /etc/fstab3 w, u# f, [. ~# l' V7 R
- / ?! \8 [! z* `0 c+ g3 \; _' R
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
4 m" G" a) x! n8 b' J
4 ^1 z5 b4 X) f& Z8 G- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:/ r: @, a7 E1 {4 H5 k9 w
- mount /dev/sdb5 /mnt/ljp1$ j, k' } m7 Y! S. P8 z) ]( p7 A0 [
- 2 f" _' s3 W2 E
- mount /dev/sdb6 /mnt/ljp2
复制代码
, A) `! u# L' h# s; l8 o) Y$ J1 x$ B
$ W! _; m/ G7 I8 l6 R
|
|