|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)- r, I( J; ?5 o$ D: p; Y) _( v
or: fdisk /dev/sdc (for the third SCSI disk)
- `) ~/ I& G' ^ or: fdisk /dev/eda (for the first PS/2 ESDI drive): A/ P8 C) E. y. M
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)8 A# W+ x# d- l9 P+ b3 d* V
...
& u% s: e9 B" y% Z$ g- df -k
! H D8 b# T3 D. W - df -lh
7 F# B6 l$ x b$ \3 L4 } - 查看有几块硬盘:fdisk -l) ]- [* Y8 r8 i) j
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) D7 }. P/ `4 O/ j( @ /dev/sda3 3723848 705968 2828716 20% /8 j* z: r) ^2 c0 T7 W4 {& l
/dev/sda1 101089 9274 86596 10% /boot" w' U, L& k c0 o3 n
none 14520 0 14520 0% /dev/shm
+ Z. H. h) d b$ a/ |* c 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用! g& s0 l; v& S( B' r, |
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
. j0 |6 e! T* F/ Q Building a new DOS disklabel. Changes will remain in memory only,
5 ?% x" b1 z2 I4 g. U" \ until you decide to write them. After that, of course, the previous
- j9 p8 _1 d5 r8 a# _# M, f4 A content won't be recoverable.* L4 X! ?# j1 q3 W5 p. Z
The number of cylinders for this disk is set to 8322.7 D' H) U6 ^0 L
There is nothing wrong with that, but this is larger than 1024,1 g) ^* e# q$ P& h# F! Z
and could in certain setups cause problems with:
8 z/ y2 k2 }- e" P! r% ^- K/ G) b 1) software that runs at boot time (e.g., old versions of LILO)
. T' ^5 Y# R. s) ]* q 2) booting and partitioning software from other OSs
3 z7 a. r) f3 x% h9 M' `( B& l (e.g., DOS FDISK, OS/2 FDISK); E1 G+ J: f: a2 k
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
B) M2 f7 M6 X' @# q; I3 o7 i Command (m for help): p& e% _2 T: `# x( U @' P
Disk /dev/hda: 4294 MB, 4294967296 bytes
$ h+ P5 j& m- P& _* L [ 16 heads, 63 sectors/track, 8322 cylinders
2 G$ g( P& o( X. X& B: ^& i. J, c- p Units = cylinders of 1008 * 512 = 516096 bytes1 z4 \3 }0 k( n% ?3 |4 ^% C4 Z
Device Boot Start End Blocks Id System0 |/ r" G1 j" {) B
Command (m for help): m9 _, N R9 o* M/ r
Command action4 F8 _, j5 {' L* \# @
a toggle a bootable flag
+ z+ |0 z" q* W/ }/ R% Z b edit bsd disklabel
3 u6 B3 e2 _# o c toggle the dos compatibility flag" {1 ^: ~% }- |
d delete a partition
8 ]8 D7 d* M8 \, f, z9 | l list known partition types% S y& l9 F& j& C8 \: H) A
m print this menu
: v! @! u D9 Y- e3 l7 `3 z n add a new partition
$ O6 w, V+ s3 f o create a new empty DOS partition table
* @+ Z9 [1 v' f6 ], ^% Y p print the partition table& z% F, p, y9 }' q: p5 N6 V0 Q1 l
q quit without saving changes/ u) W4 s) ^: X# o+ b: @! Y7 k
s create a new empty Sun disklabel
, p( H: r4 a' [ t change a partition's system id( |9 L& J0 X8 Z' P- T5 s5 a' j$ K
u change display/entry units
) N% A% n+ [ Y' M2 s v verify the partition table" ?9 v4 p1 Q0 P1 b8 w. o9 ?8 Q1 d
w write table to disk and exit
% S" r9 e' L, w. L$ B$ w6 v7 [ x extra functionality (experts only), p- o6 b# u9 u! c" |9 R
Command (m for help): n+ X* _+ p% d l- b+ O% ]
Command action7 K$ {5 S* {" t! C/ v4 T
e extended
+ p2 f! W) \0 O9 }- \ p primary partition (1-4)1 t3 w. x" a$ y" w( r
p
$ B. A' Y6 Y8 G$ D% w Partition number (1-4): 1( e C9 o6 ?2 |9 s0 g" s. D6 I) J
First cylinder (1-8322, default 1):
3 F* b; j/ u5 t- H: `2 `" F0 X Using default value 1* ?, S5 a7 @. H; h% H
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G0 ~1 y: P* m6 X ~
Command (m for help): p' l- D; ?5 z w% H# K8 d
Disk /dev/hda: 4294 MB, 4294967296 bytes$ ]4 q7 P6 E0 _
16 heads, 63 sectors/track, 8322 cylinders
2 i! m* N9 C$ p9 ]/ Z% Y Units = cylinders of 1008 * 512 = 516096 bytes$ V$ H2 L# u! t! p1 z
Device Boot Start End Blocks Id System
7 z1 q9 ]' A8 j/ [ /dev/hda1 1 1000 503968+ 83 Linux
9 S. N4 |$ O1 e3 r$ N7 A; X Command (m for help): w
/ @' M& l h: u9 ?, A The partition table has been altered!
6 h3 j1 s: P6 |) i Calling ioctl() to re-read partition table.
+ _ F$ o( Y: A2 D- x3 v Syncing disks.$ [1 D0 f! e! q4 F) n4 j/ P
//格式化新分区* V5 x: z& _. Y. J9 r0 r- {
mke2fs 1.32 (09-Nov-2002)
* q0 _7 B2 D X; j+ e Filesystem label=1 ~8 J3 L8 n& K+ n- W
OS type: Linux
. w0 A& j L' j* ]$ w3 y Block size=1024 (log=0)$ s" j+ U5 j" O& \
Fragment size=1024 (log=0)
/ ^5 p5 a0 J! U1 a% [ 126480 inodes, 503968 blocks( Z! U+ z7 U# P! J5 X2 P
25198 blocks (5.00%) reserved for the super user
! v- Z% n- z7 i8 T% s l/ k First data block=1$ {) E, E0 x2 X3 f+ P
62 block groups5 k6 p" A3 n' q; z) G }' W: ~$ _, |
8192 blocks per group, 8192 fragments per group0 T; Z4 K7 l W/ T* s$ ~" s4 U7 V
2040 inodes per group
) e* C" I0 p2 u& ` Superblock backups stored on blocks:
: K, E! F& w" P0 ?& j0 | 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
$ J4 R4 U' _6 d2 z) W5 F Writing inode tables: done + w, S5 F* u6 G6 h- a" j+ z! {
Creating journal (8192 blocks): done$ P6 J, a( e% Z5 _ _* H
Writing superblocks and filesystem accounting information: done, o9 C( n/ S7 S5 H. D0 y* D
This filesystem will be automatically checked every 30 mounts or
4 X9 M9 ^8 q( J6 i6 q, G9 q) R% a 180 days, whichever comes first. Use tune2fs -c or -i to override.
+ t) R9 r. j+ R9 s/ k文件系统 1K-块 已用 可用 已用% 挂载点
! o3 Z( O6 u. F2 t( b$ ~ /dev/sda3 3723848 705992 2828692 20% /% B6 l7 Y/ ~" l, K& o5 }
/dev/sda1 101089 9274 86596 10% /boot6 H/ K0 a" u/ N7 B: [# O
none 14520 0 14520 0% /dev/shm
- J; t: n4 a( N' w* H //挂上新分区' C* a; \1 T5 y9 Q6 p
- mount /dev/hda1 /home& }, H6 D$ T; f9 u; A( y" f
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! I: c) E# x; H, t4 u+ r. X
/dev/sda3 3723848 705992 2828692 20% /
C6 ]# ~1 Y/ \8 t% @0 O /dev/sda1 101089 9274 86596 10% /boot
3 T9 a! J1 n+ Q* z; F' j# X( t none 14520 0 14520 0% /dev/shm5 v( J" K( i+ N* _
/dev/hda1 488006 8239 454569 2% /home+ u9 ]% K0 k% U q$ U- @- }
& R. W" [3 X/ B6 E! _9 I
自动挂载:" g/ o. w0 E, d
- vi /etc/fstab8 ?, i. @& a# N7 d
" ~- o6 E2 y5 H( I- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
/ B! Q% e. x: z8 r) _4 d, @6 ] z' H' D% {% `
$ `3 k; n; R7 u" `- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
$ w6 M& T8 n- z; C C# y- z1 ~- mount /dev/sdb5 /mnt/ljp1 S7 w" F; G1 Q/ `1 y9 F& X% {
- s0 \7 ^% {' U' U H- mount /dev/sdb6 /mnt/ljp2
复制代码
! j# r2 ^7 N V0 @4 S3 `$ I! i
4 E- ^$ G' f. [& c$ n5 U
8 R% K% K7 `. T& a3 H2 v- U |
|