|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
8 q m _& W) k2 w: M or: fdisk /dev/sdc (for the third SCSI disk)* a, M4 R1 f5 v1 e( D/ ]
or: fdisk /dev/eda (for the first PS/2 ESDI drive)0 W) {/ {! r! I% ^; U
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)# @- R1 l9 q+ Y" b2 }' c, \
...% ^4 L3 q" a. t
- df -k/ Q' y8 }& d1 g! t
- df -lh
! v a- s6 M# k9 n$ r1 j - 查看有几块硬盘:fdisk -l0 N1 T8 b& l, w# ~5 T% D% ^, E
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
`% ]6 h/ g2 v/ Z2 u& ^7 Q/ }$ o /dev/sda3 3723848 705968 2828716 20% /
7 I; r4 A7 g) `+ T9 B; Z# U" {) D /dev/sda1 101089 9274 86596 10% /boot' Q. Y# K5 S2 g. }! E1 ] s0 a% n
none 14520 0 14520 0% /dev/shm" o' J6 B: @7 [) x* Z- S3 `; K
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
9 c q# E% T' v! l, Y4 tDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel& m; P$ g$ U2 j* i; V
Building a new DOS disklabel. Changes will remain in memory only,
) t6 c: C/ D. @( X4 P until you decide to write them. After that, of course, the previous. N' U- y( y, z- y. l+ [
content won't be recoverable.! q. W% }: S [- r2 E/ \( r
The number of cylinders for this disk is set to 8322.
6 v. g$ }, @5 b' v+ I( N' v There is nothing wrong with that, but this is larger than 1024,
% h! g- {" l8 M% M* `' K$ g9 u @4 G2 | and could in certain setups cause problems with:) _0 g, u4 O; `" _- @ K2 E
1) software that runs at boot time (e.g., old versions of LILO)
F% H- d* `/ b" n# ] 2) booting and partitioning software from other OSs0 k% S% o3 M& D* q+ d
(e.g., DOS FDISK, OS/2 FDISK)& ?) }1 W% o" U
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)3 R' O/ y+ h3 y- y
Command (m for help): p0 ^; J t7 E0 e7 e+ ?
Disk /dev/hda: 4294 MB, 4294967296 bytes; j* J) G- Q8 D( B1 \
16 heads, 63 sectors/track, 8322 cylinders, }5 y$ J+ a. c. h9 ~' l
Units = cylinders of 1008 * 512 = 516096 bytes5 h) U2 X) W) L
Device Boot Start End Blocks Id System7 [ E2 Y4 w* L6 f) r. ?" u- H
Command (m for help): m, W% K" S; K( ?/ [% A4 T
Command action1 C( V, H' ?% D3 T
a toggle a bootable flag
& l+ ]$ J- J: P& W" S* n0 u7 B b edit bsd disklabel
0 X/ m8 _: e6 b c toggle the dos compatibility flag+ L$ t, z3 e, n% c! [6 g9 j
d delete a partition
' {) c% n" y* y0 f: _ l list known partition types1 c2 P2 ?% L+ U3 n! \2 U0 ^& x
m print this menu7 z B4 O5 y) q! Y# g
n add a new partition
3 G( x$ }- x9 l: v$ c o create a new empty DOS partition table1 I* i2 `. ?. s1 \2 e
p print the partition table# j6 X) Y' ^. o& u2 {. O% L8 [3 }
q quit without saving changes
# ?: m4 H5 c: e# _$ J% d' c! p+ J s create a new empty Sun disklabel+ R3 _' F6 I, L: r
t change a partition's system id5 {# f$ i8 M! C- G( ]
u change display/entry units$ G- Y" w) ?% U7 b
v verify the partition table
2 d$ d& w M4 @ w' z w write table to disk and exit1 `8 _, f; o0 s' U" U0 n' C
x extra functionality (experts only)4 s4 l! Z- a1 |' t/ N. |- d
Command (m for help): n
1 n1 v1 f! C6 r E Command action( Z+ H$ `& D5 i3 Z( {
e extended
( Z2 e b$ D: ? p primary partition (1-4)
1 J+ g4 E) a/ }: N7 O/ j9 F" a p
# a6 l! S) H: i% `4 }* n0 q Partition number (1-4): 1
1 P1 w% B) u. k First cylinder (1-8322, default 1): 9 i1 Z" d6 q( Z4 Q/ A
Using default value 1* K2 z. d+ }# m8 V
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
$ Z2 G! d9 P4 S+ ~$ g4 G5 M Command (m for help): p
2 ^1 G- z/ z- P% ?! J Disk /dev/hda: 4294 MB, 4294967296 bytes
1 U7 P# l/ Y) M' m 16 heads, 63 sectors/track, 8322 cylinders
' C& I' G( n% ^2 u1 Y J Units = cylinders of 1008 * 512 = 516096 bytes9 x u% ^# U3 ^4 X, [: u' \% f3 y( y
Device Boot Start End Blocks Id System3 c( I' v" p( t1 b
/dev/hda1 1 1000 503968+ 83 Linux
- M% r2 Q& J- {4 V$ P Command (m for help): w( ]( N/ t6 U9 Y, e
The partition table has been altered!( h4 b, ~* V9 K7 S" A) j$ P: i
Calling ioctl() to re-read partition table.0 X6 s- E3 g" s( ]% h2 l) G
Syncing disks.( o- Y1 O5 o5 o0 q- V# E! z
//格式化新分区
2 l6 I/ `: U8 H, x( I1 E, n9 Nmke2fs 1.32 (09-Nov-2002)
& r3 L: i: M' r; M. c, K Filesystem label=# y7 a! n- o7 ~2 d" V; o- m% T
OS type: Linux
! O) r5 { @' }3 I' H Block size=1024 (log=0)
! [5 ~6 W. B1 o& w# z6 B1 u$ \7 ^ Fragment size=1024 (log=0)( n4 \: r$ r4 o
126480 inodes, 503968 blocks* V0 Q, |! M* [
25198 blocks (5.00%) reserved for the super user
/ ]$ i3 P* C* R% r First data block=15 f0 q4 _. z; a: L6 u
62 block groups9 J; V* \/ g8 `# \( ~& W+ D
8192 blocks per group, 8192 fragments per group
7 R, }3 n9 a2 _! n" w1 a 2040 inodes per group
" T3 W' D# \+ r9 @1 S8 {* y' ? Superblock backups stored on blocks:
, ~) _# x( L1 C 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409: q7 H- Z7 B6 ]6 c% I
Writing inode tables: done
3 `% U, ?) i0 ?" F) U3 E( N; t Creating journal (8192 blocks): done" M) o: v3 k+ S9 L6 o, M& z
Writing superblocks and filesystem accounting information: done; q* M) R0 I: i8 U
This filesystem will be automatically checked every 30 mounts or
: u! f# C" t2 w0 v$ P/ f6 w 180 days, whichever comes first. Use tune2fs -c or -i to override.1 ^' @' h8 W/ [+ m f) _
文件系统 1K-块 已用 可用 已用% 挂载点
7 s2 ~ A# w1 v2 u5 ^) h /dev/sda3 3723848 705992 2828692 20% /3 o4 W/ U4 G# B# e; E
/dev/sda1 101089 9274 86596 10% /boot5 i1 [* {5 P" h& K' I/ W, Y
none 14520 0 14520 0% /dev/shm9 Z, J- @, S% J1 C {3 c* D
//挂上新分区
" `) j7 u% S" |4 c* y& ^: {- mount /dev/hda1 /home
' V! {; P- {$ c! ~ - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
+ C; c& D) S2 w$ t /dev/sda3 3723848 705992 2828692 20% /8 j4 m: `. ^. U7 \* q1 H# N9 u+ g
/dev/sda1 101089 9274 86596 10% /boot
) e \# x! [4 a& P none 14520 0 14520 0% /dev/shm
! z5 D* t: f& @% `5 T9 A /dev/hda1 488006 8239 454569 2% /home
% A8 _( w4 O# \* ^. O7 Y; e0 M$ @" @' V2 v3 V
自动挂载:/ O, O) B" T% k) n1 c$ H8 f$ M
- vi /etc/fstab2 n4 }8 `" Q& o X$ H
' i$ Q8 v. J+ o5 l0 U- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0 u) {% M ~0 i/ r5 w1 ]3 u7 X' |
" y% X# F5 s# B+ {- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
- V! R( s, c9 Y, Z! L+ _6 N- mount /dev/sdb5 /mnt/ljp17 w- X1 t+ ^6 p
- 7 {# J, ]' A j. E+ c+ Z" k. L' A
- mount /dev/sdb6 /mnt/ljp2
复制代码 : A# z% y( I0 n" a6 f5 R G; o
" x! ]5 P: O1 T' O* F& {: ]: I- ]* Z y' g# k d
|
|