|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
- S; D/ I& s+ N9 k& a5 B or: fdisk /dev/sdc (for the third SCSI disk)
& [: t O, O/ |3 a4 i$ m) o1 G or: fdisk /dev/eda (for the first PS/2 ESDI drive)
- N' s+ v6 n7 F8 C! x or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
* J& O# p! l$ }& j; k ...
, y2 O& p+ A6 `7 D; x/ a- df -k- o0 X! y0 h4 m$ C
- df -lh, C4 V& ^5 U, @7 L$ P+ E
- 查看有几块硬盘:fdisk -l8 o8 z) I; [* e. n( A9 N
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点8 m8 u( B# S3 Y( { H1 S7 t
/dev/sda3 3723848 705968 2828716 20% /
+ m4 z: O" m6 R /dev/sda1 101089 9274 86596 10% /boot
7 N: q" ?' P" k/ \ x5 b none 14520 0 14520 0% /dev/shm! y% ~0 b) O' h) O; t [
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用' k( X* Y6 G% O& _" u' b# P
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
4 X+ { ?: ?! D: V* d Building a new DOS disklabel. Changes will remain in memory only,* j! J' F$ g* t- X l9 }
until you decide to write them. After that, of course, the previous
" F0 ` o8 i+ O6 |; \ content won't be recoverable.
: V* J( `9 M; r9 E" G The number of cylinders for this disk is set to 8322.
' a% V$ T5 h& g! G ^ There is nothing wrong with that, but this is larger than 1024,
" a( E% g; |' S5 f; F and could in certain setups cause problems with:
# m0 e8 B% S6 n1 ]; D' O- I* O 1) software that runs at boot time (e.g., old versions of LILO)4 m" \3 h+ j' J: y1 G: W
2) booting and partitioning software from other OSs
: Q, W; p% f9 K% ?1 E (e.g., DOS FDISK, OS/2 FDISK)
. f) _" N1 s& e$ E' Y Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)' h; Z4 P: q1 @1 z+ j, T
Command (m for help): p0 E# o4 v# W& M$ N' ?/ O
Disk /dev/hda: 4294 MB, 4294967296 bytes$ t/ V7 Q1 t# H4 o1 u5 E% q9 g: N
16 heads, 63 sectors/track, 8322 cylinders
, ?& b! M9 }( W2 g! C Units = cylinders of 1008 * 512 = 516096 bytes# H Z! f# P- G5 V4 U$ X
Device Boot Start End Blocks Id System
A- t: ^: e2 j" T r6 B1 C! y4 i Command (m for help): m. n2 ]/ w) G7 `/ J0 k$ C" ?( ?# D
Command action) X Y4 {5 S, C' Z5 d, w6 W
a toggle a bootable flag
/ R2 V- o; [% { b edit bsd disklabel
, P% v6 R7 L, ]' X. D& i: y c toggle the dos compatibility flag
. r) a2 g$ U0 M$ ]) d d delete a partition
$ o& Q7 Q5 K% {% B; _. B l list known partition types- L) i. ~$ r! ]9 c, B* @5 V
m print this menu% k2 x) b' r$ Q% n9 g& w9 T
n add a new partition
& \0 O# i, k/ m' [+ g8 ^( w$ c o create a new empty DOS partition table+ y( t0 {1 Y6 P$ M
p print the partition table5 P9 Q6 `9 [& A" B
q quit without saving changes- D% t7 {. @. R8 r/ S; r% f- ?
s create a new empty Sun disklabel( v- o/ R5 @) g0 a' r. w
t change a partition's system id+ |% x) s0 d( s! k$ E! }3 w
u change display/entry units
' @% I2 u. d+ c! z v verify the partition table
; j# X' s( a/ x. \ w write table to disk and exit* V2 C( o5 H' W% }( m
x extra functionality (experts only)
F! x3 {5 p4 `* K$ M3 K! u Command (m for help): n6 v" _9 S& H2 F! p
Command action
5 J0 D5 c; ^ B e extended
# E1 c! I' `- u2 V p primary partition (1-4)1 h; c% h7 W2 z- j: B' c
p
* _, ?5 N: B2 ?* a$ T% e$ ` Partition number (1-4): 1- a, [% g2 m) J9 L4 Z, l$ R
First cylinder (1-8322, default 1):
; P& l0 x* x% x Using default value 1
4 d- @3 k& Z' x. o3 @ Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
: g0 |5 s9 j0 d2 q0 ? Command (m for help): p
0 ]- m2 g+ x7 b& J& P# H Disk /dev/hda: 4294 MB, 4294967296 bytes+ I2 S& H6 \! V6 e, g- e
16 heads, 63 sectors/track, 8322 cylinders
6 d& k U2 V8 k6 x Units = cylinders of 1008 * 512 = 516096 bytes5 q* ~ `) L$ d- y x9 |* ?) v
Device Boot Start End Blocks Id System
! Y. R) c% ~' G$ }% I /dev/hda1 1 1000 503968+ 83 Linux
1 T6 r+ ], k7 M V1 q3 ]8 R Command (m for help): w2 _1 M" j- t" L- P+ K% b" r
The partition table has been altered!
0 d" E/ i, m6 C/ ^ H) ]9 P Calling ioctl() to re-read partition table.
0 c. O1 ?0 K' O( F Syncing disks.
3 [0 N. d5 r; l //格式化新分区8 m4 U- `9 H" D. K/ V4 [1 d0 j
mke2fs 1.32 (09-Nov-2002)& \% `6 y* }+ n
Filesystem label=/ h2 k" @7 r( s0 J1 I' O
OS type: Linux4 e& g( ~% |4 ~$ ^2 j
Block size=1024 (log=0)3 W* R1 o% Q8 w# k; y$ t
Fragment size=1024 (log=0): v3 ]0 u- z8 Y+ ~- N
126480 inodes, 503968 blocks4 W; P& s& n1 q# q5 i
25198 blocks (5.00%) reserved for the super user2 k$ @ w+ H* V1 h N+ V
First data block=1$ ]: G5 [; D# X- A- k+ i
62 block groups
4 L) k5 }/ U/ Z( { 8192 blocks per group, 8192 fragments per group7 M4 x3 `0 \. B$ |, l
2040 inodes per group4 _, X" ?( N9 }
Superblock backups stored on blocks:
/ j3 A$ N4 x" u8 M; m6 q 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409: F0 H1 E0 R% W K
Writing inode tables: done
1 D x1 v7 ^4 W Creating journal (8192 blocks): done2 k; ?/ j3 N2 J! [# v/ u1 E8 Z2 I( _/ ]
Writing superblocks and filesystem accounting information: done
5 d8 x, u- P" [' G, C: u. S This filesystem will be automatically checked every 30 mounts or" U! I. ^0 P1 \6 H
180 days, whichever comes first. Use tune2fs -c or -i to override.5 C, Z! K4 w+ _$ x
文件系统 1K-块 已用 可用 已用% 挂载点
6 m( N6 u9 ]$ U. f- t6 P /dev/sda3 3723848 705992 2828692 20% /
L8 e; G m8 h2 z3 D" K /dev/sda1 101089 9274 86596 10% /boot
8 n/ L/ D* s9 u/ M& e: { none 14520 0 14520 0% /dev/shm; p9 F* q4 c8 m: ]
//挂上新分区 n3 `3 W/ d/ K9 `
- mount /dev/hda1 /home+ k: U" K. S8 Y) t8 g& `
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
% B% T2 y3 i! }+ F; ~3 x: ?! j4 f9 e /dev/sda3 3723848 705992 2828692 20% /
" h% D- t$ b5 d /dev/sda1 101089 9274 86596 10% /boot6 h9 X. `/ m5 f# a6 F
none 14520 0 14520 0% /dev/shm
1 `+ m2 z# r7 I4 a& c# p s r /dev/hda1 488006 8239 454569 2% /home- S, a7 ? j& f
! m7 W# y8 s& m. e
自动挂载:
7 E% g# F% M& Q( q% h3 ]) I( k- vi /etc/fstab" e4 U0 T9 e; a( O1 m. Q- ^8 C
- 5 E0 z( x) d4 C
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
& D* w, E! S) }9 L7 f) X+ N - 0 f+ q) z! ]" K2 j. X
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
& s" J; i- `5 }" U- mount /dev/sdb5 /mnt/ljp1- [5 h0 k! \3 ]
$ f( i" Z; B( Q. _! p9 x1 F2 l- mount /dev/sdb6 /mnt/ljp2
复制代码 6 S' t# [1 X4 q/ G
8 T7 }8 r- y0 A( G4 b
% p- _6 U, N# I" b i8 x
|
|