|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
8 f5 Y- k. _) v; G2 I1 J# t/ q or: fdisk /dev/sdc (for the third SCSI disk)
" [+ U; t% N+ }1 p' y' o or: fdisk /dev/eda (for the first PS/2 ESDI drive)
9 M* O% n4 w, H* r or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
$ ~1 U5 B$ S7 X& Z ...( z/ }1 m* P$ h. L+ r h
- df -k
m8 E3 P1 @, _ - df -lh
" m2 C4 D$ Z7 H, u, n - 查看有几块硬盘:fdisk -l* v; l* }2 Q, f# z p
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
1 B- u6 R# }$ m$ K0 \# W+ @ /dev/sda3 3723848 705968 2828716 20% /
# c+ `7 j- l$ A* q9 m( x; `8 | /dev/sda1 101089 9274 86596 10% /boot
% h, y+ K. o' i& |. j) B6 ~ none 14520 0 14520 0% /dev/shm
# T) [; w9 f8 N/ k 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
1 o2 G$ u- P- Z! r9 nDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel- q$ [3 Y5 H, ?3 ` c% Q. E' _3 F
Building a new DOS disklabel. Changes will remain in memory only,
3 y; `9 D" }* s1 C8 v/ m, R until you decide to write them. After that, of course, the previous
* n/ {# {& Y% @* c content won't be recoverable.
5 C- q, T7 ]" M/ q( J% h The number of cylinders for this disk is set to 8322.# u2 k* Y* ]6 r! L6 T3 S5 [
There is nothing wrong with that, but this is larger than 1024,/ e2 j0 ]# ?2 n+ E0 x1 L( O5 F
and could in certain setups cause problems with:
9 a+ d' g$ `6 a0 ^ {1 Q: Z 1) software that runs at boot time (e.g., old versions of LILO)& E O: d) k; H! Q0 L! E2 F
2) booting and partitioning software from other OSs
/ n4 P% W7 U& ]6 h7 E$ l. g; K (e.g., DOS FDISK, OS/2 FDISK)! |* C D( j4 S7 h$ r
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)! S. \0 O+ ^" Y* m
Command (m for help): p
" B) A- K$ k" N Disk /dev/hda: 4294 MB, 4294967296 bytes
( ]3 z9 r/ x6 G" q4 C 16 heads, 63 sectors/track, 8322 cylinders
& P5 \) t8 b5 y5 a0 C& ^; t/ S* f/ v) t Units = cylinders of 1008 * 512 = 516096 bytes$ V- Z# \: Y# @
Device Boot Start End Blocks Id System3 v* Z& x' e+ Q3 a9 j- z& {: R' F
Command (m for help): m
: x5 F2 _4 f/ p2 D; M" p! A$ `. _ Command action/ D% h, z9 d$ Z: r8 }
a toggle a bootable flag% Z w( I; h( {# d# l, ]
b edit bsd disklabel
1 i1 `. H5 _# E/ f8 T1 ?- E" x5 Q c toggle the dos compatibility flag; K0 }& V* p3 o# k Z
d delete a partition
I0 l+ z# s6 k l list known partition types
1 v, h; f& E5 ?( ^1 t( N. h& _ m print this menu
& Z# \ j. n& M) W; q9 u7 { n add a new partition3 @$ n: N p1 k/ U! I
o create a new empty DOS partition table
1 ?9 j3 s+ E& n1 Y7 r0 j p print the partition table
) k: K! Y/ Q) B! ?: Q. Z q quit without saving changes
$ ^; D* {" p. B I$ u s create a new empty Sun disklabel
) b. n- z9 C$ u9 p. @( r4 Q( i t change a partition's system id C+ Y2 Z5 m' ^7 Q/ }
u change display/entry units
1 ]! B e1 v* ` v verify the partition table, O7 G; _: w* v/ W8 y
w write table to disk and exit# c) ~) ?( u( z: V2 u' j0 l- M
x extra functionality (experts only)
" H7 k7 |. F0 P5 x) _2 u Command (m for help): n# q9 K- x! Q, k( `( r' @, S
Command action/ e( h. |' Y* w
e extended
4 w# M& O% w/ l2 s: {, V9 n p primary partition (1-4)
# v+ M T/ J3 E6 `8 f' @/ Y p
: U( Q* n* k! O% w Partition number (1-4): 16 y/ G& p2 _5 W3 U9 W6 z
First cylinder (1-8322, default 1): * T: F0 h6 c" z( Q5 J/ M
Using default value 1
$ }! j/ Q' E/ T# _6 L+ a! A Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
* ^) P5 P* X! J Command (m for help): p
$ A* h- p* e: F+ l4 P1 X* m2 ? Disk /dev/hda: 4294 MB, 4294967296 bytes# z( ^; L% b" g' e
16 heads, 63 sectors/track, 8322 cylinders2 _* v5 {1 i) f, R7 N4 k% l
Units = cylinders of 1008 * 512 = 516096 bytes4 }- U3 Z3 r& r% s) v1 {" ~# `( q
Device Boot Start End Blocks Id System
5 e4 Z ^) [+ t) D /dev/hda1 1 1000 503968+ 83 Linux. W8 V6 C k* i: p0 v
Command (m for help): w# @* [5 b2 C- D4 s' ~
The partition table has been altered!
2 A) |* Q% R, m- `, e2 s Calling ioctl() to re-read partition table.
' w5 U/ k% V7 o& J! a- k Syncing disks.
! S- z5 G9 Y5 U/ K //格式化新分区
" V" o+ W" F2 a& ymke2fs 1.32 (09-Nov-2002)7 T8 L2 S0 B( U* i6 N2 d0 W" t$ ~2 h, K
Filesystem label=
" L* S8 D/ v o) j" U OS type: Linux
3 E! ]2 ]+ m1 U. E F Block size=1024 (log=0)
3 ~6 R1 t1 A- k- }; [; a Fragment size=1024 (log=0)
' B# O( d8 d s% n) e5 c 126480 inodes, 503968 blocks
$ q3 u8 A, g I3 ?! m) P 25198 blocks (5.00%) reserved for the super user- P1 \/ t- U( i0 z
First data block=1, V2 E# F8 _, `
62 block groups
8 z3 i0 [) g F! S 8192 blocks per group, 8192 fragments per group3 \+ e; v2 J' t/ U
2040 inodes per group
9 W& M/ Z8 U- W% F3 ` Superblock backups stored on blocks: ) ]) ~# O2 Z. X* Y5 b
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014096 D& R% S/ N' P# l( z: y) `) D! c
Writing inode tables: done
) c3 [( t# z6 |2 P% n. g8 @5 M# \ Creating journal (8192 blocks): done
. |$ e! [- b, h2 X1 o; s5 |6 d Writing superblocks and filesystem accounting information: done
* \- e) K6 K" H; ^ ~1 g* p This filesystem will be automatically checked every 30 mounts or
3 ^, C) Y0 ~# r$ Z3 ` 180 days, whichever comes first. Use tune2fs -c or -i to override.
- `/ H: G5 e9 ^0 @( t文件系统 1K-块 已用 可用 已用% 挂载点 c5 y7 o# J& \# V9 Q/ c4 R
/dev/sda3 3723848 705992 2828692 20% /5 ]: U5 e$ g0 _, \$ F% U) Q0 I
/dev/sda1 101089 9274 86596 10% /boot7 W3 N' K% l: ?* u1 ]. N. v
none 14520 0 14520 0% /dev/shm
4 l2 J6 L% D* f" t //挂上新分区# r: C0 A3 V! E2 K) l7 _
- mount /dev/hda1 /home3 t; r# I4 Q0 l+ s' O5 |" a6 d
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
/ H9 I, {) p5 x5 F* | /dev/sda3 3723848 705992 2828692 20% /
9 v+ ]) p, w9 D. I- | /dev/sda1 101089 9274 86596 10% /boot
+ ^" P& e& f7 x/ }- j0 s+ n$ { none 14520 0 14520 0% /dev/shm
6 ?/ u- G2 _ ~% E! E /dev/hda1 488006 8239 454569 2% /home- \. S0 @' ?' Q+ ]! Q1 T9 n1 R: d& M
! j" M4 p/ F7 F( q/ k自动挂载:4 g \& ]2 P7 ]( |
- vi /etc/fstab; X5 l4 F3 \7 G1 ^6 q$ o; A; W
0 A+ Z3 r8 @: A; S; V. q8 |* }6 |" p- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
8 u7 [, H9 u- e& { - 0 d0 R8 |" k" @( g% b$ n1 m# p
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
2 a' \2 | X) m& g+ w- mount /dev/sdb5 /mnt/ljp12 o( h! q% L) e9 Z4 Q( z; v
, L* `& F) }- q# W- mount /dev/sdb6 /mnt/ljp2
复制代码 " h& Z9 D0 B/ f$ _& Z' j
4 t8 w$ G# V" G1 J {, w
7 F, _3 M% x) V% k E; R6 p |
|