|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)7 b' \/ o$ p+ E$ j t
or: fdisk /dev/sdc (for the third SCSI disk)
1 H# J# ^7 ^6 n5 n2 c, L' ] or: fdisk /dev/eda (for the first PS/2 ESDI drive)
2 Y' v- i; c. i/ D9 |3 s, M& P& j, ~ or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices), P- s! j/ T! ]; d& A9 F: k- j1 B
...) _) Y" d& D. v# W! z" ?
- df -k
4 n" Z9 V) u, l' K# F. N2 Z4 O2 }6 I7 V - df -lh
% R& d4 Y$ y( N7 z) r( U- n - 查看有几块硬盘:fdisk -l
$ e& N, e- K8 G( W; a& O( j; U
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! R0 |3 c) a- D& F /dev/sda3 3723848 705968 2828716 20% / C+ j% x. U3 A2 O7 g8 W) K" k5 o& H
/dev/sda1 101089 9274 86596 10% /boot
+ a3 s$ A2 d! U. J: L# ?1 P none 14520 0 14520 0% /dev/shm+ m1 z4 z9 O7 s/ T
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用: W$ T [, T& ^$ J: P: d
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
/ V5 H3 B6 \( O7 d* T' R$ I Building a new DOS disklabel. Changes will remain in memory only,9 K. f1 G% f2 X
until you decide to write them. After that, of course, the previous
2 M$ V$ f. W$ a0 j content won't be recoverable.+ a' j7 C) X2 l# C7 c+ ]1 {
The number of cylinders for this disk is set to 8322.5 c* c8 T- x" {- R2 y
There is nothing wrong with that, but this is larger than 1024,* E) k. a, Z, t. {
and could in certain setups cause problems with:9 T! J2 G$ ?( _, t- j
1) software that runs at boot time (e.g., old versions of LILO)
# s4 ^9 w* Y. @ 2) booting and partitioning software from other OSs& j6 C T B; A
(e.g., DOS FDISK, OS/2 FDISK) A$ F- F1 F8 K; l6 |; ?4 z
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)& H! {. H9 I! w) ?6 r7 B# J9 Y
Command (m for help): p
/ ~4 M. q* D0 c5 J Disk /dev/hda: 4294 MB, 4294967296 bytes
: t; J% W# j, T9 v- u$ C 16 heads, 63 sectors/track, 8322 cylinders& K; ~ s4 Q; P3 E
Units = cylinders of 1008 * 512 = 516096 bytes7 D) x5 N' A I0 E
Device Boot Start End Blocks Id System
2 |$ F5 m+ b8 ^5 E. {. } Command (m for help): m- [% m* @, e" A b& V
Command action
1 X9 G* B1 o. s; f3 P! i Z( t a toggle a bootable flag
) q4 |% S" e3 o) ~! k m* O: x b edit bsd disklabel
" A2 y4 J- L0 A; C c toggle the dos compatibility flag: y6 h3 e( v! S% x* m# w$ n- O
d delete a partition: V3 W' E& m% \) a
l list known partition types
; \7 o; E' J3 S! c H' o( d m print this menu K+ J. {) }4 T
n add a new partition8 i' Y/ w# g: P5 t2 {; F! R( V
o create a new empty DOS partition table
6 V3 I/ O! A" {& N, x: v p print the partition table* p5 j# ]( x: R, v+ g! K
q quit without saving changes! v& X( A0 A2 X. N$ Q
s create a new empty Sun disklabel; j+ z" |+ {6 f# y* |, q
t change a partition's system id
; s) Z: ^/ H* Y9 P5 \- [ u change display/entry units( k w! y ^- y( H3 _
v verify the partition table
K6 t9 t! t- K7 I w write table to disk and exit
: y: Q8 s% R: f$ [" h% ] x extra functionality (experts only)
& d, \4 m& i1 b$ |) i a Command (m for help): n- A, ]3 T$ p2 M( Y
Command action* }6 z( g6 ?) q( [
e extended* J$ ?& f% ?7 T3 @2 L8 q, N: b; D
p primary partition (1-4)
7 k% L5 H6 D' p/ k# p" h( Q p
/ M- w! m- ?8 U5 Z/ F7 P1 ^ Partition number (1-4): 1! a2 G ^5 F' d' [( c9 K
First cylinder (1-8322, default 1): $ A7 l) y5 W' m
Using default value 1
2 p" E+ l ?- [( V/ ] Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
9 W4 b. s) ~" C& [# N' A Command (m for help): p% k5 t# t k- _' p% U2 @
Disk /dev/hda: 4294 MB, 4294967296 bytes
6 \! C! W+ U3 T5 C% }" X 16 heads, 63 sectors/track, 8322 cylinders
+ b/ g6 @( P" A Units = cylinders of 1008 * 512 = 516096 bytes0 u8 Y* n" Z7 S0 k2 W* g: Q
Device Boot Start End Blocks Id System% s* c/ u2 [8 U8 b- j! S6 e# G7 W
/dev/hda1 1 1000 503968+ 83 Linux1 p2 n* }+ }$ u0 e6 r. F/ V
Command (m for help): w
9 m# n$ \: f i7 }2 | The partition table has been altered!2 k- \) D+ P& P( e, _8 M
Calling ioctl() to re-read partition table.
8 Y" _% ~; M. A% n+ r7 ^ Syncing disks.; E% ^5 l- ]6 F
//格式化新分区' U# X7 ~; W# b( p5 X
mke2fs 1.32 (09-Nov-2002)% v* }% ~ V7 n/ O
Filesystem label=
% L8 O0 M! Q9 q% ]' F6 J OS type: Linux
8 x5 Q6 D2 E x- ~ [ Block size=1024 (log=0)
! S% z x) Q9 C0 x0 H Fragment size=1024 (log=0)
* V8 `9 c8 E m9 N 126480 inodes, 503968 blocks2 N' U9 G: T/ \
25198 blocks (5.00%) reserved for the super user
4 r- _# i' C' s7 E First data block=1
/ k* C' H5 o- R& T; _' o 62 block groups
! F+ s6 v9 w' N" Y! Z( b 8192 blocks per group, 8192 fragments per group# \" S4 ^- F1 [9 v. v( A
2040 inodes per group
) x5 b+ a) m6 _ Superblock backups stored on blocks:
) F) t. A) Y e* ~ 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
* t+ _& D6 r5 X4 n Writing inode tables: done ' k2 W _0 b9 }# V% i
Creating journal (8192 blocks): done" ^, H C! U4 ]$ A2 t+ L- h' ^
Writing superblocks and filesystem accounting information: done
2 B5 @0 U4 [2 q( L4 r7 C: A This filesystem will be automatically checked every 30 mounts or) c9 r1 P8 b: }* B% d
180 days, whichever comes first. Use tune2fs -c or -i to override.
9 E. M& e2 b) a+ y' P文件系统 1K-块 已用 可用 已用% 挂载点+ @% a4 Q/ { G* m% k4 _+ h/ u( D
/dev/sda3 3723848 705992 2828692 20% /9 q6 C) p; c6 z+ G6 E
/dev/sda1 101089 9274 86596 10% /boot. E3 s2 c" O+ Y
none 14520 0 14520 0% /dev/shm
6 _$ N3 Z: s+ Q' i6 o8 U //挂上新分区
! L5 {( ^$ `+ J; J4 o8 q9 J- mount /dev/hda1 /home
' d3 c, X# A- G) M T - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点" M) f4 m% P O+ [
/dev/sda3 3723848 705992 2828692 20% /
! a; k! Q$ y7 A8 \, ?+ n /dev/sda1 101089 9274 86596 10% /boot0 z! G7 }$ l9 b$ N9 u. K
none 14520 0 14520 0% /dev/shm" M; W4 T+ g% t; {; {
/dev/hda1 488006 8239 454569 2% /home$ W7 a+ b e/ A
" m- O4 P R; B/ E% D6 L自动挂载:8 m' b2 l0 K& Z h1 R1 A* t6 w% t
- vi /etc/fstab
) x* \% d1 R( p- g - ) [$ w' l2 @8 ?; ^( L2 c
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
+ |. Y: W1 T+ J/ [+ e* J - ) s) x$ h1 r& ~2 z- n- t. ~
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
! Y1 p8 c6 }0 c" C- mount /dev/sdb5 /mnt/ljp1
( ~3 ~$ B2 f% I3 Y2 Q" f( |
# `& V2 J6 d) R8 M: [" a- mount /dev/sdb6 /mnt/ljp2
复制代码 # O+ j. w# Y1 n7 `. ]% B; r$ B
+ l6 \, U2 H- H7 b5 O/ ^
- a R) \, e/ C |
|