|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
) m; z, Y, E9 f! b or: fdisk /dev/sdc (for the third SCSI disk)2 r$ B/ B' |& b) b6 q
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
7 R6 K2 B5 D0 H8 t or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)5 U% V% c+ M! e; {
...$ ~; y8 \7 M: @6 E! p" O! h- N
- df -k
) e- U2 q1 K) A - df -lh! A. v$ h; \- t: g1 j v
- 查看有几块硬盘:fdisk -l7 k0 ]7 t; r) p3 P0 i
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点. r W/ @# ?. Z. w+ R- N. P5 D
/dev/sda3 3723848 705968 2828716 20% /% U7 y1 C% _- }" ~' q
/dev/sda1 101089 9274 86596 10% /boot% M1 g/ @+ S) X6 p
none 14520 0 14520 0% /dev/shm1 `1 Q1 m! C- `& x
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用$ C/ A/ J1 X* _7 [
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
. h, }+ Z1 w" Y$ U5 m- W Building a new DOS disklabel. Changes will remain in memory only,! }2 k k) G) q7 e9 W
until you decide to write them. After that, of course, the previous
& W, k; w+ y% ^; I content won't be recoverable.
* D# n, J. D5 `4 S8 }% }: i! x The number of cylinders for this disk is set to 8322./ j% k5 T8 \, ?: u9 r/ s
There is nothing wrong with that, but this is larger than 1024,$ p# q& e. r, N
and could in certain setups cause problems with:; g2 V2 p& i* @
1) software that runs at boot time (e.g., old versions of LILO)
* M# Z$ G: x5 j- \9 X7 t4 A 2) booting and partitioning software from other OSs0 `4 a8 |+ w$ {) N X0 P4 G0 N
(e.g., DOS FDISK, OS/2 FDISK)
" X$ z. ]$ _! ?+ o; J0 X Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
# n3 H$ u, K2 [: `3 a Command (m for help): p
" x. x$ N5 Q# M! H6 {& h Disk /dev/hda: 4294 MB, 4294967296 bytes
) z" x) X) b7 C4 B' s/ E 16 heads, 63 sectors/track, 8322 cylinders
7 y, K8 L3 w1 L+ b Units = cylinders of 1008 * 512 = 516096 bytes5 Z; B/ g5 K( a3 b, K
Device Boot Start End Blocks Id System
/ s5 i4 x' S) I3 i Command (m for help): m
$ ~! y; i, m+ T0 Q# m) y5 v( Q8 | Command action
8 x5 J, W3 k. |# U+ a$ Z a toggle a bootable flag3 L/ V% r, c, h. H) F. S
b edit bsd disklabel
- O8 R1 i; T& ?, S c toggle the dos compatibility flag, | A$ ^$ f. I6 V& u
d delete a partition( M2 Y, Q# x& ~8 ~* R. E5 c& I$ [
l list known partition types
0 Y/ {$ L, h# v2 W. y. k0 _! q4 h7 [# w m print this menu
; N: \0 p! ^2 O6 ?" f5 h2 ? n add a new partition' J. q7 o# p/ Z6 V
o create a new empty DOS partition table; m& e9 I* R" F, p
p print the partition table$ O* ?! I" K; b5 @, I
q quit without saving changes
; r1 \% ^' h# T( x" x# \ s create a new empty Sun disklabel
1 n# t! E0 j z: U1 p. t) A t change a partition's system id
A. n: \7 ?6 y) `! b1 Y7 b2 m9 n u change display/entry units
- ^) l ]" v% _' s v verify the partition table! A: N, c7 w9 A7 Y+ z6 L5 l
w write table to disk and exit
3 n! ~* J/ @0 e* b# x6 w; ~% Q$ L x extra functionality (experts only)7 d# g" Z M. T# y/ [6 i* k
Command (m for help): n, Y- h5 p* t3 B: @! g. @
Command action
0 N; F2 }% ^! e/ M9 ?; ?1 K- V/ o# { e extended
0 W4 m+ f1 W+ [% X# C p primary partition (1-4)
9 U6 N% ]2 i; J/ w+ D' b p( i% }8 z) i; ]& U* Y3 s" _
Partition number (1-4): 12 e- F1 k; c9 H; ]
First cylinder (1-8322, default 1):
7 c' p) e% F7 W& Q3 k- Z Using default value 1
- r. y" ?. R( M7 e+ Z4 x Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G: z) V* B. n2 E2 P- ]& H
Command (m for help): p( H( c% n- p4 @9 C
Disk /dev/hda: 4294 MB, 4294967296 bytes7 {+ K8 X* t$ d% B/ r( i. Y8 ?& d
16 heads, 63 sectors/track, 8322 cylinders
2 v1 f D! P, A7 z Units = cylinders of 1008 * 512 = 516096 bytes
# n, Z8 ^" ]0 ?: U- [& ] [& {. G2 I Device Boot Start End Blocks Id System5 W6 y3 H. U5 A+ Y
/dev/hda1 1 1000 503968+ 83 Linux9 v, W2 ]! a, U0 W& u" G+ M
Command (m for help): w0 K3 A, x) K5 p
The partition table has been altered!
" e+ ?; B; u4 l; |( S9 \+ M# x Calling ioctl() to re-read partition table.
( U* K* s, K7 V5 d Syncing disks.
& g v: ?+ q6 p- {; ^# t& z //格式化新分区
5 M( L6 L& } B7 C) F3 zmke2fs 1.32 (09-Nov-2002)
' o4 @4 \, j) ~( V" f Filesystem label=0 T4 |6 L0 R- [2 A
OS type: Linux
6 m% |$ i; h3 t" O$ v0 F' L Block size=1024 (log=0)
* X- D* H& i( C# P) Y% S Fragment size=1024 (log=0)8 l* i( |5 P/ k' h# a. U! {" o1 J
126480 inodes, 503968 blocks
8 {1 ?! F% e# u: T) G 25198 blocks (5.00%) reserved for the super user7 O6 u& B2 s: w# ?, V: V2 Z0 c& i" c
First data block=1
* R9 l" n# q+ @' v. Z 62 block groups
8 a" S( R$ Y8 K1 P4 Z 8192 blocks per group, 8192 fragments per group& w6 \& J9 h" k: A) B3 A6 N l
2040 inodes per group# ?' `$ p: [( V0 R% J; Z
Superblock backups stored on blocks: # i, W3 f' t$ W- L. I
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014096 O" M" V3 S; { \ U/ J
Writing inode tables: done . e' ~* U$ P8 l4 ~' H0 k
Creating journal (8192 blocks): done7 m O6 ^& _8 `4 d" e! o' E
Writing superblocks and filesystem accounting information: done
2 V) N! K4 l, x This filesystem will be automatically checked every 30 mounts or4 Z) d7 M! Z4 a* G8 r j& R
180 days, whichever comes first. Use tune2fs -c or -i to override.
% W- G7 I4 B' S4 f* A, a文件系统 1K-块 已用 可用 已用% 挂载点# T- v7 h; z, J* _ v. W7 e
/dev/sda3 3723848 705992 2828692 20% /
# x" l/ t" }8 {' s/ ` /dev/sda1 101089 9274 86596 10% /boot
- k5 m" b0 E& I none 14520 0 14520 0% /dev/shm/ r( d: G. i, p* o
//挂上新分区: `/ Y2 L1 y! V5 U
- mount /dev/hda1 /home
M: {$ p0 ~6 i" P6 m - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
* F' S r+ x D. Q8 v /dev/sda3 3723848 705992 2828692 20% /
) |7 V% D0 I- C /dev/sda1 101089 9274 86596 10% /boot' E7 R; T0 r$ P# U9 A, U
none 14520 0 14520 0% /dev/shm; I8 \4 Y6 ~ I. `1 r
/dev/hda1 488006 8239 454569 2% /home- f) j e. l8 D, c
2 }% {9 A4 T" w/ I$ E D! n
自动挂载:$ m' R" r' f$ T% e( W
- vi /etc/fstab
2 T* B: z- J9 g) Z
7 F7 r: {* N M* j- t0 L( }2 V G- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
, W* U" i9 C4 ^, t w - - z% V, H; C. \; A
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:5 Y$ R8 a% Y7 F! G* c2 Y$ W- O
- mount /dev/sdb5 /mnt/ljp1! F3 j4 O1 }% f$ t* B# c p. S7 [
- + F5 T3 u" H2 v Y/ W
- mount /dev/sdb6 /mnt/ljp2
复制代码
7 m8 @8 b2 ]' A6 {4 q. U2 y; E& g/ L: g0 b9 j9 [" [
o& |) h; R4 A; t. ` |
|