Linuxディスクパーティション(一):追加
******************************************************************************************声明
オリジナル作品は、「紺のブログ」からのブログです。転載を歓迎します。転載する時は必ず出典を明記してください。http://blog.csdn.net/huangyanlongを選択します
表現に誤りがあります。メッセージやメールをお願いします。[email protected])ご指定いただき、感謝にたえません。
***************************************************************************************
***************************************************************************************
Linuxハードディスクパーティション(一):*********************************************************************************************************************************************を追加します。
******************************************
例えば、1ブロック90 Gディスクを追加して、1つのパーティションに分割します。
****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
例2:
1、10 Gディスクを1ブロック追加します。2、6つのパーティションに分けます。3、3つのメインパーティションはそれぞれ2 Gである。****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************ディスクの状況を確認します。
******************************************
オリジナル作品は、「紺のブログ」からのブログです。転載を歓迎します。転載する時は必ず出典を明記してください。http://blog.csdn.net/huangyanlongを選択します
表現に誤りがあります。メッセージやメールをお願いします。[email protected])ご指定いただき、感謝にたえません。
注意:目次をクリックすると、よりあなたの閲覧に役立ちます。
***************************************************************************************
オリジナル作品は、「紺のブログ」からのブログです。転載を歓迎します。転載する時は必ず出典を明記してください。http://blog.csdn.net/huangyanlongを選択します
表現に誤りがあります。メッセージやメールをお願いします。[email protected])ご指定いただき、感謝にたえません。
***************************************************************************************
***************************************************************************************
Linuxハードディスクパーティション(一):*********************************************************************************************************************************************を追加します。
******************************************
--
# fdisk -l --
# fdisk /dev/sdb -- /dev/sdb
n --
p/e -- /
w --
# mkdir /data --
# mkfs.ext3 /dev/sdb -- ext3
# fdisk -l --
# mount /dev/sdb /data --
# vi /etc/fstab --
/dev/sdb /data ext3 defaults 0 0
***************は***************************の説明を***************************************************************************************1、以上の操作は簡潔にまとめられています。もし読めば、下記の内容は閲覧する必要がありません。2、以下は簡単に二つの例を挙げて、操作過程を細かくします。例えば、1ブロック90 Gディスクを追加して、1つのパーティションに分割します。
****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[root@hyldb /]# fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 514048+ 83 Linux
/dev/sda2 65 586 4192965 82 Linux swap / Solaris
/dev/sda3 587 15665 121122067+ 83 Linux
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
**********ディスクパーティション********[root@hyldb /]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 11748.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
-- m :
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
--
Command action
e extended
p primary partition (1-4)
p
-- p
Partition number (1-4): 1
--
First cylinder (1-11748, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-11748, default 11748):
Using default value 11748
Command (m for help): p
--
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 11748 94365778+ 83 Linux
Command (m for help): w
--
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
*********************は、マウントディレクトリを作成します。[root@hyldb /]# mkdir /data
********をフォーマットしたディスク******を****します。[root@hyldb /]# mkfs.ext3 /dev/sdb
-- sdb1, ext3
mke2fs 1.39 (29-May-2006)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
11796480 inodes, 23592960 blocks
1179648 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
720 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@hyldb /]# fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 514048+ 83 Linux
/dev/sda2 65 586 4192965 82 Linux swap / Solaris
/dev/sda3 587 15665 121122067+ 83 Linux
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
******************は、指定されたパスの下にディスクをマウントします。[root@hyldb /]# mount /dev/sdb /data
[root@hyldb /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 112G 4.3G 102G 5% /
/dev/sda1 487M 17M 445M 4% /boot
tmpfs 1006M 0 1006M 0% /dev/shm
/dev/sdb 89G 184M 84G 1% /data
************************は、再起動ディスクを自動的にマウントします。[root@xckydb ~]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/sdb /data ext3 defaults 0 0
~
~
"/etc/fstab" 8L, 608C written
--
/dev/sdb1 /u01 ext3 defaults 0 0
***************************************************************************************例2:
1、10 Gディスクを1ブロック追加します。2、6つのパーティションに分けます。3、3つのメインパーティションはそれぞれ2 Gである。****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************ディスクの状況を確認します。
[root@hyl ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 5.4G 3.9G 59% /
/dev/sda3 35G 17G 17G 50% /home
tmpfs 1006M 0 1006M 0% /dev/shm
[root@hyl ~]# fdisk -l
Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1305 10482381 83 Linux
/dev/sda2 1306 1827 4192965 82 Linux swap / Solaris
/dev/sda3 1828 6527 37752750 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
******************は/dev/sdbのデバイスパーティションに************************************************を**します。[root@hyl ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
**********が最初のメインパーティションを作成しました。大小2 G**********Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): +2048M
**********は第二のメインパーティションを作成します。Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): +2048M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (251-1305, default 251):
Using default value 251
Last cylinder or +size or +sizeM or +sizeK (251-1305, default 1305): +2048M
**********は第三のメインパーティションを作成します。大小2 G**************Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (501-1305, default 501):
Using default value 501
Last cylinder or +size or +sizeM or +sizeK (501-1305, default 1305): +2048M
*********************は先にパーティションのリストを印刷して***を見ます。Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 250 2008093+ 83 Linux
/dev/sdb2 251 500 2008125 83 Linux
/dev/sdb3 501 750 2008125 83 Linux
************は、拡張パーティションを作成します。Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First cylinder (751-1305, default 751):
Using default value 751
Last cylinder or +size or +sizeM or +sizeK (751-1305, default 1305):
Using default value 1305
**********が最初の論理パーティションを作成しました。大きさは1 G******************です。Command (m for help): n
First cylinder (751-1305, default 751):
Using default value 751
Last cylinder or +size or +sizeM or +sizeK (751-1305, default 1305): +1024M
**********が作成した2番目の論理パーティション:サイズ1 G*********************が作成されました。Command (m for help): n
First cylinder (876-1305, default 876):
Using default value 876
Last cylinder or +size or +sizeM or +sizeK (876-1305, default 1305): +1024M
******************の残りの容量は最後の論理パーティションを作成します。Command (m for help): n
First cylinder (1001-1305, default 1001):
Using default value 1001
Last cylinder or +size or +sizeM or +sizeK (1001-1305, default 1305):
Using default value 1305
************の印刷パーティションリスト******Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 250 2008093+ 83 Linux
/dev/sdb2 251 500 2008125 83 Linux
/dev/sdb3 501 750 2008125 83 Linux
/dev/sdb4 751 1305 4458037+ 5 Extended
/dev/sdb5 751 875 1004031 83 Linux
/dev/sdb6 876 1000 1004031 83 Linux
/dev/sdb7 1001 1305 2449881 83 Linux
********を保存して****を脱退します。Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
************は、ディスクの分割を調べます。[root@hyl ~]# fdisk -l
Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1305 10482381 83 Linux
/dev/sda2 1306 1827 4192965 82 Linux swap / Solaris
/dev/sda3 1828 6527 37752750 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 250 2008093+ 83 Linux
/dev/sdb2 251 500 2008125 83 Linux
/dev/sdb3 501 750 2008125 83 Linux
/dev/sdb4 751 1305 4458037+ 5 Extended
/dev/sdb5 751 875 1004031 83 Linux
/dev/sdb6 876 1000 1004031 83 Linux
/dev/sdb7 1001 1305 2449881 83 Linux
-- ,sdb1、sdb2、sdb3 ,sdb5、sdb6、sdb7
*********************の例:sdb 1をext 3ファイルシステムにフォーマットする*******************を例に挙げます。[root@hyl ~]# cd /
[root@hyl /]# mkdir data1
[root@hyl /]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
251392 inodes, 502023 blocks
25101 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=515899392
16 block groups
32768 blocks per group, 32768 fragments per group
15712 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
************************の例を挙げます。sdb 1の設定のために、自動的にマウントされます。******************************************
[root@hyl /]# vi /etc/fstab
--
LABEL=/ / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/sdb1 /data1 ext3 defaults 0 0
~
~
~
"/etc/fstab" 8L, 608C written
[root@hyl /]# mount /dev/sdb1 /data1
[root@hyl /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 5.4G 3.9G 59% /
/dev/sda3 35G 17G 17G 50% /home
tmpfs 1006M 0 1006M 0% /dev/shm
/dev/sdb1 1.9G 35M 1.8G 2% /data1
******************************************************************************************声明 オリジナル作品は、「紺のブログ」からのブログです。転載を歓迎します。転載する時は必ず出典を明記してください。http://blog.csdn.net/huangyanlongを選択します
表現に誤りがあります。メッセージやメールをお願いします。[email protected])ご指定いただき、感謝にたえません。
注意:目次をクリックすると、よりあなたの閲覧に役立ちます。
***************************************************************************************