|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
. m) s0 k& _$ {6 T2 h& x or: fdisk /dev/sdc (for the third SCSI disk)- i& q0 K4 \$ u6 Y7 S
or: fdisk /dev/eda (for the first PS/2 ESDI drive)9 ^3 B" t# O7 ?+ P# j
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
3 C( z B/ O6 K+ m7 R+ | ...8 o7 Q& N+ |' s y# M
- df -k
+ v4 h4 S" k7 {1 v- x- J X - df -lh z0 C3 C( g [9 C: @9 X
- 查看有几块硬盘:fdisk -l
2 M& n/ i* m! W2 Z! A
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点1 { M2 r4 m/ \0 Z# z9 n
/dev/sda3 3723848 705968 2828716 20% /$ n) `0 p, ?) c$ E
/dev/sda1 101089 9274 86596 10% /boot4 s& D+ q9 G. w7 R3 Z3 t! H* x
none 14520 0 14520 0% /dev/shm5 u9 e1 C5 x/ j9 H2 N/ R3 m
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
7 V6 T" ?; d8 q; @8 l/ L+ j3 \Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel/ |( B# V- [+ x9 \5 T8 `/ n! `
Building a new DOS disklabel. Changes will remain in memory only,, w4 v6 m7 [' M* ?
until you decide to write them. After that, of course, the previous
# \9 q T* m/ y" v" C- p. J, Z2 g5 [ content won't be recoverable.& y) Q3 v) G3 F0 [, s- n! I/ u" T' A
The number of cylinders for this disk is set to 8322.0 W+ U f) H8 U, `
There is nothing wrong with that, but this is larger than 1024,, @" o# b7 a2 \: E7 b
and could in certain setups cause problems with:
- G7 D) j; i ^- k! S' T0 F# m 1) software that runs at boot time (e.g., old versions of LILO)
7 b. w+ K. F2 m7 E; Z 2) booting and partitioning software from other OSs, J" a% g1 c7 m) t
(e.g., DOS FDISK, OS/2 FDISK)
7 j3 e, f& Q6 \/ i5 e5 T3 \. _6 _ Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
* q* o2 @+ x' F8 k) } Command (m for help): p/ D. C" ]% l K9 U# c6 y6 g$ w+ _0 B
Disk /dev/hda: 4294 MB, 4294967296 bytes
1 v: k& B6 H$ F8 b9 D8 Q 16 heads, 63 sectors/track, 8322 cylinders5 f# Q/ c7 e4 }% G
Units = cylinders of 1008 * 512 = 516096 bytes
, Q0 U, I/ h8 |5 l Device Boot Start End Blocks Id System
& w! a' C9 h N, ^- m* ? Command (m for help): m7 J3 |( e- K0 W! ~2 C4 k% L6 ~
Command action4 \( G1 x9 A9 u2 s7 t$ q! y0 i: o
a toggle a bootable flag
- P8 b' D6 g/ }3 e$ S7 b7 y) G b edit bsd disklabel
3 J9 N# ]$ O9 t, E0 @& w5 A; _ c toggle the dos compatibility flag& a3 d- s0 ]# r: y7 ^" G0 n* k; ]
d delete a partition B+ S9 m* w' y. B J
l list known partition types+ J$ i3 k0 U F9 f8 ]
m print this menu, l1 Y5 F6 q( T; B9 k+ P8 @
n add a new partition
- ^: i6 d% F+ w. N8 r o create a new empty DOS partition table1 x* L' j5 {. `* o/ n
p print the partition table
3 ?* r1 f" S/ N" ^+ [ q quit without saving changes
9 t1 l: P+ ?( Q s create a new empty Sun disklabel) X1 S4 c2 s. E9 M
t change a partition's system id
. p5 |; H* d! E8 q F! v8 _ u change display/entry units
& m- c! Q) S7 f( }; W2 q% k v verify the partition table5 U/ E: R. p5 a8 K
w write table to disk and exit; j4 J9 f+ F( U# _
x extra functionality (experts only)
9 o0 X9 a6 M3 E: M$ o1 u, H Command (m for help): n
' A6 Z/ i z% A/ Q) X) q Command action
N4 l3 V. D( x' @% M e extended$ t$ @. ]7 l: Y4 o0 k$ v1 ?
p primary partition (1-4), B" \: y8 o" C1 w9 i
p
, [. k1 N6 z% a, G0 t0 _3 { Partition number (1-4): 1
8 m. k8 h) e. }% n4 i* F First cylinder (1-8322, default 1):
: u1 }# c. K' p' x- r Using default value 19 `( }$ v# s$ C9 V: q8 \/ Y& B
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G) O+ r3 L) }5 I3 f1 N2 K! S
Command (m for help): p
7 V$ z' v3 p" f7 X Disk /dev/hda: 4294 MB, 4294967296 bytes
/ y$ b! a- F# y" c; Z4 r 16 heads, 63 sectors/track, 8322 cylinders
- w' b& U: [$ `$ u2 a" W Units = cylinders of 1008 * 512 = 516096 bytes; U! ]+ i: ~, @& J1 C# ?
Device Boot Start End Blocks Id System
# o# B9 ~2 W. t2 ]9 x5 \ /dev/hda1 1 1000 503968+ 83 Linux
0 P: K" ]# k6 S3 ? Command (m for help): w: d4 d$ E1 C0 w f- X
The partition table has been altered!" e2 H( @! U6 H x$ B7 i* F
Calling ioctl() to re-read partition table.# f0 ~1 l3 u, H6 D
Syncing disks.# f; L6 U* b: n, j
//格式化新分区
) J6 q+ a; y8 b5 U4 xmke2fs 1.32 (09-Nov-2002)! F! Z5 T5 D" r. A
Filesystem label=
+ Y7 {9 @0 q( \4 [# } OS type: Linux o( [. ?) ?& r! N$ `" C2 P& W
Block size=1024 (log=0)
+ x' c* j2 D- n3 G8 M- g Fragment size=1024 (log=0)
+ E* L- L6 n& h" G i! S' T+ ] 126480 inodes, 503968 blocks
) ]9 ?' c, l$ Y% {! {4 Z 25198 blocks (5.00%) reserved for the super user |$ H: t: [; ~* a) H
First data block=1" X$ E: f, m' g$ j
62 block groups
8 \" O/ u4 R! A 8192 blocks per group, 8192 fragments per group
$ u9 F' e4 e7 F5 z; x 2040 inodes per group
% x* s; L% x, u+ W Superblock backups stored on blocks: % P- Y% T, a4 h2 ^( } E! g
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 O) w7 ^2 t- N3 }
Writing inode tables: done , {) J) |( K3 h& @/ P& o2 d+ V
Creating journal (8192 blocks): done
# w6 t# C/ z! I, u. \ P. F Writing superblocks and filesystem accounting information: done
- j M% V7 Y3 y7 p0 U This filesystem will be automatically checked every 30 mounts or4 _8 D, J& ~$ }
180 days, whichever comes first. Use tune2fs -c or -i to override.
1 P3 B3 }, Y6 u- g% ~4 a文件系统 1K-块 已用 可用 已用% 挂载点$ F& t b, @/ J9 A* l8 F n
/dev/sda3 3723848 705992 2828692 20% /3 k N/ a+ H' }/ ^" u) [6 |
/dev/sda1 101089 9274 86596 10% /boot
J) [4 [# t( h, P" ~% ^ e none 14520 0 14520 0% /dev/shm
$ W) d( ^( ]$ w5 o //挂上新分区9 B, X" p6 F2 |' r/ z
- mount /dev/hda1 /home
: \5 k- C( |! m. }1 u - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
B1 i/ }* R6 u9 R /dev/sda3 3723848 705992 2828692 20% /
. q5 w5 V( P% c- b2 f6 s, _ /dev/sda1 101089 9274 86596 10% /boot
/ [. r: c" G* g9 f! \; J none 14520 0 14520 0% /dev/shm4 L3 h7 x1 Q; L+ F8 v7 I, A- g- h! n
/dev/hda1 488006 8239 454569 2% /home% R p. X1 o! u2 f, e
; B6 t: _ z* E8 u$ U7 r7 Y
自动挂载:
& x9 I$ _3 P; f W& ?1 k- vi /etc/fstab
2 h5 @* t5 f0 O$ p9 H" T - : q! @- S5 ~% |. e) x" S" \
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
/ E- x- v8 a( A - 7 |) P) W$ a0 G! a
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
; U7 G( O9 ]( S/ F% F. X- mount /dev/sdb5 /mnt/ljp1
}+ K1 t0 {; y
( c! A5 c) M) {- D. E9 l+ k4 B- mount /dev/sdb6 /mnt/ljp2
复制代码
; z* Y5 y6 A5 R8 v4 ?. R& S
# ~3 ?, L1 y* k5 m1 I9 n7 a3 t
9 K/ H: {( d" r7 i3 a5 x, s7 A |
|