|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
Q" t* t2 u6 t2 p or: fdisk /dev/sdc (for the third SCSI disk)
0 h/ t; o1 w/ F* M! F* P9 U or: fdisk /dev/eda (for the first PS/2 ESDI drive)
8 q" u) y% G+ G5 y3 D8 R0 B or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
8 Q8 j2 G) R c! F6 e/ |3 ` ...- K2 k0 ?1 S3 ^4 S/ d7 [ N
- df -k+ } x* S0 P& R4 I3 E5 ^1 W
- df -lh( W3 q$ K, C; J
- 查看有几块硬盘:fdisk -l# Q( {8 j4 W; [( h9 j6 v' V
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
1 x1 u% ]0 t+ k# E/ B! T2 c1 @ /dev/sda3 3723848 705968 2828716 20% /
% N2 o# S) m3 V+ X* ?, A /dev/sda1 101089 9274 86596 10% /boot
+ x* h" | `' f4 y- [7 [# m/ @: n none 14520 0 14520 0% /dev/shm' L( t4 k' D% y, ^2 d8 c6 I
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
6 w$ s: P7 m3 S! t* b5 KDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
! W$ U% g3 o _% s2 F Building a new DOS disklabel. Changes will remain in memory only,6 O# b: h9 z, v1 i9 M5 X% u) p" P
until you decide to write them. After that, of course, the previous( p" U5 k; l3 p1 j
content won't be recoverable.
7 R; W( ^5 i+ B. T+ a& W The number of cylinders for this disk is set to 8322.2 ^5 d# i* n2 L1 H
There is nothing wrong with that, but this is larger than 1024,
: g. @5 m6 p) H and could in certain setups cause problems with:( [- |+ Z( R( e9 f
1) software that runs at boot time (e.g., old versions of LILO)
' V2 Z2 t5 K9 E* d+ t 2) booting and partitioning software from other OSs
: x) U$ C2 y. [+ V (e.g., DOS FDISK, OS/2 FDISK)
' V7 p+ Q/ A* Z/ x# M# J Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)$ H" P1 ?9 E# ^8 `4 ]
Command (m for help): p
5 U, N2 H0 @0 L4 C$ y2 e Disk /dev/hda: 4294 MB, 4294967296 bytes, E6 t' B3 _4 d+ g& J# ?% }/ S
16 heads, 63 sectors/track, 8322 cylinders
" g: ?" o0 o3 V2 S) H+ p Units = cylinders of 1008 * 512 = 516096 bytes& c+ K% H) M$ h- F; H
Device Boot Start End Blocks Id System
) k& @! ?# D! I* s Command (m for help): m" n: d0 q K T4 d: A" K+ \9 j
Command action
% \+ j6 T; F. t1 h* }0 x a toggle a bootable flag
, m; t u+ `" Q' R) U* w' y b edit bsd disklabel
5 ^8 y6 C9 U6 Q+ w- ~! k" N0 F8 c c toggle the dos compatibility flag
0 x, m) A4 n* u; M! J/ |" z6 l d delete a partition
! M2 n) A/ [& i l list known partition types! F" a0 M3 z. ?- C
m print this menu
& I2 M0 c& H' {" D3 S7 k n add a new partition
8 ]. f, }$ h+ N# c5 z/ c8 |3 y; `1 b o create a new empty DOS partition table; K4 v# t$ I6 I$ Q# q: N+ L, c
p print the partition table
0 B- j) P3 ~" R; f* Z, p" z q quit without saving changes% \5 W C* J7 W. G/ c, c3 s
s create a new empty Sun disklabel
. y$ H9 }) @) L/ z$ F& M t change a partition's system id
. w# v+ b( h/ z6 u& j2 ? u change display/entry units1 ~) N2 ~* A+ w/ x: `/ o
v verify the partition table
7 l# e6 i* L& ]1 Y& B P+ m6 D w write table to disk and exit9 o3 h# t& F) z$ u( [5 q& W; b
x extra functionality (experts only)
& @( G& B Y1 y6 Z Command (m for help): n
# X5 j4 ^5 T' v4 F2 r4 c0 H U Command action
5 \% I2 |( C0 \& m9 Z) @( P e extended
! H% X" [+ p3 H8 ?, U4 A" ^ p primary partition (1-4)
; [ k- x0 P! |# l5 R) } p' |0 E$ A: `0 ~& r) h" _
Partition number (1-4): 1
( J$ c& J- q' u" `& o8 t8 A' C# j# d/ D First cylinder (1-8322, default 1): 0 S" \& ?( ] C* J6 p+ b
Using default value 1
+ \, E$ x y; g5 C, _) b3 e9 T, E* ~, V Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G/ X# d' P' n/ Z1 L: _1 v
Command (m for help): p+ I# Q, z7 C$ W b, r" N+ m$ o
Disk /dev/hda: 4294 MB, 4294967296 bytes
?, E4 }7 P: K, \' V& G/ B* J 16 heads, 63 sectors/track, 8322 cylinders
+ T& c. d% J! _! x/ O' X Units = cylinders of 1008 * 512 = 516096 bytes; x( @6 r2 W7 C0 Y6 \/ r* [' [
Device Boot Start End Blocks Id System6 m, r" C# z- i
/dev/hda1 1 1000 503968+ 83 Linux
( |; S e. t' X" M Command (m for help): w
- p% W( c# w" ?1 r1 }. g The partition table has been altered!
; j! t. c, T% r* O1 L Calling ioctl() to re-read partition table.# D6 g% m; h$ D4 j" K: D! b
Syncing disks.+ I k" _$ L7 ^+ c* b
//格式化新分区
7 p% I8 P/ H6 cmke2fs 1.32 (09-Nov-2002)
5 [" k1 x; T* Y Filesystem label=
$ q2 f! s* v* g7 q- Y OS type: Linux5 D3 j0 ^0 p( S6 B0 B2 o) u& n8 t
Block size=1024 (log=0)7 M# n3 R. c$ ^
Fragment size=1024 (log=0)
% e; F6 `6 s, q. ] 126480 inodes, 503968 blocks
( h5 C+ s# N# w6 y0 P( N 25198 blocks (5.00%) reserved for the super user; j/ V. G) b) S9 n6 R
First data block=16 {# b" Q9 E. |8 M9 E) n
62 block groups3 J3 l ~: D; L: o" Q$ B
8192 blocks per group, 8192 fragments per group
6 }3 v* P( D& q 2040 inodes per group
E% |& Y( q" J" Q- @. h Superblock backups stored on blocks: . I# q$ c! o" Y! f
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
( c e. B- k; K6 v- V# s Writing inode tables: done
, O6 O* P8 i# H Creating journal (8192 blocks): done3 O' ^1 s; S3 d3 j% ]: \
Writing superblocks and filesystem accounting information: done% w1 r+ b! U& [" w) Y
This filesystem will be automatically checked every 30 mounts or
( l v2 x! j: i& j 180 days, whichever comes first. Use tune2fs -c or -i to override.
9 t5 O0 v( e2 ?) l文件系统 1K-块 已用 可用 已用% 挂载点
- S N8 j/ O I& ` /dev/sda3 3723848 705992 2828692 20% /
( |1 m$ S) ]& X, E( s& j3 ]& M /dev/sda1 101089 9274 86596 10% /boot7 g# Q( a1 ^- V
none 14520 0 14520 0% /dev/shm+ Y- ?! t; _/ W4 ?, a6 r
//挂上新分区4 ~6 L0 J. ?' {) l# @( @
- mount /dev/hda1 /home
! |" |" y7 w& ~0 y - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点' P9 t- y4 {$ ^
/dev/sda3 3723848 705992 2828692 20% /* P4 n5 s0 r3 [( T
/dev/sda1 101089 9274 86596 10% /boot& `# _: q% ^5 ?" g
none 14520 0 14520 0% /dev/shm* i% A" F4 z, ~8 t
/dev/hda1 488006 8239 454569 2% /home
9 J- X& }: `' y/ \1 X# A" z6 \- T: t3 A2 c# E X/ I
自动挂载:
% c0 K3 W& E' B2 M$ M- vi /etc/fstab5 ?. U2 g4 |- a/ t( R, {
- $ S; ?' Z* [# T9 x: x
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0: a+ P: s& r; g3 p+ b7 h1 j3 V
- C* K0 y! I1 ]0 \7 h- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
* C0 m* V8 L7 ~' |& E; \8 e- ?6 l- mount /dev/sdb5 /mnt/ljp1
* s# y) M- o7 J, O. L
6 N% P9 W! h* S, L- mount /dev/sdb6 /mnt/ljp2
复制代码
! p9 V6 b9 o0 a# V+ O6 I/ R( e6 d) O/ g3 w! r) N, Q' m( R) c
/ `. ^# n5 `: R6 o; C% o |
|