|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)- j0 X" ?# G4 s1 m& p. R
or: fdisk /dev/sdc (for the third SCSI disk)8 P7 h, `# T- j% i+ M
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
* f: s3 x) W! v- x3 O2 | or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)! _& |2 J# U2 R: v
...( n4 x7 Y7 f) V! X7 _
- df -k3 K2 P2 y" v. {/ g* M# @. j
- df -lh6 A2 h* O8 y9 B W6 }8 F2 i! x* c
- 查看有几块硬盘:fdisk -l
& ] r/ ^2 m. c4 @) ]; U
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
4 c, S. w* |( {2 T$ N$ K /dev/sda3 3723848 705968 2828716 20% /
5 k( g# `# _9 k: @3 f) `: b /dev/sda1 101089 9274 86596 10% /boot5 x8 [ `% g: `& {' A
none 14520 0 14520 0% /dev/shm
+ r# N* h3 T% J/ x ]; |6 T 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
7 E" y, X6 m9 r4 y" | P+ dDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel) [2 l0 p7 ?7 g% Y& x$ M3 l
Building a new DOS disklabel. Changes will remain in memory only,& c& U4 |: i" }; t
until you decide to write them. After that, of course, the previous
5 x; o1 W& x; x ^( n* I content won't be recoverable.
( H; w5 b1 U( `% I/ P0 f, K: h The number of cylinders for this disk is set to 8322.
! X) j8 F: _7 M& B3 [! [ There is nothing wrong with that, but this is larger than 1024,$ x0 X/ T4 r' k- p
and could in certain setups cause problems with:
+ Z- H' [8 @7 O# W# [2 Y 1) software that runs at boot time (e.g., old versions of LILO)
) W9 H4 l7 G( ^. m- O y 2) booting and partitioning software from other OSs
2 q) h5 |3 K/ v& h0 s (e.g., DOS FDISK, OS/2 FDISK)
% t: G$ a# ]& }7 l! T% X Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) }( r. Q& ]. D* w5 k) C/ w
Command (m for help): p
5 _+ A* @% v) d! P* b7 x Disk /dev/hda: 4294 MB, 4294967296 bytes& E1 Z# o9 y" s7 v
16 heads, 63 sectors/track, 8322 cylinders, T4 S6 Y% C& I/ k* G5 r5 I& D
Units = cylinders of 1008 * 512 = 516096 bytes
) r. Z& r, {& k% a Device Boot Start End Blocks Id System
! v0 d# a1 Z& ~! T Command (m for help): m- m/ U; _4 K b5 h/ w6 k
Command action
! k4 A8 m; g' z) } a toggle a bootable flag; o! y: Z' ^8 f: P5 l* T: B
b edit bsd disklabel. d3 U9 S/ |3 @# Q) `. t
c toggle the dos compatibility flag$ g! j; ~1 f% d0 j
d delete a partition- x4 J1 Q) h/ O
l list known partition types
* }8 a' ~* d: T& T! X8 M m print this menu( ?8 @# S0 w0 s; J
n add a new partition8 T) G" Y X: o% g- U0 D) q
o create a new empty DOS partition table2 N$ X% m* N8 Y8 k: Y! ~
p print the partition table
% V- i2 A$ k2 H0 G. d7 K8 S/ ?4 ~ q quit without saving changes/ }7 d0 f( m& q- t; J$ `* |
s create a new empty Sun disklabel$ a( c$ l- y* f6 D! F
t change a partition's system id# E" w2 n$ k' j3 Q% d9 B
u change display/entry units
$ ]7 n+ J* A- r5 p. ~3 @# D: x" ` v verify the partition table
2 ^5 O3 w' [7 X/ `- v7 `7 R w write table to disk and exit
' |1 H; T, e/ F- C4 k$ I& U$ E x extra functionality (experts only)
/ G. J3 @2 w/ ?+ ~ v* C) s Command (m for help): n
$ b5 [: V6 ^* ^4 W, `9 h+ E: @& h) O Command action6 }( m* r$ m* P& F( J; c/ r+ n
e extended
$ K% w* d1 r0 x) R6 q; T p primary partition (1-4)- j$ `) ?! G* W( h5 [3 ]$ Z% L
p
) [( F6 W+ i- P% } Partition number (1-4): 16 E. e6 o7 r$ f/ r! ~" J8 \; F
First cylinder (1-8322, default 1): ) A- }7 r# g3 Z6 z/ S! a
Using default value 1
# U/ M) t, K/ E Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
+ M o5 J% X. Y0 ]- M1 a Command (m for help): p
, R: e3 ] M6 r' j8 l3 K7 \ Disk /dev/hda: 4294 MB, 4294967296 bytes
% w; ~' Z' ^8 ?, P T0 W; \ 16 heads, 63 sectors/track, 8322 cylinders) s5 D6 x2 N% K% Q C
Units = cylinders of 1008 * 512 = 516096 bytes
* Q( d5 q4 R6 X+ g& k Device Boot Start End Blocks Id System
- q: p7 ~4 X, F% t, s. }: F+ p /dev/hda1 1 1000 503968+ 83 Linux* l3 _2 K: W5 h
Command (m for help): w( B2 z- r# S. A6 W, L
The partition table has been altered!! Q1 a4 c" y6 `$ L' e; a) o! F9 G
Calling ioctl() to re-read partition table.. g: k: u- F; y! r2 n5 l* e: G
Syncing disks.+ D& u1 T6 k! A* n5 v/ N
//格式化新分区' G8 [, b* {$ `" C
mke2fs 1.32 (09-Nov-2002)
( {" i4 W2 R* g+ t Filesystem label=; `4 _/ b* Z9 x, b) [6 N$ R9 q1 @
OS type: Linux2 f+ R6 o+ f R3 L
Block size=1024 (log=0)5 _: z" y% s$ }- d! E5 n
Fragment size=1024 (log=0)
7 V8 I, k& e: ^; F+ t! ^6 H 126480 inodes, 503968 blocks
+ U2 T/ C# O" [0 ]% o/ [ 25198 blocks (5.00%) reserved for the super user
2 A* p% H) Z0 W; E' T, P First data block=1
, P% ^8 }2 ?+ M3 ]* W8 n1 f 62 block groups* i2 v, h, G+ d) o7 d4 V
8192 blocks per group, 8192 fragments per group) @; ?/ }& W" V% P$ |9 W1 w/ d8 j
2040 inodes per group1 ?! ]+ d( L7 f/ K9 m L
Superblock backups stored on blocks: 3 a7 ^4 h) K2 ?- V' g
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
+ p* H$ b* j v" H6 b9 B Writing inode tables: done ) W1 d' X* S4 p# T, }- }* p* h- Z
Creating journal (8192 blocks): done7 h n! M4 _5 q/ P
Writing superblocks and filesystem accounting information: done& i! l' s2 |0 M" X. F3 e9 d
This filesystem will be automatically checked every 30 mounts or
2 F. p% J- B2 m9 A0 l$ R# K3 O7 G7 D 180 days, whichever comes first. Use tune2fs -c or -i to override.% E' ], X7 K* s0 O
文件系统 1K-块 已用 可用 已用% 挂载点5 n! V6 H/ w* X8 e- B+ C/ E& b
/dev/sda3 3723848 705992 2828692 20% /- L; E( v4 a d
/dev/sda1 101089 9274 86596 10% /boot
$ O8 [# `" ^* ^# k* B3 L& A none 14520 0 14520 0% /dev/shm
8 Q. u, z3 _+ H. @2 m" D //挂上新分区
2 [8 {" [2 K1 M' U( A- f- mount /dev/hda1 /home
6 u. f( L2 f8 {* {5 O* t - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
9 \7 \" I- A4 L$ u /dev/sda3 3723848 705992 2828692 20% /* H4 g6 j8 U1 k( M3 K
/dev/sda1 101089 9274 86596 10% /boot) \9 J* t9 v7 A
none 14520 0 14520 0% /dev/shm" L% F/ d w9 t p2 V3 l
/dev/hda1 488006 8239 454569 2% /home
& ]; s% ?6 I1 {% a9 u1 ~5 Z5 E* V' S" \1 P8 M
自动挂载:
2 |7 ]- Q7 l& [2 M8 d! R r7 a) f- vi /etc/fstab
% }* l; W8 A9 B. x- X- c1 E
6 i' |0 a) A- r- v$ ?' f% ?- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 08 d7 b6 E/ ~9 w" ]- \% o2 q7 K
8 `1 x) @7 [8 [; S- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:% N3 v8 Q: q& p% i) Z
- mount /dev/sdb5 /mnt/ljp1- f3 o6 [# F6 ]% p' \. |
' @2 w; n7 a8 K& Y2 R- [8 c$ V8 X- mount /dev/sdb6 /mnt/ljp2
复制代码
5 ?$ x4 W% i8 U7 A$ S; u
$ u8 T/ g" t, e+ e @& a- w7 y, \3 f. }, ], U, ~9 z* n
|
|