|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
" v" g! J+ e) b( v0 A% M6 t4 W or: fdisk /dev/sdc (for the third SCSI disk)
) w6 c0 I; a: |* m3 H or: fdisk /dev/eda (for the first PS/2 ESDI drive)$ ?/ L/ J9 q: j) ^
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
[& f8 E7 f* f0 k% u$ c8 ^ ...3 K* w: O0 h p6 Q6 F
- df -k8 T6 u G4 H/ {
- df -lh
' P( i: N- S8 w# ^2 R, Z - 查看有几块硬盘:fdisk -l5 B: {% y. K) H& O4 a ]
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
9 j* X/ q. W: |( F /dev/sda3 3723848 705968 2828716 20% /
* J* O8 r) L$ L! | /dev/sda1 101089 9274 86596 10% /boot2 S# C t; r4 B2 R. S# d
none 14520 0 14520 0% /dev/shm3 N1 R. ^( v# t7 R
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用3 |. x$ y0 R3 z# h# i/ ^, e
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel" @2 c) [% \( F1 s, [* u- r
Building a new DOS disklabel. Changes will remain in memory only,
+ {2 e* t' y; @ U( \5 }; k until you decide to write them. After that, of course, the previous0 y: s2 ~) k3 o5 }! E8 a
content won't be recoverable.
6 ^! q9 v1 b1 j4 P The number of cylinders for this disk is set to 8322.6 v+ f5 ?/ G5 J6 `% p* c9 Q; E& x
There is nothing wrong with that, but this is larger than 1024,& o/ w' ^' [' V" I
and could in certain setups cause problems with:
# r) f: f; o5 F ?. Y 1) software that runs at boot time (e.g., old versions of LILO)$ T* O6 \$ c3 g& A
2) booting and partitioning software from other OSs
& q' f0 G4 C; ` N' F (e.g., DOS FDISK, OS/2 FDISK)+ v! J1 r: C+ d: h6 J1 t; K
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)+ a* z- y* L+ i' M e" M/ e
Command (m for help): p( F0 c, q% Q7 W
Disk /dev/hda: 4294 MB, 4294967296 bytes
# E7 w( m; G- d. H 16 heads, 63 sectors/track, 8322 cylinders
8 a0 S6 C1 F6 Y Units = cylinders of 1008 * 512 = 516096 bytes: M8 i( i) G2 D3 h/ S
Device Boot Start End Blocks Id System
4 g; w/ H7 H! l( R Command (m for help): m
* D3 t2 D# }' r% N4 n; g Command action, [0 I9 i# V: F
a toggle a bootable flag9 J( b7 k! l( Q* B1 k, N: t7 ~
b edit bsd disklabel: ]2 G: B0 w: X6 Q! u/ \+ D$ S
c toggle the dos compatibility flag
6 v4 `4 `; K2 O3 \- Z) B. p7 T) e d delete a partition
0 M/ J _+ e( r l list known partition types
. H/ V) u' V5 d6 X' c% h m print this menu8 j, C0 `& f0 w8 c! ?
n add a new partition
; p8 s2 l2 [# q+ ]2 c o create a new empty DOS partition table
2 W4 |+ O: }4 x) r+ w/ V2 m2 S p print the partition table
3 }6 E4 q" q6 A; O$ W( t q quit without saving changes
P* }3 w( q# Y s create a new empty Sun disklabel
5 D( P* v: X) q" T. A; V$ R* P% G t change a partition's system id0 ?( z, X% P9 a" t; t6 A8 }/ c
u change display/entry units
/ M3 w8 A$ F) @$ r& ^* j2 b v verify the partition table
7 u2 a- t* {1 R3 Q+ ^6 K w write table to disk and exit
/ A/ D; o3 \# K' m- j x extra functionality (experts only)4 ~- b7 r2 u! C) d
Command (m for help): n
( g, w6 v4 B6 U& X$ \. y, T Command action
' k9 p, t$ c5 W% L. G e extended1 r) z7 M) N% S: ?2 k/ a. U
p primary partition (1-4)
" \! s% _1 q/ b6 g p
3 j2 Y. @! b& b1 H, F8 W0 Z Partition number (1-4): 1
* g8 R+ d0 I( H4 b7 i8 j/ S First cylinder (1-8322, default 1):
9 C: m' }) k7 [3 Q: P" P3 R Using default value 1' B5 [/ j" J N4 B
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
+ D* ~: y0 }1 y- }! H! C; Y' P Command (m for help): p; K/ H6 }# G, U! q) d6 H
Disk /dev/hda: 4294 MB, 4294967296 bytes
" o4 q5 S2 i* ?: c) ^ 16 heads, 63 sectors/track, 8322 cylinders
* Y3 S; [3 R/ V3 Y9 W$ }4 s Units = cylinders of 1008 * 512 = 516096 bytes
' c: o. I( s' ~: b/ b1 W Device Boot Start End Blocks Id System
$ ~/ Q8 Y3 r: r4 @7 Q# O* c, t /dev/hda1 1 1000 503968+ 83 Linux/ E/ B( d0 ~+ R6 i: K$ f6 k) V
Command (m for help): w
- M! W- s; _3 X) {1 X The partition table has been altered!
7 s' U5 V3 b! N. o" K Calling ioctl() to re-read partition table.. W. J) z# a6 l7 K: a' T; A' _
Syncing disks.6 x# [, g8 R* |3 Y: x8 s* v
//格式化新分区* }+ T2 R/ W, Q4 u F
mke2fs 1.32 (09-Nov-2002)
" M2 R$ l% G! L" l9 g" i& g Filesystem label=& ]/ I. G/ O- Q% J
OS type: Linux; V1 j Y$ E3 y% h! e W9 y2 e
Block size=1024 (log=0)
) N$ h7 q0 A E( {* X7 |9 e/ g) f Fragment size=1024 (log=0)+ J8 _$ ?0 E* l) P
126480 inodes, 503968 blocks
' o+ b* F8 Z; t7 \( m3 @ 25198 blocks (5.00%) reserved for the super user
9 @( x* u% A, ? A8 J- Y/ ~% M First data block=1
+ X% i- L, s1 t' |. h& d' P8 H5 M 62 block groups' u$ o! Y6 a( j6 \* O2 i
8192 blocks per group, 8192 fragments per group
; e2 T8 |3 t' n$ `! b1 f4 K 2040 inodes per group
E# N; p: X6 `' i$ ]$ d3 V( c Superblock backups stored on blocks:
. Y' ~$ g, Z: d. O; k- c" X1 B 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
( s* M' H: c$ d, {/ p Writing inode tables: done
+ u( P3 \$ J( ?, C t Creating journal (8192 blocks): done2 R8 p3 R6 P! C5 t( F# n8 F
Writing superblocks and filesystem accounting information: done
% Q5 P# r' @) `$ k2 z' y5 \7 j This filesystem will be automatically checked every 30 mounts or' D/ j! V0 k m, U8 S: Z, v/ s
180 days, whichever comes first. Use tune2fs -c or -i to override.8 y1 j2 ~+ o u$ a# y3 M* F5 k
文件系统 1K-块 已用 可用 已用% 挂载点; n3 b0 n0 _& ^0 q) {* b
/dev/sda3 3723848 705992 2828692 20% /
1 T% {, {8 r3 z4 A: k. f; b$ @) f /dev/sda1 101089 9274 86596 10% /boot
& p2 U3 @5 `8 U( m9 n none 14520 0 14520 0% /dev/shm# x4 V# V ^1 d4 g+ r) E
//挂上新分区
& O: K- f, L3 h# }- mount /dev/hda1 /home% D' G S# Q8 `# A. }/ D
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
& ~: y% w3 P! ~; \: [5 F /dev/sda3 3723848 705992 2828692 20% /
! L0 C# x& Y0 G) Q, ~& d, F* D) J /dev/sda1 101089 9274 86596 10% /boot
# w: T- c) k" w none 14520 0 14520 0% /dev/shm
( }8 k# m) u V' J' u9 h5 K! j /dev/hda1 488006 8239 454569 2% /home
9 I9 r! N* S! @3 H- R5 a* ^$ f7 O9 l: F1 b! q4 @ F
自动挂载:' U1 ~* z4 u5 Q" K! _0 W
- vi /etc/fstab9 ~" N F; u' |: ]2 u) q
- 6 y" a" N4 J2 f- @
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 07 C1 O$ ^; J3 K: T0 o2 J6 l) q
2 f+ a( g* g6 ~) w4 u6 k- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
! }/ A$ O% S5 H* Q& b) ~) C- mount /dev/sdb5 /mnt/ljp1
+ K, Q8 s8 p" E7 z, e
$ t5 }8 r8 f" [" G8 ^7 \- mount /dev/sdb6 /mnt/ljp2
复制代码 " n/ H2 c y2 u; O" {
9 v' e' g. A1 j
' E6 I' O0 H; q$ [# L2 H* F |
|