|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
5 J3 b* V7 i9 y7 h1 V, C; D, z or: fdisk /dev/sdc (for the third SCSI disk)
5 v* V! l$ @6 L4 F or: fdisk /dev/eda (for the first PS/2 ESDI drive): p j( k3 g/ C9 W
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
, P0 h1 n) ^+ }, _ ...
2 R* @ O' Y9 M+ W% C( s- df -k; r0 M( H- L3 g4 k- R, R7 W
- df -lh
1 d: e8 n) E& V+ R% e - 查看有几块硬盘:fdisk -l
, v7 S3 E4 c% O# J* W. L/ i- B
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点/ w8 R- C' z: y" J( s: l
/dev/sda3 3723848 705968 2828716 20% /
% o5 [' [+ T# n/ K/ e* C1 ^0 X3 i /dev/sda1 101089 9274 86596 10% /boot
) M$ Y; H9 C I' b2 n% w& E4 i none 14520 0 14520 0% /dev/shm
- ]7 `( w' l. A$ U 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
3 c! q' U2 q7 F! gDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel a7 |" f1 _7 J# C3 x
Building a new DOS disklabel. Changes will remain in memory only,/ N9 g$ ?. o2 X1 w0 T5 s
until you decide to write them. After that, of course, the previous- v6 Y! d0 i( ]1 T4 D( y0 a( q
content won't be recoverable.4 H& j- W. Y( P
The number of cylinders for this disk is set to 8322.
$ H: v6 P) F( \; P There is nothing wrong with that, but this is larger than 1024,$ u5 X" s5 v5 F1 M
and could in certain setups cause problems with:8 Z6 G: C, r& b2 S1 ]7 w
1) software that runs at boot time (e.g., old versions of LILO)
8 z& _0 u& g; ]0 Q) r' f. ` 2) booting and partitioning software from other OSs9 R' b( _2 L) I' B% P
(e.g., DOS FDISK, OS/2 FDISK)
' b+ n9 U, r( k! x$ ^$ T Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)) q7 q6 N# C2 ~2 M& \( R% Y
Command (m for help): p) h1 J3 n- I3 B7 \% [% A
Disk /dev/hda: 4294 MB, 4294967296 bytes
* m% C$ Z" E: A! y; I! N 16 heads, 63 sectors/track, 8322 cylinders
h) {4 o- d- X& H Units = cylinders of 1008 * 512 = 516096 bytes& ]- x: o5 P- ~2 L: [. }
Device Boot Start End Blocks Id System
- l; w" @, J5 b$ \0 a$ }" N Command (m for help): m) J! A" V, w1 X7 m0 d" _( M
Command action
4 I; l: c- R4 H6 L5 n$ {4 I8 v a toggle a bootable flag
* d$ N g- x; R$ v# V b edit bsd disklabel' C# P7 N, t% s3 y3 V: }
c toggle the dos compatibility flag, H0 ^$ ~0 j3 H* p& u; \
d delete a partition
J0 ^2 ?" N( q% v' }4 Z0 L& q l list known partition types7 {7 t3 s; u, s& E9 X, r. W
m print this menu
8 s6 q) f, |" R0 L; l; n n add a new partition
/ `' H5 z- S! ]! q, \4 j/ T8 r o create a new empty DOS partition table( c+ `* T* N$ ]* W6 C! d
p print the partition table5 |2 g, e* ]* v3 X! f
q quit without saving changes: w% t. u/ l2 r* x
s create a new empty Sun disklabel
$ a9 p3 E3 r4 r t change a partition's system id
8 A h# p1 U# d I% @1 V3 Q! a. n' y u change display/entry units; ^2 o0 u. }1 y$ p5 d
v verify the partition table
3 C% w5 g, Q. J& m w write table to disk and exit: v0 q/ N8 ]0 A7 h) E" H' c& P
x extra functionality (experts only)3 {- L, P0 b2 }2 ]( y! J
Command (m for help): n
! E6 n2 N% T# ]& A$ c$ T Command action
6 u) {7 c& Y' J) C7 ^& a* n e extended$ v# {0 _( C4 r
p primary partition (1-4)
: ]! G: j1 B& U7 R3 `7 N p
, p, ]; v8 K1 h/ R& o Partition number (1-4): 1
: Q2 f% P" F3 c2 x) X First cylinder (1-8322, default 1): 3 h/ q, w- t: C' [
Using default value 1( V6 }9 `; g7 ]. D! A
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
& `0 k b; @- o7 T) W; t* q- Y Command (m for help): p( s1 D: r- w" a6 N a( e. c0 l
Disk /dev/hda: 4294 MB, 4294967296 bytes
+ }- Q' U& w% Z9 X) C: \ 16 heads, 63 sectors/track, 8322 cylinders! |( x+ n& d+ a7 l' d
Units = cylinders of 1008 * 512 = 516096 bytes. o$ x" b ~/ v) R0 P/ H
Device Boot Start End Blocks Id System* O; ^9 R0 i8 I! A
/dev/hda1 1 1000 503968+ 83 Linux/ ^6 {- f4 b6 X }$ Z+ N8 K
Command (m for help): w {9 [3 Z& g. }2 Z4 \1 k
The partition table has been altered!
4 F5 w9 K& h4 w Calling ioctl() to re-read partition table.# n6 n" i6 x6 j: F' E
Syncing disks.
$ ]) e" d: q" U- f: c" \, x# _' m //格式化新分区5 l* o( r7 C% t+ I: X4 m
mke2fs 1.32 (09-Nov-2002)
4 e' h7 @ ]5 B Filesystem label=
( c5 | N' y- U$ M5 u OS type: Linux
7 c9 _% S1 x* O9 G& A. h7 k Block size=1024 (log=0)7 ?" c6 x/ u# G# X% q
Fragment size=1024 (log=0): H% m$ s2 @% c+ C
126480 inodes, 503968 blocks5 ^6 a9 E% @; n: `" s) W7 ~7 u
25198 blocks (5.00%) reserved for the super user
0 _% C" p9 m) _' b- Q0 |9 b First data block=1
6 i% u9 n1 E! K6 o 62 block groups
+ _0 }" R! K, q" V% v$ M* e 8192 blocks per group, 8192 fragments per group
( v+ f( a4 l4 k8 b" [ 2040 inodes per group
% ?3 m. E6 a6 L Superblock backups stored on blocks: / t0 Z0 U$ t* p5 U* m
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
2 L4 d6 j* }8 | Writing inode tables: done & n: |4 T3 |+ W' f
Creating journal (8192 blocks): done
7 @) Y( F+ ^6 J$ K5 L) p3 \, R Writing superblocks and filesystem accounting information: done
6 }/ B7 F* ~# G* o( S0 F This filesystem will be automatically checked every 30 mounts or g, P: T' W7 Q; _- C# \6 r# z
180 days, whichever comes first. Use tune2fs -c or -i to override.) Y" M8 R' ~- n6 [- j
文件系统 1K-块 已用 可用 已用% 挂载点
5 M$ C i& Y- _; K, m, N8 ~ /dev/sda3 3723848 705992 2828692 20% /
) c g" r! L3 P( x$ l0 i7 d1 l9 ~ /dev/sda1 101089 9274 86596 10% /boot
# ~6 l3 u1 r5 x2 N2 ]- n none 14520 0 14520 0% /dev/shm
O; ?3 S( I. N, ]. R //挂上新分区
) ?0 T0 r: A: h) I" ]- mount /dev/hda1 /home
! k$ `* E Q+ U8 ^6 k4 g# L3 j2 o - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
$ L4 k4 ~8 \) L" n /dev/sda3 3723848 705992 2828692 20% /
' O3 `! H0 j9 l( s9 Y /dev/sda1 101089 9274 86596 10% /boot
! N$ m0 Z+ Z- y none 14520 0 14520 0% /dev/shm% r" h2 E) k( [3 D
/dev/hda1 488006 8239 454569 2% /home4 q6 l& q3 O* B4 i
# w) G2 r! Q2 E3 w自动挂载:
8 W6 Q6 l, A" Q6 S4 P$ a2 h- vi /etc/fstab
+ {1 ~) w5 x7 v+ z" w& W - . A6 [8 f0 [8 N4 R. Y3 [
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
7 }5 y E1 @! p9 M5 r/ q/ e4 [
) V# h ?4 a ~- \0 ^: F- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
, r: P- \- C" `, X+ I# A- mount /dev/sdb5 /mnt/ljp1' \: [8 y' \4 N q# ]6 Y
- * Y0 h8 o( t( D# o
- mount /dev/sdb6 /mnt/ljp2
复制代码 - {' h% P2 F2 Q* j7 p
' R; [$ t, P7 Q9 I3 \ h% x- w" n0 c3 {6 w: D3 B: B9 A
|
|