|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)/ P# ]- I9 ]4 a) n
or: fdisk /dev/sdc (for the third SCSI disk)
3 p4 J* T- y7 L, _- j0 ? Y or: fdisk /dev/eda (for the first PS/2 ESDI drive)
# c o7 e' {' Z or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)0 N& }8 I3 H s+ P
...
5 ~/ o+ o' F$ _2 W' l9 S5 [- df -k; ^3 k" _7 d) m
- df -lh# [1 [7 I+ Y; _6 M0 X2 V
- 查看有几块硬盘:fdisk -l
; L" O U: E7 K! H: Y" W
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 v6 Z# o) N% \5 I: `& ]0 q$ { /dev/sda3 3723848 705968 2828716 20% /
5 t J [9 o D# S /dev/sda1 101089 9274 86596 10% /boot
7 j) p- c1 J% k6 { none 14520 0 14520 0% /dev/shm, o, N; ~, n5 L- D5 `8 C, ^3 @
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用/ e5 \9 K* N' z5 N1 P0 A
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
; J4 T( c) J E8 o Building a new DOS disklabel. Changes will remain in memory only,- a, I6 Q. D0 X/ V
until you decide to write them. After that, of course, the previous7 S2 i' \( Y$ Q5 s" V" P) K4 q
content won't be recoverable.
7 r; g% N9 ?* A0 J3 B( _3 _ The number of cylinders for this disk is set to 8322.
8 C5 j- I) b+ Z" p There is nothing wrong with that, but this is larger than 1024,2 { \2 L+ Z& N* t, Z3 c! V, s
and could in certain setups cause problems with: i6 F. t8 L. {% A
1) software that runs at boot time (e.g., old versions of LILO)
' z9 {5 Q3 I7 r- q/ K8 D, M. k% Y 2) booting and partitioning software from other OSs( h2 t; z: \& N5 q
(e.g., DOS FDISK, OS/2 FDISK)
s. t# G0 x" b% U+ v9 X Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
7 [* |* [1 T% r9 q3 Y Command (m for help): p3 Y" k( y& [9 T r) u0 C
Disk /dev/hda: 4294 MB, 4294967296 bytes7 ?1 t, i0 D$ P" [# P8 c
16 heads, 63 sectors/track, 8322 cylinders% L1 Q) K+ T+ N9 p$ a2 `
Units = cylinders of 1008 * 512 = 516096 bytes r, B0 S+ v! ~( k9 x
Device Boot Start End Blocks Id System
X. ]( z! S$ Z1 a5 m Command (m for help): m
* U7 ^7 m/ j, [ Command action
% w1 A/ S) ^% z _# Y- l" m a toggle a bootable flag2 ]. m. p4 o, G* V& G# @9 |9 f# e
b edit bsd disklabel
* O: B2 @8 w4 w$ J+ P# l c toggle the dos compatibility flag
$ c5 k2 [& d9 q/ p d delete a partition5 O9 o7 L& P$ ?4 Z5 K' `7 L3 W
l list known partition types
3 H" K- t9 H) u' V$ B m print this menu
" C0 W% c7 O1 V0 n O$ s n add a new partition; p: w. [* M. n2 U
o create a new empty DOS partition table; E/ y$ t! ^; `& E% M
p print the partition table; r+ X( g6 N9 D0 C
q quit without saving changes2 S8 p# h' R1 N
s create a new empty Sun disklabel
* S2 J( C" K. d5 D7 b$ \. E* z t change a partition's system id# a1 a7 p, U# P! S( R
u change display/entry units# Q6 g: @: w+ _9 V1 K9 I9 i$ r T# n
v verify the partition table. [8 m, X: ^0 u. S$ ~
w write table to disk and exit; _2 X* E9 I) P9 q$ O0 x4 c
x extra functionality (experts only)+ O- E4 U5 ^5 ~4 I3 L
Command (m for help): n7 v8 G! E$ x6 Z$ h8 s
Command action
+ u8 m) w2 I$ Z- l e extended
) P8 {/ h z: }' q0 V# C2 X- P; A p primary partition (1-4); v7 F1 p/ q! J9 v
p5 T* \! ]6 s: m
Partition number (1-4): 1- w& r4 |, [- {, S( H% B' o
First cylinder (1-8322, default 1):
6 |: @( j8 D( \" W: P5 w/ s Using default value 1' i1 ]4 U5 P* W, e" H
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G, a2 u$ Y4 H$ w1 h/ a+ A
Command (m for help): p1 s! z. I4 c7 s& H6 x; `
Disk /dev/hda: 4294 MB, 4294967296 bytes! g, h3 c2 X8 V- y
16 heads, 63 sectors/track, 8322 cylinders/ F; k w( Z% V
Units = cylinders of 1008 * 512 = 516096 bytes; L; s6 ~ Q+ {' l" d$ w
Device Boot Start End Blocks Id System
( ?& @. |5 z$ |( A' A2 q /dev/hda1 1 1000 503968+ 83 Linux
# U: s* k* z5 w1 T6 {! F Command (m for help): w
' |6 C" s3 {1 k5 A5 \5 a The partition table has been altered!
/ l3 B9 M2 g# H' D. I4 n* z Calling ioctl() to re-read partition table.0 k5 a! k+ o2 ?' f
Syncing disks.
+ u( ]6 `& M9 t& d7 } //格式化新分区
: j% i5 F }' v: f, nmke2fs 1.32 (09-Nov-2002)6 P& A. }# Q( r/ K3 W5 R0 @
Filesystem label=, v9 L7 J G( |
OS type: Linux
5 @( R. B. u2 ?' R+ J Block size=1024 (log=0); F H5 [" j9 B4 ~- z
Fragment size=1024 (log=0)' E6 U/ j5 {! z+ U$ s2 k" Z
126480 inodes, 503968 blocks
$ N7 _2 \ F9 f9 D 25198 blocks (5.00%) reserved for the super user7 q( G# F% c. M5 B
First data block=13 w2 x4 g& q, w) G5 r2 D
62 block groups) O% M+ d6 X: G9 P6 `
8192 blocks per group, 8192 fragments per group0 M1 d9 v# j$ u5 V5 c
2040 inodes per group
4 x, }9 A" p8 ~/ l& Q4 A5 { Superblock backups stored on blocks:
4 q4 G6 a! `2 W1 a7 |$ [ 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
* x* T. ^, e% Y Writing inode tables: done $ D: r4 `9 P3 c7 V' s0 [
Creating journal (8192 blocks): done% d0 J6 ]: L% v2 y1 a
Writing superblocks and filesystem accounting information: done" B% P* O, m# E' N2 x
This filesystem will be automatically checked every 30 mounts or( i! k9 G; F& Z
180 days, whichever comes first. Use tune2fs -c or -i to override.
6 `1 L5 s1 o m: `文件系统 1K-块 已用 可用 已用% 挂载点
# N9 d9 n/ y0 u* K /dev/sda3 3723848 705992 2828692 20% /5 x; T9 X# V2 x. Q) n0 l
/dev/sda1 101089 9274 86596 10% /boot# w4 c' m9 J+ `' \5 V
none 14520 0 14520 0% /dev/shm
: e# h: _& v S; b" L2 a* g& c* C0 l //挂上新分区9 G3 f7 [& H" u. z1 N) G+ ~
- mount /dev/hda1 /home
' b/ s6 o; `! F - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点+ B8 M- \' Q) S! v$ \ J- p+ p
/dev/sda3 3723848 705992 2828692 20% /- H+ q! H2 g$ R( B+ o/ v* X- f6 G9 ~- t
/dev/sda1 101089 9274 86596 10% /boot
; X! ?6 b& \9 Y* _ none 14520 0 14520 0% /dev/shm
) H0 C$ k! E1 v; t0 M2 d /dev/hda1 488006 8239 454569 2% /home
3 k3 X5 K& I( t o" n$ w& C/ h# s
自动挂载:
# O0 h, n9 i+ S9 d3 V3 |% @- vi /etc/fstab
9 q2 i( s1 m5 J) F v
1 W' `, G6 Q9 N2 T5 Z% H7 ^- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0 H( h h5 I$ R: Q. b
- / T% r5 \5 c D/ z: Z
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
; f) R1 E9 C! ^$ r- mount /dev/sdb5 /mnt/ljp1
- I8 O; W- E2 A( \3 a0 e
, B3 c- q: {/ l4 h# ]- mount /dev/sdb6 /mnt/ljp2
复制代码 v( h# ~3 c3 w$ p- L& [
+ `! y* I% O$ S9 U9 z I! S, ^
2 w$ R8 h! J$ Z7 t |
|