|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)6 X, f5 l8 _1 \
or: fdisk /dev/sdc (for the third SCSI disk)
q. G- X2 D r5 z9 ~ or: fdisk /dev/eda (for the first PS/2 ESDI drive)! @' B- f# f9 X( w0 m* X
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices) u% W8 Q. W6 I% K' i
...
0 y) g4 C/ ]4 E5 ~/ D$ y0 P- df -k
: r2 L3 \" c: x* f% ` - df -lh
& Z9 q( N3 W* q( ]0 E* {2 n - 查看有几块硬盘:fdisk -l
8 a& V4 J0 Z, i( R" t6 ^2 {
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点6 a; n$ z6 m' ^2 Z0 E- k; X6 l! R
/dev/sda3 3723848 705968 2828716 20% /+ ~$ r+ f9 v) \$ O# V: I2 U1 E: H
/dev/sda1 101089 9274 86596 10% /boot% v/ A/ q% C1 P- y9 y# r
none 14520 0 14520 0% /dev/shm
- ]& z2 V; I. Z 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
' M* T: y4 z, q7 V% j6 fDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
; @& F4 i0 m6 ? Building a new DOS disklabel. Changes will remain in memory only,
& p# Y2 c) t$ D! A" Q until you decide to write them. After that, of course, the previous5 Y7 f" R, F( r0 f
content won't be recoverable." S ]: q4 X! q) }- c: G- k
The number of cylinders for this disk is set to 8322.
' y* }/ d( M$ n! W' b There is nothing wrong with that, but this is larger than 1024,! O, h/ N0 c/ m- w
and could in certain setups cause problems with:
0 B* }- n6 T1 T0 y3 l7 K: T/ k& j 1) software that runs at boot time (e.g., old versions of LILO)
; b. {, p3 z- t 2) booting and partitioning software from other OSs; o# N+ {, B) O0 ~& X
(e.g., DOS FDISK, OS/2 FDISK). @1 C& ] t. n( X4 }5 w! l
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- ^2 v: b( X7 b* l4 f1 W0 | Command (m for help): p* g$ q. o, D, k$ E _6 Y; M$ C2 T; c
Disk /dev/hda: 4294 MB, 4294967296 bytes
# k) |6 z- W: }9 e. n 16 heads, 63 sectors/track, 8322 cylinders- ~# E+ \5 _ N- N& ^
Units = cylinders of 1008 * 512 = 516096 bytes8 b# W1 a5 {$ b# t: c' _
Device Boot Start End Blocks Id System! P6 t2 `* {6 e; f- |1 ]& C1 _
Command (m for help): m
; I4 N, e3 q* Y Command action
7 @4 p- h2 o$ A- z; l a toggle a bootable flag
* C/ a1 ^# h+ `# D7 \4 B b edit bsd disklabel
% D" |8 u3 z0 x$ ]0 i' q+ p c toggle the dos compatibility flag
- q/ c3 G- H! ?# W d delete a partition/ F* k4 R7 O r
l list known partition types/ F ]/ w7 x* P7 J! r
m print this menu: G) v6 c' I. h5 D
n add a new partition
3 b3 @, x0 \0 b T" m; r) o3 J o create a new empty DOS partition table( Y) Q8 N1 J3 o
p print the partition table0 {% w2 |8 I) i2 F, ]; Y
q quit without saving changes
; i2 |. l- f1 J4 e0 v2 w4 i" w s create a new empty Sun disklabel+ [$ U) V! c( |- R' s. _+ e
t change a partition's system id
7 T# M4 [; X9 u' I3 E; {- M u change display/entry units
/ {; _. ^7 `( R; ?7 H8 v v verify the partition table5 u4 G* K& d, ^( _1 k2 G
w write table to disk and exit
/ E7 Y# m+ K: G0 [ x extra functionality (experts only)3 Y( r# |/ w ~$ x8 b0 s9 a5 }
Command (m for help): n
1 a/ N& f1 b, v$ j Command action
" j5 X8 ?- r* L8 i4 G! ?( J e extended* F) n2 n4 q$ U5 P7 u
p primary partition (1-4)7 O9 `8 N9 A' A
p
4 f1 \; x% N. a# f Partition number (1-4): 16 Z6 Y# E# x+ D" z. c* ]# l4 ^ {1 R B
First cylinder (1-8322, default 1): : k5 Z# O0 J1 M3 g
Using default value 1
% W3 d5 p. Q6 _' W Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G# D9 @& j% }* X
Command (m for help): p
; c8 E- E$ w* t& ?6 c, [7 B Disk /dev/hda: 4294 MB, 4294967296 bytes
( s( [ f5 q9 u. |+ W+ x1 N 16 heads, 63 sectors/track, 8322 cylinders# X1 ]* c, {; P# r# y
Units = cylinders of 1008 * 512 = 516096 bytes! T0 e. @3 I% U u/ v& z
Device Boot Start End Blocks Id System
. L) t0 B8 }# X' Z2 x( x /dev/hda1 1 1000 503968+ 83 Linux
( h; `5 X- Y+ h$ K1 w/ y) C) B Command (m for help): w" C- B( S( l0 g- U% N2 U
The partition table has been altered!5 R h J, B" i" r
Calling ioctl() to re-read partition table.2 J& \ I$ ~, S
Syncing disks.) K I: j2 g* a; L
//格式化新分区5 W! O. s6 A) O1 V8 F5 ]
mke2fs 1.32 (09-Nov-2002)
3 i/ f7 K; ?+ F+ C) V, h5 F" i Filesystem label=1 X. K% E; D& A U; J
OS type: Linux/ F- a; V: M* k0 u! [5 S- B) ~" ]$ l0 `% n
Block size=1024 (log=0)/ M3 E7 T, C% Y) }) W' k
Fragment size=1024 (log=0)% h6 D* \* Y: y0 ?' [7 G( N
126480 inodes, 503968 blocks. X2 U: E7 X: _ C
25198 blocks (5.00%) reserved for the super user
! L( h& |: S0 a/ |! F9 | First data block=1
. N5 `9 Z: b7 f 62 block groups
- k* `$ n& O$ ~% w" f5 V$ F 8192 blocks per group, 8192 fragments per group
1 O7 Y6 H% G! g- {3 _ B7 R5 b( w 2040 inodes per group' |* Y6 c/ D& w4 U5 w" F
Superblock backups stored on blocks:
( X$ \& S( |2 ?1 U3 K, l* O 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409' a! B" E p& C/ p7 Q" M
Writing inode tables: done
r; v9 F" x6 \' }1 n( E/ m2 F Creating journal (8192 blocks): done" l6 s% S; Y7 R% H
Writing superblocks and filesystem accounting information: done
) K8 x( X. I3 ~ This filesystem will be automatically checked every 30 mounts or
% d; M& v, G+ l: \: N* W 180 days, whichever comes first. Use tune2fs -c or -i to override.
; p0 [, n& H/ `8 Z! x文件系统 1K-块 已用 可用 已用% 挂载点+ ?' v- k! a2 N4 j- i
/dev/sda3 3723848 705992 2828692 20% /. @. E/ h& E, \ w" J
/dev/sda1 101089 9274 86596 10% /boot
8 F; ^6 ?$ u/ Z* {2 E0 M none 14520 0 14520 0% /dev/shm% ]! D0 \) b( ?" |8 {* a1 K
//挂上新分区
4 G2 Q* {& u8 \9 G! t- l- mount /dev/hda1 /home
& }/ g$ q! K% @ J S# o7 Z - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! Q. J6 W1 E9 m
/dev/sda3 3723848 705992 2828692 20% /7 |" `% o" R) f( L
/dev/sda1 101089 9274 86596 10% /boot' h. k5 L" x+ e. `, h: [
none 14520 0 14520 0% /dev/shm$ ]! }6 N0 Z4 R
/dev/hda1 488006 8239 454569 2% /home C0 @) v0 ~6 ~( J/ d# ~. M P
: g9 I" r) m; Y) p- c自动挂载:
/ q/ G! r) [/ f# w6 n' C- vi /etc/fstab, [. x4 a7 A) ^$ F$ @2 |% ~/ } M
M; r( G% U& C% K% N0 c- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
+ p0 l# _% m( v: E - ' _* W4 V4 R1 ]& s, {
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:4 ~" F+ |& M, X" t+ [2 F! G
- mount /dev/sdb5 /mnt/ljp1 i; A" H3 o/ R S, \8 r
) F- x( g/ g1 D0 [- mount /dev/sdb6 /mnt/ljp2
复制代码
5 |) x# n. L& F- V6 { l" s# Y; M* s N- x' G [
( Q6 }& ^2 R$ G2 M+ @
|
|