|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
4 B( D! r. `7 \$ N; N or: fdisk /dev/sdc (for the third SCSI disk)7 k4 q) x) w! K
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
- T' V4 m$ X) C" Z6 x$ B. g or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices); t7 M+ ^/ S- J1 S+ q$ K; S/ `, c
...
+ | D8 ~" T8 G6 G' C4 a- df -k9 H; l" I+ m6 l# y1 w+ c. V
- df -lh
6 Q3 g4 W2 s' M2 {" o4 b3 R7 o - 查看有几块硬盘:fdisk -l" T, ~! N* M" i5 m- b7 y
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
# c# Q( @* N t8 t, t /dev/sda3 3723848 705968 2828716 20% /5 T0 B3 L4 t" c0 b+ C2 L9 d; H
/dev/sda1 101089 9274 86596 10% /boot; I9 k( A$ J( i( N- l# J5 Z: a
none 14520 0 14520 0% /dev/shm
; }7 H, I, j. M/ M& `9 N, { 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用2 [: x* O* {. r
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel3 {, @) Y& ^- U1 a/ k4 C; c
Building a new DOS disklabel. Changes will remain in memory only,+ ~- u* s1 V; b) ~7 O8 j
until you decide to write them. After that, of course, the previous
' g& g& ~! n3 z4 v content won't be recoverable.
8 A' v" [$ K- E# S The number of cylinders for this disk is set to 8322.4 w6 O% M4 D9 _! w4 p2 V
There is nothing wrong with that, but this is larger than 1024,
+ `9 l C& Y" h0 ?3 a and could in certain setups cause problems with:2 |+ `; d' f! t( B1 X% |4 ~8 w/ i
1) software that runs at boot time (e.g., old versions of LILO): S1 l3 d+ q* u2 S. X
2) booting and partitioning software from other OSs
( B2 @8 f n5 a4 V# f1 `( r (e.g., DOS FDISK, OS/2 FDISK)/ r& x& Y4 s k
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite); V+ M" I# z' Y: b
Command (m for help): p
% J4 Z5 j4 b3 p0 M Disk /dev/hda: 4294 MB, 4294967296 bytes
( _) F4 j( m& ~! v1 [* r( \- Z 16 heads, 63 sectors/track, 8322 cylinders9 u3 a: n; M# u3 [ c; V' p
Units = cylinders of 1008 * 512 = 516096 bytes/ x$ h9 }' j- H2 k
Device Boot Start End Blocks Id System9 }: u5 p7 I5 b& o+ i$ E( I
Command (m for help): m
1 _8 u8 u; U W# y$ h Command action* g) C1 u% ]* e5 @7 u) i
a toggle a bootable flag3 b; |! ?. O% J
b edit bsd disklabel7 D4 F) G1 u+ D2 k6 G
c toggle the dos compatibility flag
3 x5 b3 w6 u" `! Z- s0 e d delete a partition
% }; D5 b& |# B r6 X l list known partition types
# K6 K: } b7 H3 p5 D m print this menu. h2 h# _# _9 A6 g! w" {6 I
n add a new partition
% M5 G8 T7 u) @- |/ c o create a new empty DOS partition table2 a+ s5 K: O i& |/ z C* \
p print the partition table
) ]) n# H5 v' e( u q quit without saving changes1 H/ n$ N4 i/ k" e+ w% j, {
s create a new empty Sun disklabel: H9 w8 B4 }+ }+ o, B* R
t change a partition's system id
# V- s2 E9 G1 D- D' \ u change display/entry units+ ^' |8 _) y }
v verify the partition table6 m0 C. O; s. z9 i" X. _
w write table to disk and exit9 _' q3 d( p1 O/ \( _( _ o
x extra functionality (experts only)
& T' j6 ^0 d2 i6 `3 @ | K Command (m for help): n
0 J, ?% s9 [4 F) ]: t Command action
% T% p2 V1 U9 c4 s! i \1 n/ H e extended( z% ^$ C; j( y5 H
p primary partition (1-4)
8 i, G7 I/ d( V& ]8 c# z' \ p
* m8 o' V" t+ R5 k6 B Partition number (1-4): 1; k6 f9 r: _6 S( n+ R4 x
First cylinder (1-8322, default 1): , V, z; }* m7 m2 z7 N3 q
Using default value 1
: I# E6 Z W% ?# ~; j Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
6 Z/ m* L+ F }! Z9 T7 E4 T Command (m for help): p& Z% } E( c k
Disk /dev/hda: 4294 MB, 4294967296 bytes
! C. s. {2 P2 M/ L2 m6 { s" | 16 heads, 63 sectors/track, 8322 cylinders
3 u# P$ t3 Q8 C Units = cylinders of 1008 * 512 = 516096 bytes
. ^% L5 Q* @4 u/ `- G$ g Device Boot Start End Blocks Id System
( q: Y$ J5 Z. Q2 p' F /dev/hda1 1 1000 503968+ 83 Linux1 t; P# f$ v7 ]& S% _* z
Command (m for help): w
% C. C; k' s% {% L The partition table has been altered!
8 \2 z: Z+ t i Calling ioctl() to re-read partition table.3 R7 C/ |# e) X) v" M) X
Syncing disks.9 O) h9 K" Q" Q
//格式化新分区
9 u# C& b& |: G& o3 T' u8 v0 J$ Z* ?mke2fs 1.32 (09-Nov-2002)/ b+ Q* g: L3 X& A6 h4 l4 Z4 I
Filesystem label=: o; e3 o% y4 ~+ o# C/ C* R2 P7 q3 U& R
OS type: Linux
6 [* B2 [2 ? d# |% M8 k Block size=1024 (log=0)
* q0 u/ F. h6 }# ] Fragment size=1024 (log=0)
5 Q# |+ J$ u1 |# L* t/ O/ U 126480 inodes, 503968 blocks
& u7 g+ L) o+ M, }8 B9 j( @. m# x 25198 blocks (5.00%) reserved for the super user% d5 P: A! O9 b: t; q# t
First data block=1
' H3 l' u, X5 t5 F2 Y 62 block groups$ u6 o2 N8 x/ m- F1 u' W
8192 blocks per group, 8192 fragments per group
! k7 B' J5 Q; W! e! N4 d5 p 2040 inodes per group h* g" T6 [! z
Superblock backups stored on blocks: 3 C( j1 q' @9 p5 B; `
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409( d& l( c1 s+ \8 V4 g2 t
Writing inode tables: done 8 D7 c' F( d$ Q1 F+ C( V' J
Creating journal (8192 blocks): done* I7 A6 |0 b+ p+ g0 _! `
Writing superblocks and filesystem accounting information: done
6 j; _+ j2 L- B) H, \) u# `7 l R This filesystem will be automatically checked every 30 mounts or5 _7 n: y6 W. f, M# e# p, k
180 days, whichever comes first. Use tune2fs -c or -i to override.. |6 b" a5 f$ o" k8 \
文件系统 1K-块 已用 可用 已用% 挂载点
/ p C6 ?, J" O, W /dev/sda3 3723848 705992 2828692 20% /! J) [ a; R! w) v
/dev/sda1 101089 9274 86596 10% /boot# d8 I% i; F/ m; S0 _
none 14520 0 14520 0% /dev/shm& q' r* T4 _/ V# K# m! F
//挂上新分区
L" H. m- b$ X. S2 w- mount /dev/hda1 /home
4 P$ J* N* r n- W - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
1 Y! K& R( w \3 h: k& ~, B /dev/sda3 3723848 705992 2828692 20% /$ [- K" e2 X7 t$ D
/dev/sda1 101089 9274 86596 10% /boot. ]2 y7 ?4 {9 j% {1 v
none 14520 0 14520 0% /dev/shm, u' r$ l3 {3 T$ W: J
/dev/hda1 488006 8239 454569 2% /home& T. C! D5 r N
% i! u% J4 n& Z" r% Y# k5 A自动挂载:8 p) c# L* B& t
- vi /etc/fstab
& e5 j1 w7 L: _7 M
- Y |' n# T' |. @# n% e- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
) n9 T( Y; T4 q w/ N% d# ~ - ! u- a6 {6 X0 k# ~4 _, E7 b
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
2 x. Q \, s" A- mount /dev/sdb5 /mnt/ljp1
* @ o- ^; x! J' W" D( A - 8 I9 {- K0 @1 a3 z
- mount /dev/sdb6 /mnt/ljp2
复制代码 8 x4 R4 T; u4 X& m
1 Y, j) ^. @+ O' A% e+ F
% C: b4 a- M+ l8 c0 K3 O |
|