|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)7 N/ a* V+ \5 Y4 n7 q1 P) a' X) K
or: fdisk /dev/sdc (for the third SCSI disk)7 h' u8 R. c A1 o
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
5 n0 t4 a B+ ^9 f or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)9 P$ a3 j6 \" `
..." W( B7 P0 ] y+ ?5 F
- df -k9 S$ E" U m4 S9 F& z
- df -lh
" B( Q$ {' |. y+ g- _/ Q5 Z - 查看有几块硬盘:fdisk -l5 @5 M1 G2 ^9 I A3 X) \
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
. d3 Y: w0 P( @ /dev/sda3 3723848 705968 2828716 20% /; F$ X, _$ Y6 u9 r- a) ]" V
/dev/sda1 101089 9274 86596 10% /boot. w4 F0 T0 H. b1 H4 U4 h, w
none 14520 0 14520 0% /dev/shm& C' k! {; I9 m1 Y& T$ {
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用& ?$ A" I" ]- [2 C
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel4 ]* A& O/ |% V, W3 o( a! S# }
Building a new DOS disklabel. Changes will remain in memory only,
1 E& Q9 ]. J; V+ q9 y+ X% L7 q& K until you decide to write them. After that, of course, the previous9 S6 o0 `( ~% }
content won't be recoverable.$ J5 F/ ]$ S' ~: A, `# ?2 Z" H
The number of cylinders for this disk is set to 8322.
( ]; l' X+ ~' A6 ?( R0 V1 Z" d There is nothing wrong with that, but this is larger than 1024,$ b, q F2 L Q" h6 h
and could in certain setups cause problems with:
8 b3 {3 F5 l5 h t' G! l 1) software that runs at boot time (e.g., old versions of LILO)
, {9 C% J9 T4 O( @; c 2) booting and partitioning software from other OSs
8 J) O" q- `1 `0 F (e.g., DOS FDISK, OS/2 FDISK)
: m! w/ j0 p' _# u7 p Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
9 |1 x3 P4 J; p' |( p Command (m for help): p# a3 b, G5 K' Y" u
Disk /dev/hda: 4294 MB, 4294967296 bytes) E h2 e; M) J8 _
16 heads, 63 sectors/track, 8322 cylinders5 L* g1 F4 T9 l5 h
Units = cylinders of 1008 * 512 = 516096 bytes
* A. A5 a; l4 G( r, f Device Boot Start End Blocks Id System7 u3 S% K& B+ B" Q2 E
Command (m for help): m
, _: D1 Y# X& y1 N1 o Command action
. i0 O3 i: l* _' e a toggle a bootable flag' v L: Y" C- i
b edit bsd disklabel: o" C# P2 Q5 _- v! q
c toggle the dos compatibility flag+ j1 M! K/ }# c, N2 l$ ^6 Z2 _
d delete a partition/ H: J4 {4 g H8 v6 F) @# m3 G
l list known partition types
, |# Z3 y! b& `" Y6 ]! F m print this menu$ p( t& P6 a. v6 K- M- |& \$ |
n add a new partition
) e$ \9 y8 s* _: O ?, l o create a new empty DOS partition table7 O4 h; z R0 ~' G8 I' [
p print the partition table
$ `4 q. o" E, ]" H/ k q quit without saving changes
$ n( b! ?! j4 N8 G& x& z s create a new empty Sun disklabel
b( |, t0 P d) Y6 Y1 i t change a partition's system id
( D8 ~7 Q6 @. z% U' P u change display/entry units
3 h5 y3 {% ]/ c" k3 y v verify the partition table5 |/ o2 }5 D/ t( u4 w7 N2 ?
w write table to disk and exit
" S1 R! z* {5 y+ q x extra functionality (experts only)% f) `% v' A8 g l0 _6 l
Command (m for help): n
- E# [! b6 R* y6 C( h: s- S Command action% r; o* w1 y4 a7 ?1 q0 J& ?
e extended
, G6 t7 U. z# A0 O p primary partition (1-4)/ d( R+ V/ u' ^$ l/ y/ E
p& N( ~3 ^3 U5 Z( _% c+ k& W+ o+ f
Partition number (1-4): 1
0 w# G: e9 H5 @* A9 R' L0 f- a! z First cylinder (1-8322, default 1): ( q+ G. g+ R! U2 C
Using default value 1
4 Z+ E+ ^8 t$ d8 b Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G: S6 H+ `, b% g2 C1 m
Command (m for help): p5 p/ ]0 p+ t- ?2 Q# ^0 s
Disk /dev/hda: 4294 MB, 4294967296 bytes O) _# e. ^, G2 q3 D
16 heads, 63 sectors/track, 8322 cylinders
. {1 C7 S% T: F; r! F Units = cylinders of 1008 * 512 = 516096 bytes
, Q& [: j, O: C) x( }' H Device Boot Start End Blocks Id System
; ~7 O/ Z# S9 L* Z& V+ o /dev/hda1 1 1000 503968+ 83 Linux" D; m+ Y1 J- W% R+ d, H
Command (m for help): w" m; n0 o4 q" R: ?
The partition table has been altered!2 ^1 O; s* i) L8 M0 O
Calling ioctl() to re-read partition table.# Z, O J1 e; P. |) j. G
Syncing disks.3 Q) x+ g+ X: d5 t [$ @0 W
//格式化新分区
M. j9 _; E: h5 d2 Vmke2fs 1.32 (09-Nov-2002)
; R# L" O& Z2 d# Z9 `2 y Filesystem label=4 S: e) O- A( R! E+ y5 u! C5 H* t
OS type: Linux
1 U1 H% b( W5 R, ]* _ Block size=1024 (log=0) C, Y9 c! P8 x4 k: n
Fragment size=1024 (log=0)
& j( m! k$ i1 o Z 126480 inodes, 503968 blocks4 ^0 V. K" u! O
25198 blocks (5.00%) reserved for the super user
) ]% V5 p, H; e5 K/ b8 e0 s# Y First data block=1
& w M2 `4 {' o5 K0 O0 J 62 block groups
3 v3 L' D9 v& [6 L5 S 8192 blocks per group, 8192 fragments per group0 P8 `; O, K3 g& t6 r
2040 inodes per group
" K- s6 p' ]1 B/ D Superblock backups stored on blocks:
# I; G2 ?# O# _; g" C7 X 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
$ l6 g, o0 m3 v+ C9 g9 G Writing inode tables: done
3 i) v. _ f# g( p8 {6 F Creating journal (8192 blocks): done
" ] P& j7 v% j. } Writing superblocks and filesystem accounting information: done; t. Q+ I0 m& q) D4 }
This filesystem will be automatically checked every 30 mounts or5 V& q$ u* p- L4 g
180 days, whichever comes first. Use tune2fs -c or -i to override.
5 A8 \' E3 r9 V; O. E2 l+ ~& R文件系统 1K-块 已用 可用 已用% 挂载点+ q! Q) X, I, k2 X( a
/dev/sda3 3723848 705992 2828692 20% /
j: \" Q8 \& M1 Y. K, Y /dev/sda1 101089 9274 86596 10% /boot
8 i" F1 l4 ~ V) [3 s7 ~ none 14520 0 14520 0% /dev/shm
& L/ e% @7 T) Y0 ` //挂上新分区
/ \+ z6 y. c4 P T3 [- mount /dev/hda1 /home
" ?5 Y+ |( V! b4 A b+ I& w - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
7 ?/ @* F6 {1 z i, r% f /dev/sda3 3723848 705992 2828692 20% /3 L! X s `5 G' H0 Q8 r3 n! q. L' t
/dev/sda1 101089 9274 86596 10% /boot
! p+ j7 S0 r9 B% V: ` none 14520 0 14520 0% /dev/shm8 _3 u! K' Q3 i% I B9 u$ s6 A
/dev/hda1 488006 8239 454569 2% /home; M! ]* Q4 Y4 y2 D: ^5 B6 r: Z0 i
1 ]! O+ c1 ]0 E2 t- g* n( {* o
自动挂载:
' p4 x# m/ f3 M9 M( J- vi /etc/fstab
6 T$ ]: U! E* @; c2 U3 x8 l: y
) a# x2 U' Z/ D# r' r$ l' c5 e- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
( m, C! V& N3 b6 b8 m6 h1 L+ t9 _8 L7 J
$ d( W7 v- t" k' i- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:6 |/ v4 @8 O0 Z" F0 `
- mount /dev/sdb5 /mnt/ljp12 j1 |# h- I1 p" r8 ~# l+ F
; c9 H0 Z# W( g% Q- mount /dev/sdb6 /mnt/ljp2
复制代码
2 E6 N4 Q6 ~/ \% j7 o& a- {( k1 \3 Y8 @. J' f- ~6 ~. u _7 ?* \; z
2 j1 p: D+ B0 s9 d6 G |
|