|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
" d o/ p7 _+ p: a- V" G4 A+ g or: fdisk /dev/sdc (for the third SCSI disk)/ j2 A7 n* H+ F( \; ?: k
or: fdisk /dev/eda (for the first PS/2 ESDI drive)- R; r9 ~- F) v) a
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
( [5 b- C7 I' e" _* j ...
$ P1 C. {9 R0 E. ^- df -k) _3 |( B: P; g
- df -lh& z7 B. w1 w% L# p, ~( G% ]# z
- 查看有几块硬盘:fdisk -l
3 |# E4 e( T2 V4 r$ h. Y
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点6 Q& L! z' w& U
/dev/sda3 3723848 705968 2828716 20% /
/ K! k1 s- P# x) K+ N /dev/sda1 101089 9274 86596 10% /boot
" _3 J' {9 o- j9 K. g none 14520 0 14520 0% /dev/shm
2 ]6 y- S4 F, b- y3 s 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用; `, W% y0 U( B6 ]5 w
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel0 z% e& \& K7 [/ X* k! N1 U8 v
Building a new DOS disklabel. Changes will remain in memory only,
" P" c+ o, N1 @9 ^8 e- i( i until you decide to write them. After that, of course, the previous
" A0 o6 Z5 c) ? content won't be recoverable.
" C" @* H) y9 y; a' i, }+ X& g The number of cylinders for this disk is set to 8322.' {# ]4 l% {/ I. }5 e A/ `) R
There is nothing wrong with that, but this is larger than 1024,/ W1 H* Z$ A+ r* e
and could in certain setups cause problems with:: K; [# j+ A% z4 B" r
1) software that runs at boot time (e.g., old versions of LILO)
M7 d" [$ h7 U$ J 2) booting and partitioning software from other OSs" }; a! \- ]4 y- P9 a% ?2 S i
(e.g., DOS FDISK, OS/2 FDISK)
! H( p! f3 {! G! h K% N0 {' D. H0 m Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite), P9 E* s. i X
Command (m for help): p; u& @5 m' _3 Y$ X8 F( g
Disk /dev/hda: 4294 MB, 4294967296 bytes
/ b4 H! J7 U2 J6 S 16 heads, 63 sectors/track, 8322 cylinders
% z( P8 b5 d! M7 \) w Units = cylinders of 1008 * 512 = 516096 bytes
/ S6 U a5 C8 \5 T4 C. v! o Device Boot Start End Blocks Id System
8 G/ g* f( d& K( o2 _4 \ Command (m for help): m
* v7 b2 W+ h6 f8 d! | Command action6 H4 l2 x) w- h" s- u8 O: [2 f4 L
a toggle a bootable flag
, u% W7 g/ F' r- S b edit bsd disklabel6 K w, O* J x# _
c toggle the dos compatibility flag) a# Q; S8 j' \0 A
d delete a partition
$ s8 V* w7 q9 i+ Q l list known partition types/ o# \4 I, f' A+ C7 @6 E
m print this menu9 x- s. V g! g, G
n add a new partition
5 H/ o( w$ i. t* C o create a new empty DOS partition table, V8 D4 k/ b+ V9 z% h/ R+ L# T4 @" ~$ J
p print the partition table
E- [: {! n2 Z1 e8 M3 X, @ q quit without saving changes: a% s- h+ t6 j( q4 R; f0 j% A9 _( g
s create a new empty Sun disklabel4 T7 o' a6 V5 S5 p7 x: V
t change a partition's system id" M4 C$ d @4 W1 @0 c" t% Q
u change display/entry units
9 |% j; q; u+ C v verify the partition table
5 I# S. I" Y: g6 Z w write table to disk and exit
5 z6 t8 B9 r$ ]# s4 x8 D x extra functionality (experts only)# _5 i# J0 p" m# A" R
Command (m for help): n
" P& O1 V7 f9 \( H |6 [0 i Command action+ x$ J$ k. C2 K+ U9 A# k$ e; u
e extended, E$ @. D! R5 c+ o
p primary partition (1-4)
+ |# {( J8 @6 K/ r! L# l p
* h1 ^/ C8 X+ n1 J) P Partition number (1-4): 11 N/ w. P/ m3 h
First cylinder (1-8322, default 1): d; b# s8 P7 _8 |
Using default value 1
7 [: b4 h$ Y3 y9 L( d' b; y* F; J/ M Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
; D1 E2 Z& m5 A' g8 O' S Command (m for help): p
. W: w0 I) B% h7 y Disk /dev/hda: 4294 MB, 4294967296 bytes
- a j5 j2 y3 Z* ^ 16 heads, 63 sectors/track, 8322 cylinders' l5 _* i) N7 S( Q; M6 w1 ` K
Units = cylinders of 1008 * 512 = 516096 bytes
: q2 j, R- l0 M Device Boot Start End Blocks Id System
+ W& g; f) b% j2 Q /dev/hda1 1 1000 503968+ 83 Linux
# w/ x1 e& Y' o7 h Y: s3 o( T Command (m for help): w* E5 A2 b8 J: E5 s5 _$ G$ C& x
The partition table has been altered!
Q7 P6 c4 p4 F8 R- d0 s6 l. W Calling ioctl() to re-read partition table.
+ C3 s- E3 S7 N# t Syncing disks.9 @& h5 v9 b- Q. D
//格式化新分区: B) t! f/ G- w. R) |: u
mke2fs 1.32 (09-Nov-2002)
7 i- [9 c/ E6 U0 a+ v5 Q" {& _ Filesystem label=6 X; n2 G0 l2 h& s* E& o4 c- a- B2 u4 q
OS type: Linux
4 j! X7 s: E6 v9 v" x- t( a Block size=1024 (log=0)% I" l# X' ~ q
Fragment size=1024 (log=0)
- s6 i2 g3 Q6 |4 S 126480 inodes, 503968 blocks
0 E( l% N( P* H7 m- q' }, r# s; m 25198 blocks (5.00%) reserved for the super user+ }9 |; [0 L6 V: E p [3 m
First data block=1
- {1 G+ a) R( F8 m3 M; r0 U B 62 block groups
8 }+ x( d) i: K; M: n- _ 8192 blocks per group, 8192 fragments per group1 e! }8 w: c0 B1 X/ u% }
2040 inodes per group
% |9 Q& l/ ?7 ~( }6 f Superblock backups stored on blocks:
g; _8 T- p# Q$ n$ B. ], _. T 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409& q& S. M! y+ P8 b. n% w
Writing inode tables: done
$ S0 I# ]- s7 H1 G Creating journal (8192 blocks): done! ^- K* y8 K B) i7 W$ M+ V4 v o
Writing superblocks and filesystem accounting information: done/ x+ T. z: Q1 E1 A6 V8 Z
This filesystem will be automatically checked every 30 mounts or+ R7 u0 i2 r8 U# m# V5 w0 c5 e
180 days, whichever comes first. Use tune2fs -c or -i to override.
, v5 y8 l5 D% u; E" }文件系统 1K-块 已用 可用 已用% 挂载点+ C$ k: q" m& S$ Q
/dev/sda3 3723848 705992 2828692 20% /& p: e+ n& |9 O9 m. k/ H! M1 [
/dev/sda1 101089 9274 86596 10% /boot
* P+ Q( t W5 v6 |/ @" n8 i none 14520 0 14520 0% /dev/shm" l5 D! E7 n2 S* v
//挂上新分区
$ v, v9 U( Z; h/ z7 x- `1 R- mount /dev/hda1 /home
7 }# v6 [. R3 \8 s# j, R$ J* U - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点* F" O) V# I, Z2 F$ ?
/dev/sda3 3723848 705992 2828692 20% /8 ^9 i# e( I. P4 I
/dev/sda1 101089 9274 86596 10% /boot
0 f0 l8 C- ?+ U$ t6 \4 w/ Y none 14520 0 14520 0% /dev/shm
! v7 B. R% Z. B, x$ H. i4 T. V /dev/hda1 488006 8239 454569 2% /home
' I" N# P: A5 z! {* r& y, l$ c
1 R8 s7 z& y) b自动挂载:, E, L( d9 F" V) C* u j" h
- vi /etc/fstab
6 b$ G: H* ?, j
( N# T1 u+ c( L* q' L- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0# @0 U5 q7 V( B6 M+ s/ [9 X
- & @- r8 j) Z' Y4 P% D
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:0 R7 Z; Y5 N! p5 Y6 t. D- u9 y
- mount /dev/sdb5 /mnt/ljp1, U& j5 T: W% N( f5 l
. a, H4 F7 i" E1 A7 V- I0 [9 n0 Y- mount /dev/sdb6 /mnt/ljp2
复制代码 9 f! @& r6 c8 k& k
( R6 f L- Z7 T$ X5 A
' |0 B; q2 k! R |
|