|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
! v# H# T- i3 p4 l0 p or: fdisk /dev/sdc (for the third SCSI disk)2 f* e( `4 d2 N0 P0 x6 l9 ^
or: fdisk /dev/eda (for the first PS/2 ESDI drive)4 W+ l, @" r4 c% _. u
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices). n- T( w1 o$ S% d% {
...
5 @- ~2 q/ ?* G- df -k
3 u. [3 [/ l0 `1 l5 b0 F - df -lh
& p6 T6 z# x) C' { - 查看有几块硬盘:fdisk -l" [5 T0 d" Q6 K
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点7 g% U. b' q% G; {
/dev/sda3 3723848 705968 2828716 20% /7 ] N1 L* r( _, t: w5 Y3 F
/dev/sda1 101089 9274 86596 10% /boot$ R* b# \8 E( ^* Y, m
none 14520 0 14520 0% /dev/shm3 |( @! |% T. w8 G9 R, |
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用6 O2 m) r q5 h4 f) P
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
' j6 z# M3 n! B5 W Building a new DOS disklabel. Changes will remain in memory only,( v4 H+ Y G; e) C; J$ L% ]% Y
until you decide to write them. After that, of course, the previous8 y$ I% |# F0 E7 y8 k3 V
content won't be recoverable.
. d3 u5 d* |, ~, V' d The number of cylinders for this disk is set to 8322.
0 z" U# l1 r) r+ [$ Z There is nothing wrong with that, but this is larger than 1024,
; Q3 U4 h- o* s( Q4 z$ \5 c) h and could in certain setups cause problems with:
$ p( q" U2 @ {9 e6 d& e- I 1) software that runs at boot time (e.g., old versions of LILO)
$ U- ~6 A" M* r4 [: F: G' N2 A7 E! ` 2) booting and partitioning software from other OSs( m3 ~) j# v) m h# p, L- S7 f
(e.g., DOS FDISK, OS/2 FDISK)
5 s9 L" ]! x" x9 P Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)7 E$ _, Y! c& H& V
Command (m for help): p6 a8 }, _' c9 z, M" J- S
Disk /dev/hda: 4294 MB, 4294967296 bytes3 e6 b8 v2 h' ^- b! [3 P0 B
16 heads, 63 sectors/track, 8322 cylinders
# a4 ^' @ I3 A+ W Units = cylinders of 1008 * 512 = 516096 bytes
' o8 O, \% m4 J$ q% h/ C' \ Device Boot Start End Blocks Id System
+ U5 V) a4 j; o' v! R6 R' ]" N Command (m for help): m
! J R0 ~% I" L6 V2 m# F; ~) K. t Command action
K, u$ g" e$ H9 g a toggle a bootable flag
4 M8 X# x$ l% h: E$ r( j9 O% ]! T b edit bsd disklabel3 i6 v |5 `% y/ c( [# z0 w; B
c toggle the dos compatibility flag
0 i! w" v/ D# v. Y( Y3 h. V d delete a partition: Z4 b5 B+ p6 E* t( n
l list known partition types; H7 @: l# A3 J2 K" z+ G
m print this menu
$ {. g; I1 _0 a- b n add a new partition0 l6 ]6 l4 K* g) c
o create a new empty DOS partition table
5 R, y, X3 t% l/ r0 D# U2 e6 ~ p print the partition table
8 |0 D4 j, [; e( C1 H/ R: W7 j q quit without saving changes" y/ X* {5 t0 X2 Q
s create a new empty Sun disklabel3 q! E% H* P+ q/ @5 _
t change a partition's system id
; ]' c! F" H0 u u change display/entry units# N i9 d: s/ w7 S) |! M! s ^! q
v verify the partition table3 P' k0 O) r2 K- v
w write table to disk and exit4 @1 o4 E5 T; l1 c* `7 Q
x extra functionality (experts only). C/ @& |5 O# R/ o# g( j5 j3 v" }
Command (m for help): n! ^$ j0 {* g2 W2 g
Command action
8 f& I* M* E+ L7 v; T9 Q e extended
4 e/ c# J5 l! o6 a/ W& _ p primary partition (1-4)6 ]/ D _( R2 J/ ]% C# m0 _% f( V
p6 |# }* ?5 c! f; r1 T3 n" R0 e
Partition number (1-4): 1# j6 q% b# v2 |- o- F
First cylinder (1-8322, default 1): , J* f _/ F, h
Using default value 1
1 x$ S! k% ^4 j' Q4 U$ I) C Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
) ]. |- t( E1 U* x( H( F; ~ Command (m for help): p
3 x3 k4 s; i4 x) X Disk /dev/hda: 4294 MB, 4294967296 bytes
* _. \7 ^) F. _/ U. M9 q7 Q 16 heads, 63 sectors/track, 8322 cylinders6 c1 x3 K; T1 E" P: {; j! ~8 [
Units = cylinders of 1008 * 512 = 516096 bytes
" {6 k: I- {! X; b Device Boot Start End Blocks Id System) P$ B0 ~ C3 p. y `# j
/dev/hda1 1 1000 503968+ 83 Linux8 R( X' O! J# ?+ q
Command (m for help): w
5 O6 K; y6 C2 l) R The partition table has been altered!! Z' ~& e8 T. n0 x4 v; D3 _& i5 c% S
Calling ioctl() to re-read partition table.
) a9 \+ K) g* E% y: B Syncing disks.
. v* a6 Y0 o1 a m5 p //格式化新分区! M8 ?: S. i3 E: V: p' S4 {
mke2fs 1.32 (09-Nov-2002) ~# Q% R; ~) D$ U2 L+ c$ |
Filesystem label=7 [+ I8 t! W1 a; l
OS type: Linux; r) d8 \7 Y2 K3 M/ E: ?/ a( U
Block size=1024 (log=0)
# g/ }; m! L8 \& K+ z Fragment size=1024 (log=0)( w9 `# S5 [/ Y
126480 inodes, 503968 blocks$ g: U2 @* a; r' P$ x9 o0 ]
25198 blocks (5.00%) reserved for the super user/ h c8 L) e/ A2 M* b M
First data block=1
% Q! D! f3 }$ s; B1 M$ {# w 62 block groups
" r/ ^/ K" ^, k 8192 blocks per group, 8192 fragments per group$ L' s1 y) c) Y! {, l
2040 inodes per group
* k1 e6 s& |: N; K: U( ?3 U Superblock backups stored on blocks:
k. g/ }/ P g ]* J 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
8 f) d% }/ K/ i$ N, l Writing inode tables: done
1 [) i X! B" ` Creating journal (8192 blocks): done
" @( P: d& W# U8 j Writing superblocks and filesystem accounting information: done3 B; _7 d- x+ T
This filesystem will be automatically checked every 30 mounts or' |: Q& U9 P& x) i6 n" C! |: u
180 days, whichever comes first. Use tune2fs -c or -i to override.# a) }2 [3 E! T1 W. p1 L7 }$ L+ H
文件系统 1K-块 已用 可用 已用% 挂载点. X) f, n9 ]; R+ n1 B- U, s1 c0 p
/dev/sda3 3723848 705992 2828692 20% /
5 k+ |: X3 h3 \4 \+ }) t3 U$ _ /dev/sda1 101089 9274 86596 10% /boot
w# ^, p: `% K2 d8 x' t0 D* e none 14520 0 14520 0% /dev/shm
& m8 W& Y; J4 g5 j4 n- E- i //挂上新分区
% |" J% M8 t. k; I7 S; W- mount /dev/hda1 /home
$ S+ V G3 ~1 F+ e! S b! } - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点5 J& \" P2 ^! v4 u
/dev/sda3 3723848 705992 2828692 20% /
, {( h! [* U b9 O1 t Z" | /dev/sda1 101089 9274 86596 10% /boot7 ?1 p% i' \. k t' x0 ]* g. y
none 14520 0 14520 0% /dev/shm9 u. `1 k | ]" w1 i. Z+ r- |. S
/dev/hda1 488006 8239 454569 2% /home! p) ^- N7 y5 n; j4 x+ U) S" Z
( M H4 Z9 T: G: p8 O8 U! U自动挂载:- s+ U4 R* Q" V
- vi /etc/fstab8 O' t# S/ C* [4 T' k
- . O. K3 p1 q# v% z p1 H
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0+ r( h+ y- t4 l! f( q5 E& A3 v
- 6 t7 r% G, N5 _4 ~( i
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:: t( |) h5 L% g9 B
- mount /dev/sdb5 /mnt/ljp13 c. u7 q. W7 x, Z8 P; n
0 X. x: D/ |- m6 G- mount /dev/sdb6 /mnt/ljp2
复制代码
. g; O0 ^+ M: A9 ^( c. p' \4 p% t6 U' [
% B- ^/ [$ N% m# @5 k( t3 @
|
|