|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
2 x" A$ r, ^8 {/ D8 W6 T8 _) P or: fdisk /dev/sdc (for the third SCSI disk)' o8 d1 l% z$ r' l
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
' G3 Q3 v. t% q1 [2 b( T' b or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
6 J- l$ S' J. j( J7 X4 t1 [) e ...
3 S# ]2 ~/ F; X$ d; B. o5 H. S- df -k
. M+ y9 [; B9 B5 M* r - df -lh
/ O6 {9 r; X0 A - 查看有几块硬盘:fdisk -l/ k# q- h3 N: A( p8 R
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点/ b3 H8 l2 j- e0 ]. _3 ]
/dev/sda3 3723848 705968 2828716 20% /2 q8 o( t3 J) K+ ]( P' J; U0 r
/dev/sda1 101089 9274 86596 10% /boot
9 T; y7 D% I$ _. N- E$ K none 14520 0 14520 0% /dev/shm
* ^3 F* U0 E) w" \: x" G 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
7 c' M5 n: C- ]Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel2 X/ `' G( w* J4 I, S: s; i
Building a new DOS disklabel. Changes will remain in memory only,
1 V+ b+ N: O3 f& \1 u6 | until you decide to write them. After that, of course, the previous
1 U" D0 A- o1 E3 R T content won't be recoverable.
; p6 m- Y( o' C% @' \# m) R The number of cylinders for this disk is set to 8322.
( ]- S0 |, g! X$ H* o There is nothing wrong with that, but this is larger than 1024,0 @( I& V* B# }5 x& L/ {
and could in certain setups cause problems with:
, \0 v9 p; ^! e; W4 m g7 u) f& M 1) software that runs at boot time (e.g., old versions of LILO)- z' ^& Q/ Y) j2 t" x
2) booting and partitioning software from other OSs/ E4 Q5 ]4 Q9 h% M2 ]0 P. c2 a
(e.g., DOS FDISK, OS/2 FDISK) m. I# M+ s M f W" }7 K
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
, q! @/ i6 p! S8 Q+ u Command (m for help): p# E% \8 h1 _8 e9 _- I( c
Disk /dev/hda: 4294 MB, 4294967296 bytes& I S0 f d* _2 T2 q
16 heads, 63 sectors/track, 8322 cylinders& t. t: z! v8 N7 [; d. B
Units = cylinders of 1008 * 512 = 516096 bytes
$ a" o e9 s+ i0 n4 } Device Boot Start End Blocks Id System
$ Q2 M! N& ^/ ~; x9 |6 _; p' Z Command (m for help): m2 e- a. c) L1 h7 {" j" y2 J
Command action+ V/ k. Y9 I/ \& u" c4 s1 d: @
a toggle a bootable flag# i5 c6 {5 D% s
b edit bsd disklabel) X3 G1 I% R; S4 B& q
c toggle the dos compatibility flag! R4 K# e4 ?% n* e5 N
d delete a partition
/ G- V1 g6 R' X( N+ Y l list known partition types
8 P# N" @. P& L4 j! U- T m print this menu1 d3 q- M+ ~6 s+ z
n add a new partition
: t- {3 D; S& i: k" ` o create a new empty DOS partition table
8 _* d4 r! Q# F% v p print the partition table
- `* ~0 f9 Q4 @3 P. Z q quit without saving changes
* E7 I- W5 r+ O6 Y2 M" R( d' s7 b1 C s create a new empty Sun disklabel" r, L4 F. `3 j$ I- R
t change a partition's system id
. x5 Y7 o$ h- Y4 B, M5 K u change display/entry units
1 h& ?3 Y7 \0 x v verify the partition table/ n/ j5 H* S, V3 f, {, }
w write table to disk and exit$ w; F" D. v( R+ ?, u
x extra functionality (experts only)
# ~% Z% o7 y! K. ?8 N. M: Q$ { Command (m for help): n
1 H4 Z2 h5 W/ L6 ^/ _0 R Command action, B, j0 X) b% s5 P
e extended" P% e; z/ u, a& j
p primary partition (1-4)
, b7 u) b7 p7 I; c* l5 w8 O p
: |8 ~4 @% z3 d% ^% M' o Partition number (1-4): 1+ x9 Z0 ?( G1 m# }& y' v+ g1 ]) P* B
First cylinder (1-8322, default 1): ' f; ^. I( Y4 X7 S, F& @
Using default value 1
5 {! G6 N- G p, A Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G$ ~" B. k9 E3 W! E5 n
Command (m for help): p
. D6 d/ x, ]3 @; ^" x2 w Disk /dev/hda: 4294 MB, 4294967296 bytes
4 D w j, `$ o) j( z' t! p, F: w 16 heads, 63 sectors/track, 8322 cylinders
) g4 C( Z8 `9 S Units = cylinders of 1008 * 512 = 516096 bytes
E0 j+ R8 ~) N' |* E/ w Device Boot Start End Blocks Id System& N2 r/ W" w* |* H5 i' A
/dev/hda1 1 1000 503968+ 83 Linux, N% l3 J& j% N0 }2 x; ]
Command (m for help): w0 `1 o& N% f/ d# \, D& n3 y
The partition table has been altered!$ H2 a! a1 Q- @) p. |
Calling ioctl() to re-read partition table.
# Y8 Z' M4 t9 X) d$ N Syncing disks.
: D) S% [! `8 a1 y0 e) S //格式化新分区
: D9 i0 P4 I3 Umke2fs 1.32 (09-Nov-2002)
- Y1 l4 Q3 H0 v6 x% \- I Filesystem label=2 Z$ W8 M7 w8 k5 h
OS type: Linux7 I8 {% g6 x8 [: {( F
Block size=1024 (log=0)
5 p* p6 m( n& G" s' ]+ O1 s Fragment size=1024 (log=0)0 k" p$ U9 ~4 F: m
126480 inodes, 503968 blocks
0 \0 }/ A6 P! g n$ v+ W 25198 blocks (5.00%) reserved for the super user5 h# p5 y: V; M( S1 z" S J' V+ S
First data block=16 C" ~5 V! B" B0 r) y5 d
62 block groups
2 O7 ^, m4 Y7 F/ y8 [% C 8192 blocks per group, 8192 fragments per group
* @* _% K! k0 l8 B. r* P* J {- R 2040 inodes per group! [& n. c% |4 I8 ~6 U1 F N# Z
Superblock backups stored on blocks: : Z5 V) F$ m& Y* j7 S" D
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014090 M+ A+ Y% g+ S% I
Writing inode tables: done
6 O4 f! R$ Y4 j% r$ V! q Creating journal (8192 blocks): done
/ w+ Y) V% _ z! ?+ A6 J8 d9 O Writing superblocks and filesystem accounting information: done1 K3 w. x5 N+ s: w
This filesystem will be automatically checked every 30 mounts or
9 O# j4 Y- B: h( I% u1 e 180 days, whichever comes first. Use tune2fs -c or -i to override./ f6 I) h, d/ C
文件系统 1K-块 已用 可用 已用% 挂载点
- r: G* S- J9 O; }7 i, V/ D1 }9 p /dev/sda3 3723848 705992 2828692 20% /. i6 E# I. }- ]( v/ L
/dev/sda1 101089 9274 86596 10% /boot
' M7 s4 M3 V% b6 C) O none 14520 0 14520 0% /dev/shm& \6 u0 z7 j! L! c7 x" [% N2 R3 d
//挂上新分区8 q, S9 m% S9 y8 A! X
- mount /dev/hda1 /home- W4 e6 w% l5 C6 w
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
- W2 c6 J+ K* k2 G+ [% o2 E% G /dev/sda3 3723848 705992 2828692 20% /
* B; S. ?8 p% R7 I4 [" D/ G /dev/sda1 101089 9274 86596 10% /boot
! g; J" ~: O/ z5 k none 14520 0 14520 0% /dev/shm
, h# @0 c' f) P$ \0 k" b /dev/hda1 488006 8239 454569 2% /home
8 g1 [1 Z$ C8 k0 k p! ~
# H* n& M( w/ L# O) h Z. S自动挂载:) c8 y; O$ ^4 q' z4 e# X, P
- vi /etc/fstab3 B% F# U6 R" {6 c$ z1 h
- 3 U! e! e( b( Z- d; S
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0( Y# n" P; k7 `4 @0 L6 U4 b6 [
- ( O" ?* F! z# b3 e( ]
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
8 ^* y+ c) h1 z0 z; q& n- mount /dev/sdb5 /mnt/ljp1+ H/ X7 Y! E* y9 o4 J7 N9 n8 W
+ T- L0 Y9 F1 I( Y- mount /dev/sdb6 /mnt/ljp2
复制代码
$ p+ Z0 ~( u E( K# r; y% a9 a* i- N& Z
: {$ J+ X& w7 D$ C. l |
|