|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)! R) h, V( K9 M7 P& {, H% Q* F( e
or: fdisk /dev/sdc (for the third SCSI disk)" W' Z: ?3 l _
or: fdisk /dev/eda (for the first PS/2 ESDI drive)( M2 t0 \* ]+ R- S/ J
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)2 y; D# Z/ ]% T4 r
...
+ V, K! o9 F5 e8 f* L' H+ L- df -k
3 K, L. t! U" L1 N; _1 h- P - df -lh4 W [; d8 D) u
- 查看有几块硬盘:fdisk -l
" ?6 |/ b5 _9 J Q# L6 T1 r
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点% N* }8 R6 }8 P" U& |' i) I
/dev/sda3 3723848 705968 2828716 20% /$ u% }9 E5 O! I" w
/dev/sda1 101089 9274 86596 10% /boot% a4 q/ a& n* z# F7 I5 U
none 14520 0 14520 0% /dev/shm
' ^' T2 j: M Q& Z! J6 r5 H4 B 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用2 a! d) a# f+ c- q3 |2 p$ b
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
' G! d( l+ v' p9 a w5 } Building a new DOS disklabel. Changes will remain in memory only,
& S; a+ k7 i3 j! c# G0 g# n until you decide to write them. After that, of course, the previous
e" f8 \: j; t' {+ D8 `/ k content won't be recoverable.
I7 z6 |% S* P The number of cylinders for this disk is set to 8322.
. o P z t$ f2 n$ C, O4 ~8 K7 w There is nothing wrong with that, but this is larger than 1024,
- V! f8 x, S+ h- P: w8 g4 W! y$ { and could in certain setups cause problems with:
7 }& J, H' J3 o. @; {& } 1) software that runs at boot time (e.g., old versions of LILO)+ L; t L7 i& K* @( f1 S( g* I# h
2) booting and partitioning software from other OSs( ~( w Y: q2 k
(e.g., DOS FDISK, OS/2 FDISK)
4 }' G1 c4 z- o; S. o1 x Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)5 ]5 {- X9 t6 T+ x1 |0 E; Y& h: I
Command (m for help): p( m8 c9 D3 x7 a% L( h
Disk /dev/hda: 4294 MB, 4294967296 bytes
5 H7 k- } J% ^8 R2 e 16 heads, 63 sectors/track, 8322 cylinders
0 T& \# @- T" Q- A; d Units = cylinders of 1008 * 512 = 516096 bytes
) I/ A' _" h' s- h Device Boot Start End Blocks Id System
& d- y8 V2 z7 a; n0 E7 a9 F) | Command (m for help): m
. s! X' D3 l: j! E q2 d) c. J0 o Command action
# `; F2 S/ r9 J8 n a toggle a bootable flag% ~7 @3 { U6 }, {- r7 u- ]3 W
b edit bsd disklabel3 q" m: |( l6 ~9 D+ g2 f
c toggle the dos compatibility flag
9 u0 w$ e" h9 v# F. B+ r) [ d delete a partition( d2 k* u6 g* P; } L& V0 h1 `
l list known partition types
$ k: g9 q0 X3 r; }; S; Q2 f! o9 D% G m print this menu5 g4 g) C- [" G/ Q5 p4 N
n add a new partition
, d* @ X, N8 J, Z) N6 q2 u* Z* r% ^ o create a new empty DOS partition table+ |7 m1 O6 S% V
p print the partition table
0 A1 _3 j) ^; X/ L# I* P q quit without saving changes+ V# H A& f. ~# K! `# e
s create a new empty Sun disklabel
6 \3 f1 U# _6 _" M& I) g0 Z ? t change a partition's system id2 G) W, T8 E/ b4 `, f. A
u change display/entry units( l- q% R5 V; V6 B/ `$ @- o' c
v verify the partition table
% a" ?' P; z: e' Q w write table to disk and exit
, _4 a) W( m& B4 r) ~9 l( `0 ~; M x extra functionality (experts only)
" ~' ~) k2 J3 b- @ Q) b Command (m for help): n1 x4 E) ]0 v# C. l! B. G+ H/ o( w0 c
Command action; a2 X, @+ u0 v1 u6 X. G* O
e extended
3 ]& n2 \0 A3 t% ~7 z p primary partition (1-4). o' j& \) u$ ?, ]0 [! h* ?
p
: n [0 n; {" y7 [$ Q) z! ?8 s Partition number (1-4): 1
+ O; `8 @5 p+ m" j First cylinder (1-8322, default 1):
% n/ l: V+ ?0 e9 q2 m Using default value 1
1 ^) g( f! w, C- \ Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
7 t0 S$ J( ^9 Q# W) c" W& h Command (m for help): p" O; H( Q; l+ W' y( J( Z
Disk /dev/hda: 4294 MB, 4294967296 bytes" u" v* F. v: b$ ?# @( {
16 heads, 63 sectors/track, 8322 cylinders) d2 B1 d2 d) }" m5 |' J
Units = cylinders of 1008 * 512 = 516096 bytes
. T) A$ M/ k5 E& s0 R Device Boot Start End Blocks Id System
! ~ a6 d. \8 r# T8 U. Y; m, b /dev/hda1 1 1000 503968+ 83 Linux o1 r# ]5 |( V4 r8 M
Command (m for help): w) E( g# I" w7 H. t
The partition table has been altered!
3 u9 F$ ]1 v# p5 ^ Calling ioctl() to re-read partition table.
5 M- W# w: i% J8 w) p* R# ~ Syncing disks.
7 J- f5 u+ h- k- M5 V //格式化新分区
6 `9 y+ q o7 ^0 o) F) O9 Q! ]mke2fs 1.32 (09-Nov-2002)( V/ H. V" C# [( S1 L/ W3 `6 k
Filesystem label=! s0 y) i( j8 U# ~/ ^7 w
OS type: Linux
' J+ w- b( R# R) n6 j Block size=1024 (log=0)
2 n. `; T9 Y0 z" y5 q/ c Fragment size=1024 (log=0)
/ Y, ?, R$ Q4 U% W; i 126480 inodes, 503968 blocks
6 s5 N+ V+ `5 {* W# z9 K% b& T 25198 blocks (5.00%) reserved for the super user; n1 y( _ Y$ r, h( e$ Z( w ]
First data block=1
, [* v" H z8 i 62 block groups
( |3 i6 X8 w6 N# v- c j 8192 blocks per group, 8192 fragments per group
/ V( |) T% X& [; x( z/ p, V 2040 inodes per group
U) X8 v) J* Y0 _5 o u8 L Superblock backups stored on blocks:
( S+ |: H$ O! E6 r/ J 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409! x% V( j2 {" J! f; s- C! L$ ~% q, _0 ^
Writing inode tables: done . P. `: B' X9 p, w( Z
Creating journal (8192 blocks): done
- N) `& J, l$ p8 s- D( N9 S Writing superblocks and filesystem accounting information: done
+ W) Y1 H# J! L4 l1 w: w This filesystem will be automatically checked every 30 mounts or, G& r0 q, }' Y/ l
180 days, whichever comes first. Use tune2fs -c or -i to override.' b1 P- F! J) J+ X/ ^% O5 P- e
文件系统 1K-块 已用 可用 已用% 挂载点
# `& a, |' ~. E0 g8 Q /dev/sda3 3723848 705992 2828692 20% /2 f# _1 {0 @ M! i
/dev/sda1 101089 9274 86596 10% /boot* P" [' ^' B7 M! ~( J7 X
none 14520 0 14520 0% /dev/shm5 ~6 G; h8 ?( [: e: Q: x3 O
//挂上新分区' ?% a/ F% V$ i$ S; I. R; t; w
- mount /dev/hda1 /home& Y6 Y" l0 z: k2 y$ H
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点2 o% o" ^ F- q* L# m5 P4 {
/dev/sda3 3723848 705992 2828692 20% /" I6 d. \ Y0 T* t( W( N
/dev/sda1 101089 9274 86596 10% /boot9 P& }# z) ~' c
none 14520 0 14520 0% /dev/shm9 k$ p7 `, X3 U* S- V) C4 |
/dev/hda1 488006 8239 454569 2% /home2 g! v) X, W6 C2 }0 W" ?7 S5 l' ?
5 C2 \! i! a9 Y" b) Y$ U9 a
自动挂载:
% f+ B8 @* N: G- vi /etc/fstab
& p- }; Z2 |6 } - ( z5 b# A3 z) a" s+ e
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 06 q) r" E0 |8 J# T0 u
- 5 D/ J" {$ m/ D4 F( @( S& p) R, {
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: t# o0 n$ b5 Z8 L+ W
- mount /dev/sdb5 /mnt/ljp1
& h. L$ A' A" T* x8 ~ - 9 |/ p) f0 w* U: g! b' r
- mount /dev/sdb6 /mnt/ljp2
复制代码 ! Q; i! x' \0 I
* @0 J% g% Z1 X# W1 i, B( u2 E1 H# F' {! p, a. v! d
|
|