|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
; k7 T: q) ~( ?" L3 u or: fdisk /dev/sdc (for the third SCSI disk)7 w8 {. B' [5 Y% H7 _ | Y
or: fdisk /dev/eda (for the first PS/2 ESDI drive)- u; m! O7 I2 E! u5 I
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
" l! P2 j: l' i2 W: T0 V ...
" L. G! f. W9 T/ ^2 @- df -k
6 `; B& A+ {' K0 @6 { - df -lh/ N' P* ?) h" T7 f$ `8 [8 E! {
- 查看有几块硬盘:fdisk -l: Q* n# i0 M' a! c {; ?3 c( r* v
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点8 X K$ _" L# N& G6 D4 q
/dev/sda3 3723848 705968 2828716 20% /5 g+ R; q- P* Q6 E. c4 [. F% X
/dev/sda1 101089 9274 86596 10% /boot
: ~# X/ D, z! N: @0 T+ L none 14520 0 14520 0% /dev/shm" z- t$ }! C& q4 @+ Y% K
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用. Q9 ^3 y* X! H
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
2 x, j8 b4 |0 s) a( X. j Building a new DOS disklabel. Changes will remain in memory only,+ }5 R: j! M2 R1 R# z3 Q7 V
until you decide to write them. After that, of course, the previous
1 b7 q9 F/ o# O, o* U content won't be recoverable.2 Y9 q% ^- |; ^5 J" E+ T
The number of cylinders for this disk is set to 8322.
$ Q5 _# h/ @0 D# q% X5 r There is nothing wrong with that, but this is larger than 1024,
* z' `) A1 |' z( a, N$ [' p0 G! @7 v. I and could in certain setups cause problems with:
4 w; M! h9 H& n1 l 1) software that runs at boot time (e.g., old versions of LILO)5 ?2 |4 r! t% d3 v) y4 X5 l; B
2) booting and partitioning software from other OSs
7 R5 E0 f! [2 L: X4 \ (e.g., DOS FDISK, OS/2 FDISK)( J/ t o* E0 B5 F, {
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
' E5 I/ O* V. {2 A/ I2 T* @) ?! M- n Command (m for help): p% X% A! u6 [! l) O! a- V9 N: L
Disk /dev/hda: 4294 MB, 4294967296 bytes
9 K1 _; u6 ?7 w% D 16 heads, 63 sectors/track, 8322 cylinders' [. e0 {% m! w. e. G1 A, b1 K
Units = cylinders of 1008 * 512 = 516096 bytes) s$ r) F3 W) J+ h3 [
Device Boot Start End Blocks Id System4 N$ m3 j) ]! W S( B
Command (m for help): m
^, X0 i' ?( T3 G- f5 [6 g Command action, `7 R& k# x6 a9 a
a toggle a bootable flag
" K9 f+ h, g% x0 U0 Z( F b edit bsd disklabel
6 [+ ~8 G; a/ v Z* @ c toggle the dos compatibility flag& C+ i( B) w) j
d delete a partition
! V! u, c6 t8 ~* u1 M3 l. V% p l list known partition types
: u% S0 p- K0 q' S m print this menu: t! n1 e# G7 A) S
n add a new partition
4 B2 ^% R: a0 s8 u$ d o create a new empty DOS partition table
8 y( l# w9 d6 Y( u p print the partition table! _+ d: L1 n& v8 q5 A% j
q quit without saving changes( U/ y( j3 @5 j S$ y; g! C( Z
s create a new empty Sun disklabel$ [) d" ?4 `" a" o2 u3 q
t change a partition's system id
! \% E5 }5 I% n+ K5 c u change display/entry units
: e0 ~ l# D! w( Z/ q* i6 k& Q2 u v verify the partition table
. h( V: ?: b9 R6 } w write table to disk and exit
# p0 q! X; ~, d6 T; L; X \/ r8 p. k x extra functionality (experts only)
" K M. R0 y: K: e5 G8 \ Command (m for help): n7 l. B- ~& T7 Y' e- R
Command action
/ a6 Y2 [2 U; P- r [! P* J e extended" m0 _. `7 s/ Q3 u* v
p primary partition (1-4). Y3 \: H' Y) G" i+ ^. j# P
p
" M! @, X! H% s+ E4 X Partition number (1-4): 1
/ k2 U% L/ W2 P; W8 e8 m9 N' A First cylinder (1-8322, default 1):
$ `4 O7 n& [4 a- P) } |4 L Using default value 1
6 m, t6 F* T+ r, r1 I Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
3 c, d S8 w- G; t( r Command (m for help): p
% ~- P+ q2 [& p Disk /dev/hda: 4294 MB, 4294967296 bytes' ^5 z4 [' f9 y; N
16 heads, 63 sectors/track, 8322 cylinders h7 X ~( m; H' B k
Units = cylinders of 1008 * 512 = 516096 bytes
4 z& p' `, m# v3 r, E2 P Device Boot Start End Blocks Id System
: |8 v# N# F0 L& q$ F' X /dev/hda1 1 1000 503968+ 83 Linux1 ]/ f! F1 ?+ Y- p
Command (m for help): w+ P- A5 d. j- U; P7 ]
The partition table has been altered!: A! y6 L: t+ O. B% W9 B7 R
Calling ioctl() to re-read partition table.
* w- N" @3 S8 o Syncing disks.( q5 o9 x% g! o3 P
//格式化新分区% W3 f# P& H/ ^" B
mke2fs 1.32 (09-Nov-2002)
" A9 z) p1 u6 n7 l% \/ W Filesystem label=5 ^+ F( u) K- n( H4 S
OS type: Linux
: s4 ?. s4 I# F6 @+ y0 U Block size=1024 (log=0)5 w8 c) I; Y x# [
Fragment size=1024 (log=0)
$ I9 T7 j) }: B# }: T. p, I: c 126480 inodes, 503968 blocks9 F1 l/ @- R; S4 p5 q
25198 blocks (5.00%) reserved for the super user( m! t) ]9 k2 y
First data block=1
5 Z7 T5 i! |2 j% x. K! S: \ 62 block groups8 L" Y" L8 E4 ?! F- C
8192 blocks per group, 8192 fragments per group
8 r' O" i- E/ s6 i+ g9 F0 _8 s, g2 @ 2040 inodes per group
2 X$ i4 n u: _7 [; Y" R; |9 C Superblock backups stored on blocks: - {, R! q! Y' `$ @5 d; m! s
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
9 p @5 {( \$ i, X3 k* h Writing inode tables: done 5 C! B$ O t- u9 V8 R) e; t6 z5 \& k; i
Creating journal (8192 blocks): done' c! j; x' l9 I4 t
Writing superblocks and filesystem accounting information: done7 f) j m3 g6 e) T, v- c
This filesystem will be automatically checked every 30 mounts or
( ?; m7 T& s$ j. O7 B6 F 180 days, whichever comes first. Use tune2fs -c or -i to override.9 p* z* e/ m, B0 h
文件系统 1K-块 已用 可用 已用% 挂载点/ q* I) L$ m. V0 Q$ I# D( r
/dev/sda3 3723848 705992 2828692 20% /
( K. ?" y8 y& ?% F /dev/sda1 101089 9274 86596 10% /boot* Z& a" B) @- w8 j3 x+ y0 z+ V
none 14520 0 14520 0% /dev/shm
4 J' ]' {; Q7 G/ c0 n //挂上新分区
- _6 D( C9 V- q) v7 o9 _- mount /dev/hda1 /home- |' y4 p l! X5 Y5 s9 S
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 t1 Y3 e2 m! x8 @
/dev/sda3 3723848 705992 2828692 20% /
4 Y2 d- u# {0 L) V6 u; b7 R /dev/sda1 101089 9274 86596 10% /boot7 X" M9 D: a2 q1 t& c' T2 V9 g/ W. N
none 14520 0 14520 0% /dev/shm- L |$ e6 z( q n1 q, [9 s: d
/dev/hda1 488006 8239 454569 2% /home
: y, P, H* x) ~' l4 [1 U& b" X- [% }! r$ @
自动挂载:! z! @! ]1 w( u$ Y' J3 S
- vi /etc/fstab3 U4 Z! `9 R x' \/ c) D
- 9 N x, G# }8 P3 j0 L
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 05 g2 K" X6 Z- W/ p
/ p- j7 D1 j- r0 u- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:3 Z2 p9 I' M8 ?1 F, I
- mount /dev/sdb5 /mnt/ljp1
3 v& Y7 W8 w% E6 ~$ }' n+ l& e
& I. |, L; l ^- K( p( X$ ^. Q" L- mount /dev/sdb6 /mnt/ljp2
复制代码 / t1 ~' w- X; G. e j- ~: J
/ }) w5 M! P7 }2 a+ F* l4 s
* q( _+ e( V4 y2 H' x; N! ^
|
|