|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk). O v2 [' h$ a( E1 M/ V4 ?
or: fdisk /dev/sdc (for the third SCSI disk). u: V0 g b( L$ M- X B
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
5 E, K% e- B1 h5 q3 _' j or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
; _$ }, i9 r% B5 p" V ...' \ o ]9 W9 v
- df -k8 n' q# x% | \* w; U6 `; ?1 Y
- df -lh
( `, Q! o8 r6 _* Y - 查看有几块硬盘:fdisk -l
( Y( b8 ?6 q+ @6 F! M
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点( K( {. E! ?" j/ E8 p
/dev/sda3 3723848 705968 2828716 20% /% x& W0 w) p- Y$ W
/dev/sda1 101089 9274 86596 10% /boot
7 ~0 ^% Y4 E3 N none 14520 0 14520 0% /dev/shm! j) P6 _9 m2 T; t5 x3 D, I, ?
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用! Y" Z' q3 v' p* Z7 E# U# V
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
6 C- W- H: \$ K% X' D Building a new DOS disklabel. Changes will remain in memory only,
. k6 J. x# x. U+ f until you decide to write them. After that, of course, the previous
! V1 O& a) p) C6 c4 F& u$ z* M) } content won't be recoverable.0 [4 v- P0 x; N2 Q
The number of cylinders for this disk is set to 8322.1 }4 M) B8 t3 o% l( e/ n
There is nothing wrong with that, but this is larger than 1024,
' R% N/ G, n8 H% g and could in certain setups cause problems with:
. P7 Y8 z3 k& Q3 G 1) software that runs at boot time (e.g., old versions of LILO)6 q7 Z) {: r2 k
2) booting and partitioning software from other OSs
# ^ _9 ?5 e7 u7 B# E (e.g., DOS FDISK, OS/2 FDISK)7 J! P6 o1 r' N! n) u, Q4 W7 s
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)0 d6 N9 B$ n! A/ g% h3 ^& L' v
Command (m for help): p- z9 u9 o( |' f/ ^
Disk /dev/hda: 4294 MB, 4294967296 bytes6 C0 I& K3 @7 A1 E* ^
16 heads, 63 sectors/track, 8322 cylinders
: W6 O5 K" d" g2 e6 a$ T Units = cylinders of 1008 * 512 = 516096 bytes
8 j# k, |/ `0 b( Z h Device Boot Start End Blocks Id System' N( `+ |/ o n
Command (m for help): m
$ A2 ] W- G; c Command action
4 j* G6 ?' D* z9 u0 b% T a toggle a bootable flag
: G" X3 t; E$ L/ ]; f# C0 p! u b edit bsd disklabel# V e8 o) J" \5 X- V- G* f
c toggle the dos compatibility flag
/ O/ u' p7 B5 _ d delete a partition
7 \1 }- S9 I; k% E2 p. \6 \6 | l list known partition types$ v/ z! Z. N, Y; k, n$ |" D
m print this menu: ?6 C3 m2 z& A( H$ q5 N8 }
n add a new partition
2 V4 }) s- z J, p o create a new empty DOS partition table8 \& U4 N& ^ j$ S4 l
p print the partition table
& J+ o6 p( E4 C' `9 L3 c. ` q quit without saving changes9 M4 I4 _2 Q- Z
s create a new empty Sun disklabel1 B: L; j3 g" e
t change a partition's system id
& b2 e3 P- h3 r u change display/entry units
% X) Z4 S! S; W0 c v verify the partition table
4 [" t6 M) o( c' H) h w write table to disk and exit
3 d1 l/ l Q" t x extra functionality (experts only) B& p3 S* U3 g, c! o% @
Command (m for help): n
+ ]3 L% ^9 C% n8 ^$ W2 B3 N& d7 D Command action) i2 @9 x: b1 t
e extended
0 e5 |2 U% T! y- `: z6 g- p3 f p primary partition (1-4)5 A% Z; O! M- c) f# g4 o
p! X x* V% u) w
Partition number (1-4): 1
, f; a3 W. R/ p b; Z First cylinder (1-8322, default 1): ' U' ~2 N O# O3 ]
Using default value 1
! v- w* r2 L- @: ~) O3 X+ W( o# w Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
5 o& D- o G4 R Command (m for help): p
0 r- p2 m6 {+ A0 R Disk /dev/hda: 4294 MB, 4294967296 bytes& _# z' c5 Y S( S/ K3 V
16 heads, 63 sectors/track, 8322 cylinders; d. x# V: O7 r5 G( x
Units = cylinders of 1008 * 512 = 516096 bytes% a+ S2 H# M" j ]( Z% j
Device Boot Start End Blocks Id System% Q1 m9 r5 c' H# K4 O* S6 J
/dev/hda1 1 1000 503968+ 83 Linux
8 `) N A4 {9 ^5 e8 v0 R4 k Command (m for help): w2 c+ C( a& A, w2 b
The partition table has been altered!
& M, T6 s8 N. w; L Calling ioctl() to re-read partition table.
, t7 X* r& ~' f% \ Syncing disks.' p( Y; I- m' j* V% U1 k
//格式化新分区
# s% X9 H2 {- b# Vmke2fs 1.32 (09-Nov-2002)
5 n) k. f0 v: P$ X8 S1 [ Filesystem label=5 B9 a0 b0 N4 |6 E% h [
OS type: Linux
: G; y& O) e6 D6 ~& U" [& @2 T Block size=1024 (log=0)$ L# k9 T1 [; |; C5 M
Fragment size=1024 (log=0)$ U& \; {' Z3 U2 e, G3 S# [
126480 inodes, 503968 blocks
* q( c% ?* p, ]( x7 J 25198 blocks (5.00%) reserved for the super user3 b: Z* r" U0 L) r2 i
First data block=1
' z* }. M: A6 E( v, v: L* t 62 block groups
W3 `& A7 C& g 8192 blocks per group, 8192 fragments per group" h N' ^* ]" J
2040 inodes per group
) z: Z3 @7 a$ t* R+ }1 x' {/ f- G Superblock backups stored on blocks: " }, [ ]7 A( J7 W0 g
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 ?: R9 [ M: f+ n
Writing inode tables: done 9 Q' z) H! [- |6 u. @2 i
Creating journal (8192 blocks): done* l& a, i* b7 P; C" l% v
Writing superblocks and filesystem accounting information: done
$ l" ]% f) f+ l3 S/ ^( c( K- j. H, Q This filesystem will be automatically checked every 30 mounts or
: v2 f, \% I3 I3 P" x* C$ Z, U 180 days, whichever comes first. Use tune2fs -c or -i to override.6 T# ~( I2 [1 q3 ?0 s1 |- A
文件系统 1K-块 已用 可用 已用% 挂载点
1 W( r# ~3 V; ?* v- C M /dev/sda3 3723848 705992 2828692 20% /
, T$ H2 s# y1 f" a4 q- G /dev/sda1 101089 9274 86596 10% /boot& f n! p3 M. o2 R/ y: v% f$ r
none 14520 0 14520 0% /dev/shm: |$ m1 p/ t! V5 j( H
//挂上新分区
4 @/ B. N4 {* J+ H) N& l- mount /dev/hda1 /home" Y# V# o- F7 I. V4 g
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
% E- P# S; g; [& |4 N /dev/sda3 3723848 705992 2828692 20% /0 F' X: Y4 a# E/ R
/dev/sda1 101089 9274 86596 10% /boot
3 Y! e$ K% t) L: N+ X3 y4 f none 14520 0 14520 0% /dev/shm) a. z( {! \8 q# l$ a0 E3 o
/dev/hda1 488006 8239 454569 2% /home, L2 K- l* o% k- t7 @
2 U, @' r- `0 D自动挂载:5 Y: E; ^+ m6 P
- vi /etc/fstab
9 p, K8 `& u; P {! P' o - d* F6 y8 V) ^: d- \% j
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
7 G. C6 Q% q4 o+ \" B - 8 B( M6 Q9 }- c; Q0 P
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:: J, |1 N6 d/ c0 q
- mount /dev/sdb5 /mnt/ljp16 f9 o$ f, D' v, x4 c( J" B/ x
- l* J& K, p# n3 Y, a
- mount /dev/sdb6 /mnt/ljp2
复制代码 ' [! Y/ x" L$ w; p: y
; ]0 K# A5 M' z8 D& _
+ S. L& Y$ _2 U' G! X2 o, K) \
|
|