|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)# ^; b( D9 B- L& g
or: fdisk /dev/sdc (for the third SCSI disk)1 Z. o! F6 n* l7 \+ }7 t
or: fdisk /dev/eda (for the first PS/2 ESDI drive)) L7 H! G0 ~+ D+ ^7 B
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
$ g, N7 z2 m) w1 E7 ^9 n: f ...8 c; E9 V2 n- z, l; t5 W, z
- df -k. m! C! m3 h4 J' z6 @; A5 \7 [
- df -lh& n) a$ @+ q7 A9 h; K9 N) _
- 查看有几块硬盘:fdisk -l
( ` J+ U% A) M, ]+ {- Y% @% y4 D
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点7 T! |7 W5 ^, g& @# e
/dev/sda3 3723848 705968 2828716 20% /9 T" A- ?( W& h( {4 V! z) J
/dev/sda1 101089 9274 86596 10% /boot% d' m8 L- ?2 p6 h1 T
none 14520 0 14520 0% /dev/shm1 V/ f3 D1 p4 d
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
2 e4 v" r2 V5 A3 PDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel S# w3 T7 ^) M5 C/ E' l- l
Building a new DOS disklabel. Changes will remain in memory only,( V0 F* X3 [8 u. N5 W( e7 B
until you decide to write them. After that, of course, the previous
$ s- r& w4 P! Z$ }$ t' v content won't be recoverable.
2 I! T, S3 C# [7 ~- Q) C The number of cylinders for this disk is set to 8322.
* [9 b& R2 C$ O% ]0 T There is nothing wrong with that, but this is larger than 1024,, i5 G$ F, k1 a( s7 w, A
and could in certain setups cause problems with:) J# A0 x( E3 E+ F+ J
1) software that runs at boot time (e.g., old versions of LILO)
1 l2 |4 X- l2 ~/ p 2) booting and partitioning software from other OSs4 C# L# X! u3 k
(e.g., DOS FDISK, OS/2 FDISK)
: g- e- m' J2 _3 i+ U Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)4 }. L% U0 u) [8 i( _" Q0 |" D
Command (m for help): p: n' L K# t, d# s; _
Disk /dev/hda: 4294 MB, 4294967296 bytes+ @0 a: G3 ~* J2 t& j- n
16 heads, 63 sectors/track, 8322 cylinders
1 d9 N, L- A$ b0 D8 y5 r0 | Units = cylinders of 1008 * 512 = 516096 bytes
) V, y+ u1 l1 A# E6 ]4 _ Device Boot Start End Blocks Id System/ c7 }+ d% \- n
Command (m for help): m: G4 D1 \1 e7 g# {+ a
Command action8 o0 D/ a$ ]! y! W. p
a toggle a bootable flag5 T! G9 y$ w! ]8 ?, p" C" P
b edit bsd disklabel
5 `8 @% ^( s) g: J' M c toggle the dos compatibility flag
2 H6 x7 Z2 H; {0 e d delete a partition8 Y4 E9 X6 O! ?$ u, u3 f% p+ q! u
l list known partition types
0 [- ^0 b. v, q# } m print this menu* [) y& s( y4 L7 e8 i
n add a new partition* V+ @- K% C& {! j8 T9 B
o create a new empty DOS partition table
# I- M: a7 U1 L p print the partition table) N4 u$ h6 g, {8 X& E
q quit without saving changes) ?5 K* |. U+ ]
s create a new empty Sun disklabel4 d1 U8 R# \ d3 d4 B, V+ ?/ W
t change a partition's system id
7 ?. |$ A$ X9 x u change display/entry units
. L- n2 @! C l! F v verify the partition table
: y, d% G+ D2 H& l3 \, H% n w write table to disk and exit
& X$ A; A3 D' M: R* ` x extra functionality (experts only)
3 J6 k4 ?( b" a |8 Q Command (m for help): n
8 ^( ]/ o3 e) ^) ^* K Command action5 [- O2 P" M1 |. R- m
e extended2 t& I% i4 W0 P7 l! p3 f$ o G$ ?
p primary partition (1-4): D5 A+ r1 L! M# z" ?! Q+ H
p! G9 V- s$ N3 j1 b T3 J
Partition number (1-4): 1. b" l, V% `+ z
First cylinder (1-8322, default 1):
, `- Q5 k& d1 F Using default value 11 t6 n& c8 R/ L0 @* ?! n& b
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
0 {) {5 A/ I& m; U3 h# r Command (m for help): p& X( O2 z! f* P" v. x- Y
Disk /dev/hda: 4294 MB, 4294967296 bytes3 w" q. o& E! [+ t* ?' Z' k9 R
16 heads, 63 sectors/track, 8322 cylinders
/ v U$ c9 O, o; I1 N8 T Units = cylinders of 1008 * 512 = 516096 bytes5 @: Q# i Q& X* X; N6 E
Device Boot Start End Blocks Id System# x+ w' M- ~8 O+ X$ b
/dev/hda1 1 1000 503968+ 83 Linux; Z# x' e! `9 \' P I
Command (m for help): w F, c$ P- ]4 g( e
The partition table has been altered!4 ~, n+ `0 X2 s+ l5 p
Calling ioctl() to re-read partition table.
& M- g9 i* x; r7 R+ [ Syncing disks.
! r0 k4 j4 e: L9 `1 q5 h" C //格式化新分区0 k: Y( O( l q! X, Q# K7 p' z
mke2fs 1.32 (09-Nov-2002)* x/ K# @# g f1 W, t' W1 F
Filesystem label=. _" Q9 M1 W+ A
OS type: Linux
$ {2 U: M' S/ |& k+ q+ r. R$ F Block size=1024 (log=0)
+ z6 s8 c7 G/ X Fragment size=1024 (log=0)5 \) m2 z. _: l% c
126480 inodes, 503968 blocks6 W. }! c- ?8 k5 _
25198 blocks (5.00%) reserved for the super user. {3 M L1 a' s/ q C
First data block=1" N; }7 A$ }2 o1 n
62 block groups
" Q. I6 T0 J& k' P 8192 blocks per group, 8192 fragments per group
}8 R, V+ P5 u1 I+ {" }: `- o 2040 inodes per group0 _ V6 i& z& n k. w2 g3 v
Superblock backups stored on blocks:
# H6 v8 T3 G. G2 b7 w. A 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409- Y f& F- Y" R4 g/ v
Writing inode tables: done
% M' e1 A- I/ U: ?9 D Creating journal (8192 blocks): done
8 r l! E' Y9 J" v! X Writing superblocks and filesystem accounting information: done- \0 b% |" n6 K3 R1 b7 M5 A
This filesystem will be automatically checked every 30 mounts or; z/ X8 S+ v+ B1 h" x3 r9 H+ H
180 days, whichever comes first. Use tune2fs -c or -i to override.
4 O) G! Q+ m& `! b文件系统 1K-块 已用 可用 已用% 挂载点
0 W ^% R3 o, l4 f; \/ V5 Q) [ /dev/sda3 3723848 705992 2828692 20% /
3 N5 i, h8 |4 q! D! B! F /dev/sda1 101089 9274 86596 10% /boot0 n+ l* G8 j6 v7 M, ]! k
none 14520 0 14520 0% /dev/shm
# Z8 v; x' H. d6 J //挂上新分区" L" [3 ?# Z, e& {
- mount /dev/hda1 /home
1 C: {( r# s1 Y) ~4 Q+ Z - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点6 J$ {8 h& ?4 M/ U6 a
/dev/sda3 3723848 705992 2828692 20% /, H0 L' R, y! ]( \) S
/dev/sda1 101089 9274 86596 10% /boot8 l! p) p+ h2 h# E& W
none 14520 0 14520 0% /dev/shm
/ Y" y4 ~! R6 m4 M* `% Z) W4 Z /dev/hda1 488006 8239 454569 2% /home
$ @& ^+ ^: R$ R, j8 n* |3 H
* X" X7 z/ A* z& W+ @/ R& E自动挂载: X' U' n, z4 ~$ x) ?7 B
- vi /etc/fstab
1 z! t$ d: e" W) c/ D3 e, v - 4 z/ W5 }5 g. ^( C9 _, H7 b( @
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0# y1 }6 ?' t4 m9 |
- + u. N& [0 C+ W; X0 }
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:1 H. a" g( b. @, C6 I* S
- mount /dev/sdb5 /mnt/ljp1
2 M) _4 p5 P% p) A" c
: E5 X0 W5 K2 t0 U$ V- mount /dev/sdb6 /mnt/ljp2
复制代码 $ o1 B& \/ s) q0 @9 C: C! k
9 o1 ?9 x1 l# i' N7 o6 @7 Q, P
( t* }7 @: Y6 p
|
|