|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)# g2 I1 j: ^7 M- D9 z
or: fdisk /dev/sdc (for the third SCSI disk)2 I( q4 I/ d+ C) A8 o
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
' O. }/ y) [# M: u$ W. C1 \ or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
l7 ^2 W5 _) A- L0 O7 v ...6 {3 P( n% W) ?& p2 p4 W6 |
- df -k
; [- L2 T# k: v$ ^& N2 g - df -lh
- j4 A1 P5 {5 H2 h( {1 W - 查看有几块硬盘:fdisk -l- g4 Z5 ?$ \- u) J
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
0 f- K- E% n& P; S6 K' p /dev/sda3 3723848 705968 2828716 20% /# M, a* h' {8 ]" x8 t0 Y5 n6 h1 ?
/dev/sda1 101089 9274 86596 10% /boot2 x+ R4 i- k, s; \9 u1 E
none 14520 0 14520 0% /dev/shm2 N/ p0 d& M4 n
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用; |2 n( `: o. v
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel! c7 D2 d; b/ j" T# L& S3 z
Building a new DOS disklabel. Changes will remain in memory only,* U5 L7 Z1 I% ~+ t* ?* s4 _0 o
until you decide to write them. After that, of course, the previous
1 z$ V* E9 }8 a! y& P2 d, c/ _ content won't be recoverable.% B3 T* ?& _- z6 K4 ]
The number of cylinders for this disk is set to 8322.- `$ L" r. |5 A$ i7 t/ q* _
There is nothing wrong with that, but this is larger than 1024,
& X' o" i3 s- g, G and could in certain setups cause problems with:
6 j2 k5 T0 `, Q: @; L( O* p9 p( D 1) software that runs at boot time (e.g., old versions of LILO). x9 X$ R; O7 Q/ d2 O4 O. v z
2) booting and partitioning software from other OSs R% W2 Y Y) p; A, f- }
(e.g., DOS FDISK, OS/2 FDISK)/ A ]: `) W& {8 D; }' h
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
% X( W( C3 ^9 q' f; ` Command (m for help): p
+ J6 g% r) n2 z2 F( ]; F7 H! V' h5 I1 K Disk /dev/hda: 4294 MB, 4294967296 bytes, _6 E/ J7 S( t9 Y! u
16 heads, 63 sectors/track, 8322 cylinders
/ w' [& V2 k" E, F5 r- L1 } Units = cylinders of 1008 * 512 = 516096 bytes
* Y. W1 A/ @5 k2 H' F Device Boot Start End Blocks Id System2 z. M- A+ j; }8 l6 z8 H
Command (m for help): m4 z; g2 N1 z0 e8 b
Command action
' }- d: R: V+ f* m$ }1 J$ c W a toggle a bootable flag! n5 Y T- _0 s2 g8 E) v% I
b edit bsd disklabel' c- w9 ^% X1 `
c toggle the dos compatibility flag
# y/ ]2 F" s; Z d delete a partition; H( b- t) X# e/ k7 B+ p
l list known partition types& ]8 v6 \% ?) p* K$ \1 b
m print this menu
& x# x7 q1 H+ O, s: S, _2 D n add a new partition
- l8 h+ m7 [ T# U o create a new empty DOS partition table
" I1 Q6 Q W3 k' B: ~9 f- E p print the partition table
5 e6 e m5 b0 V# y( L I& `( a q quit without saving changes
1 |9 l6 z9 T8 B; x2 P R3 N3 M9 g s create a new empty Sun disklabel1 c+ i n* i3 t7 b9 t
t change a partition's system id
$ a& L+ |" {3 r, |0 [1 y! n u change display/entry units
/ w/ C! n* n! E v verify the partition table
8 i: [" U0 n; i$ |4 B w write table to disk and exit
9 \2 _0 ^& Y: }6 e- q. E) N x extra functionality (experts only)4 A) n' W6 D: k- p/ [
Command (m for help): n9 Y# V3 T7 @8 O1 F- J
Command action
2 ~, ]/ Z5 `% Z; b- x0 M( T e extended+ J: o' ?& M+ T
p primary partition (1-4), o- U* e5 ?+ Q% ]
p; ]5 N! F) w1 A9 e" w1 F: J
Partition number (1-4): 13 X8 u3 m- o M z
First cylinder (1-8322, default 1):
. y% E) ]2 e) S& A4 Y3 f Using default value 1
/ y8 _+ M/ N7 H8 f& L' Q' h" V: c Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G% v; t. ?9 @6 H6 L9 _
Command (m for help): p
0 i" w+ Q$ t+ j# C* h7 b7 F$ p Disk /dev/hda: 4294 MB, 4294967296 bytes! }8 O5 z. h% t: `! f
16 heads, 63 sectors/track, 8322 cylinders
1 p9 N+ g/ A$ Z% z1 t Units = cylinders of 1008 * 512 = 516096 bytes0 a% d$ U0 R% {
Device Boot Start End Blocks Id System& e0 p$ C3 [+ E3 _ ?* a4 i% C
/dev/hda1 1 1000 503968+ 83 Linux
4 G) i2 e5 j1 L0 ~4 n Command (m for help): w0 x% x, D' v# ]
The partition table has been altered!* e' Y3 {) H+ ~" a1 g; |
Calling ioctl() to re-read partition table.
( w4 }7 d5 M$ f5 I0 F Syncing disks., P9 B" Y% I6 }- O: U, {$ b
//格式化新分区5 X" W9 ` t6 B$ `+ [
mke2fs 1.32 (09-Nov-2002)4 w+ f( F& c1 V) Z
Filesystem label=9 [9 T& K0 I$ K+ E* _; \; R
OS type: Linux
8 z) t- @- l1 e Block size=1024 (log=0)
2 y+ ?- E* e) [# }& T: k Fragment size=1024 (log=0)
6 C- d6 `# U2 e$ W, p: o2 K 126480 inodes, 503968 blocks
/ E4 Q2 [5 F3 ]$ S( t 25198 blocks (5.00%) reserved for the super user
; l( }8 @* A* I% n8 O First data block=1
- A5 J, J: Y* \( H } 62 block groups" Y) `. F7 N9 a" G% I9 I
8192 blocks per group, 8192 fragments per group
4 a2 f! s! A* c; h* X& I; r$ q( j2 f 2040 inodes per group! [9 N1 V1 X' U, y# |) n5 m
Superblock backups stored on blocks:
) U$ q; |. ^! I4 N, q, Q- U 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409/ G- R: G) F1 [2 N) A+ A
Writing inode tables: done ( n& k0 v# \' D; J8 m* x
Creating journal (8192 blocks): done
. c( q1 d+ j% @9 j+ s Writing superblocks and filesystem accounting information: done* g% O/ u5 E# Z- u& E
This filesystem will be automatically checked every 30 mounts or
7 Z; K$ R, s/ l# y! M 180 days, whichever comes first. Use tune2fs -c or -i to override.7 N5 U4 C" p, M$ L" W5 `
文件系统 1K-块 已用 可用 已用% 挂载点8 ^) z$ A8 B- `3 k0 v
/dev/sda3 3723848 705992 2828692 20% /( L- w8 K8 J6 m- d4 Z$ t/ k: L) h
/dev/sda1 101089 9274 86596 10% /boot3 ~4 g3 F; R. ^+ U" b( g# S
none 14520 0 14520 0% /dev/shm
! H2 g6 I- K8 \; A, k$ [ //挂上新分区
2 e" k1 E! W5 g( x' v5 q5 h* w8 v# ?- z- mount /dev/hda1 /home1 A9 V- ~3 K* Q5 `5 S+ g0 m l% o0 a
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 e* `! _4 _, g2 i. t" E2 W' H
/dev/sda3 3723848 705992 2828692 20% /
& A e8 Y! u0 O9 Y /dev/sda1 101089 9274 86596 10% /boot
' f4 m) c! n6 B& e# v9 Y5 V* Q R none 14520 0 14520 0% /dev/shm
Y% H' J* k! Y6 {1 w. w" w! P /dev/hda1 488006 8239 454569 2% /home$ M* w3 P6 ^) G/ M4 ^+ d3 V; c
! E p* o! y: Z! x, n7 S5 ^+ t. h- t
自动挂载:, Q6 V+ H# d9 O0 j
- vi /etc/fstab6 Q" k F, q! C% u+ w1 L, D
" P9 M+ |& s3 W) @' w! _. e- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0. f5 D, s0 y0 A) S+ k3 r4 g3 c
- 2 H$ I. z' {" R# V% q6 j
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:; @- s' e4 ?8 F& S3 P
- mount /dev/sdb5 /mnt/ljp1 E3 m$ ?0 I C, }
0 n1 B6 o6 y: L. P; O- mount /dev/sdb6 /mnt/ljp2
复制代码 % `6 C9 W0 A, I8 o
" }- _: T/ c% S* X* N% K. K+ @4 l& m/ _4 B+ w- @0 I% a
|
|