|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
a# Y ^/ r- a p# y or: fdisk /dev/sdc (for the third SCSI disk)
7 ]/ V/ }( r' {: M* u R6 J( T/ @ or: fdisk /dev/eda (for the first PS/2 ESDI drive)2 c% b; b7 x E
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
1 C% a, | b- k* l5 K ...
* X( h% U! o- N. a. j+ |& D- df -k
# M( d% [* V. C4 T4 _4 l3 E - df -lh |1 q4 t" p( l0 z
- 查看有几块硬盘:fdisk -l; @$ H% b+ w t
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
( k4 F7 `$ @! |( ]0 Q- [ /dev/sda3 3723848 705968 2828716 20% /$ b, L( Z, _& X" E
/dev/sda1 101089 9274 86596 10% /boot
# n! W8 C4 [- n' P' c4 }/ ]- F1 | none 14520 0 14520 0% /dev/shm
$ }3 k2 X6 O! u4 g9 J2 r 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
. V6 r% k. b z$ w! p! m! oDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
6 R* K* b# c. C. R6 x+ ? Building a new DOS disklabel. Changes will remain in memory only," [" N* O3 G1 z8 y+ ^- R, \
until you decide to write them. After that, of course, the previous
) n4 t8 R8 V! }, a/ m) A6 h! H7 Q content won't be recoverable., M3 |9 [6 J4 }/ v, t' N( s, j, D
The number of cylinders for this disk is set to 8322.' j# h8 K2 ~) q* R
There is nothing wrong with that, but this is larger than 1024,
, }2 ^- B: v/ S6 F and could in certain setups cause problems with:
5 h5 C; h3 P4 k9 G 1) software that runs at boot time (e.g., old versions of LILO)
5 C, O$ L9 a$ h7 H 2) booting and partitioning software from other OSs) x7 U! Y2 H/ ?' l
(e.g., DOS FDISK, OS/2 FDISK)
E5 {# T4 w G/ C" J5 `$ H" S Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) s: D$ w% W. o+ b% }
Command (m for help): p
$ V+ G$ d' |$ Z: ^3 b) O& F& w Disk /dev/hda: 4294 MB, 4294967296 bytes
' j$ B, \; V% l! K 16 heads, 63 sectors/track, 8322 cylinders+ N9 I2 V4 Y3 Z" U4 L$ x
Units = cylinders of 1008 * 512 = 516096 bytes
8 Y, x; \* F' x" g& p- _ Device Boot Start End Blocks Id System
" i9 X5 B7 [ n( x Command (m for help): m
: k: w7 R3 Q2 K5 X6 l) g Command action
, l/ _- e! }3 O, e$ a" f( h a toggle a bootable flag/ j& L& _3 B6 _4 C- l1 `
b edit bsd disklabel* I' a0 V. r/ W- C
c toggle the dos compatibility flag! Q# N2 |$ r! W, D: o! z
d delete a partition
8 Z+ ~8 q; N$ \7 S3 _& _ l list known partition types% a% x0 Z2 z$ h
m print this menu9 D* F" A6 ]$ X
n add a new partition) s% H4 i6 x* b0 d. C3 g
o create a new empty DOS partition table
0 W8 k2 k. t/ I: G$ D0 |7 r p print the partition table
6 n1 M$ B/ F) a1 e, W3 B) h q quit without saving changes( v& l% n9 D* c) Q( y
s create a new empty Sun disklabel. K( C; p p3 t
t change a partition's system id
' Y! V* g3 ~7 V7 [' ]% q9 d5 C u change display/entry units2 j% K+ X* P: C
v verify the partition table
& l e( P. e! s) S w write table to disk and exit
! ]5 q* k8 R$ C6 x' v2 y; b' Y: m; \ x extra functionality (experts only)
; T1 W9 q; A5 \ Command (m for help): n
0 J/ j3 H' p9 {$ {! h) ^ j Command action/ Z* E1 f! \2 e2 X, j
e extended
+ V7 m5 a# ]) s; r0 h' h( k p primary partition (1-4)
& E, t! h! D f2 O, \ p
% g' D5 M# m7 X$ S$ i& N Partition number (1-4): 1
5 H t. h) `% _ First cylinder (1-8322, default 1): 4 {2 H$ `* g$ F+ R) X* U9 B. E- w
Using default value 13 j& d( z5 S/ ~, l2 D
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
& j# L* T4 L! [ Command (m for help): p" y/ J& s/ e9 S' F; q! z# |
Disk /dev/hda: 4294 MB, 4294967296 bytes' J6 g5 }7 m+ L/ j
16 heads, 63 sectors/track, 8322 cylinders
; n+ t' @2 |/ q8 k Units = cylinders of 1008 * 512 = 516096 bytes
. T. @7 H. D& f; t Device Boot Start End Blocks Id System
, L7 U) q9 t! T* b0 Q+ N /dev/hda1 1 1000 503968+ 83 Linux
: a0 n" U8 e/ a. ^3 {$ Q, d5 n Command (m for help): w; X7 a/ L+ S7 h! r! I; c
The partition table has been altered!, F" Y! h6 H( T
Calling ioctl() to re-read partition table.- M6 _( m7 B- G% R# _2 f! w
Syncing disks.
# l0 `( D9 L( U0 M: m Z1 [8 } //格式化新分区- B7 @& ?* ~4 y( f4 f7 F! K! [
mke2fs 1.32 (09-Nov-2002)
- F2 m* l/ l' i9 I Filesystem label=3 B+ C" n2 m: F( C9 s+ Z
OS type: Linux5 ]3 m5 a" E6 M
Block size=1024 (log=0)
& |. U' Y9 L& S Fragment size=1024 (log=0)
- c% h$ H% R5 A, X% B6 I 126480 inodes, 503968 blocks
. R, U& _) P- l9 a, L4 m 25198 blocks (5.00%) reserved for the super user6 y; ^+ ]/ f& d& f0 w
First data block=1 p3 o) c& w6 h, i; s2 m5 v) r4 b
62 block groups7 a9 W( [4 ~ X; M. m. J, c7 o
8192 blocks per group, 8192 fragments per group. [8 U5 {1 z$ }3 D: O
2040 inodes per group) Y, ]! f, O% ?. J, {- T7 s
Superblock backups stored on blocks: . t: V$ W$ M' Y: q- |
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
9 U- h0 r& [( }+ t, K Writing inode tables: done ' p, i1 p( o L, d* P; ^
Creating journal (8192 blocks): done
4 j$ A: M& q A0 [; x" D/ S Writing superblocks and filesystem accounting information: done+ B) m4 y. T6 _* d" O& b7 C
This filesystem will be automatically checked every 30 mounts or
" [$ K0 |8 K: y2 B+ |: _ 180 days, whichever comes first. Use tune2fs -c or -i to override.; N& q( |. L0 I1 n9 h7 b* L9 H
文件系统 1K-块 已用 可用 已用% 挂载点( _3 r/ v* h* x% o, H z
/dev/sda3 3723848 705992 2828692 20% /
" F- a2 O' z. ^ } /dev/sda1 101089 9274 86596 10% /boot
q8 k. H# Z" Z% m none 14520 0 14520 0% /dev/shm
, z1 S+ ?! w$ j$ Y% P: N& u //挂上新分区
) d! F/ M/ W/ W- E- mount /dev/hda1 /home
" P. y" D) L- N+ ?6 E - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
# c" d4 P: b7 j2 W& L8 [5 R /dev/sda3 3723848 705992 2828692 20% /8 s- z7 W% ?, C7 g& E+ C
/dev/sda1 101089 9274 86596 10% /boot
" G S. J2 \# c. H none 14520 0 14520 0% /dev/shm# X) K2 T. t5 l4 o! ~5 x
/dev/hda1 488006 8239 454569 2% /home
9 P/ U7 b, a( t9 M0 G+ v/ u5 G* l U& K" c
自动挂载:& c9 s6 I/ [/ z3 C1 \
- vi /etc/fstab+ }( e% z% E. S3 x% X
: c' l3 S! B7 E0 o K' S9 M. Z- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 07 e! }0 [5 T& g" n E
- * U8 N9 |( v+ I. s% u9 x. e
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
% P! q, y5 z2 L6 P- mount /dev/sdb5 /mnt/ljp14 G4 O( v1 X D5 {' G
4 z( B. M. o( m5 \# \, ~5 M$ P- mount /dev/sdb6 /mnt/ljp2
复制代码
: ~5 r+ a$ x4 h7 v P: W4 Q7 P( Y" b3 f, _7 o
+ K" b# B+ V' k! c
|
|