up

ディスク保存の方法について その1

     ディスク保存の方法について その1 です

一連の操作をしてみて行きましょう。

$ ssh -l fdopstm 192.168.24.9
Password: 
$ su -
Password: 

sv:~# fdisk -l

Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       111    891576    6  FAT16
/dev/hda2           112       524   3317422+  83  Linux

Disk /dev/hdb: 255 heads, 63 sectors, 1216 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *         1       111    891576    b  Win95 FAT32
/dev/hdb2           112       237   1012095   82  Linux swap
/dev/hdb3           238      1216   7863817+  83  Linux

使用している領域は /dev/hda1 です。したがって もう少し小さくても良い でしょう。

# cat /etc/fstab 
/dev/hdb2       swap        swap        defaults   0   0
/dev/hdb3       /        ext3        defaults   1   1
/dev/hda2       /var/data        ext2        defaults   1   2
/dev/cdrom       /cdrom   iso9660   user,ro,noauto,exec,iocharset=euc-jp,codepage=932 0   0
none             /proc    proc        defaults   0   0
none            /dev/pts        devpts  gid=5,mode=620    0 0
none            /proc/bus/usb             usbfs        noauto   0   0

# mount         
/dev/hdb3 on / type ext3 (rw)
none on /proc type proc (rw)
/dev/hda2 on /var/data type ext2 (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)

/dev/hda1 を 分割します fstab の /dev/hda2 を /dev/hda3 に 変更せねば なりませぬ。

# fdisk /dev/hda
Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       111    891576    6  FAT16
/dev/hda2           112       524   3317422+  83  Linux

Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1        43    345366    6  FAT16
/dev/hda2            44       111    546210   83  Linux
/dev/hda3           112       524   3317422+  83  Linux
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Re-read table failed with error 16: Device or resource busy.
Reboot your system to ensure the partition table is updated.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

分割が済んだので fstab を 変更します。

# cd /etc/
# cp fstab fstab_hda_2partition
# diff -s fstab fstab_hda_2partition 
3c3
< /dev/hda3       /var/data        ext2        defaults   1   2
---
> /dev/hda2       /var/data        ext2        defaults   1   2

再起動確認した方が良いでしょう。現状確認後行います。

sv:/etc# fdisk -lu

Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders
Units = sectors of 1 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *        63    690794    345366    6  FAT16
/dev/hda2        690795   1783214    546210   83  Linux
/dev/hda3       1783215   8418059   3317422+  83  Linux

Disk /dev/hdb: 255 heads, 63 sectors, 1216 cylinders
Units = sectors of 1 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *        63   1783214    891576    b  Win95 FAT32
/dev/hdb2       1783215   3807404   1012095   82  Linux swap
/dev/hdb3       3807405  19535039   7863817+  83  Linux

sv:/etc# fdisk -l

Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1        43    345366    6  FAT16
/dev/hda2            44       111    546210   83  Linux
/dev/hda3           112       524   3317422+  83  Linux

Disk /dev/hdb: 255 heads, 63 sectors, 1216 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *         1       111    891576    b  Win95 FAT32
/dev/hdb2           112       237   1012095   82  Linux swap
/dev/hdb3           238      1216   7863817+  83  Linux

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb3              7617504   4021584   3202732  56% /
/dev/hda2              3265260    790408   2308984  26% /var/data

# shutdown -r now

Broadcast message from root (pts/0) (Mon Mar 10 09:39:43 2008):

The system is going down for reboot NOW!
sv:/etc# Connection to 192.168.24.9 closed by remote host.
Connection to 192.168.24.9 closed.

再起動して支障が 無いか 確認する。

$ ssh -l fdopstm 192.168.24.9
Password: 
$ su -
Password: 
# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb3              7617504   4021596   3202720  56% /
/dev/hda3              3265260    790408   2308984  26% /var/data
# fdisk -lu

Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders
Units = sectors of 1 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *        63    690794    345366    6  FAT16
/dev/hda2        690795   1783214    546210   83  Linux
/dev/hda3       1783215   8418059   3317422+  83  Linux

Disk /dev/hdb: 255 heads, 63 sectors, 1216 cylinders
Units = sectors of 1 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *        63   1783214    891576    b  Win95 FAT32
/dev/hdb2       1783215   3807404   1012095   82  Linux swap
/dev/hdb3       3807405  19535039   7863817+  83  Linux
# fdisk -l

Disk /dev/hda: 255 heads, 63 sectors, 524 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1        43    345366    6  FAT16
/dev/hda2            44       111    546210   83  Linux
/dev/hda3           112       524   3317422+  83  Linux

Disk /dev/hdb: 255 heads, 63 sectors, 1216 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *         1       111    891576    b  Win95 FAT32
/dev/hdb2           112       237   1012095   82  Linux swap
/dev/hdb3           238      1216   7863817+  83  Linux

但し マウント の結果は 元のものと 同じ認識をしている??

# mount -t msdos /dev/hda1 /mnt/
sv:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb3              7617504   4021596   3202720  56% /
/dev/hda3              3265260    790404   2308988  26% /var/data
/dev/hda1               891328    285296    606032  33% /mnt
sv:~# umount /mnt/

# mkfs -t ext2 /dev/hda2
mke2fs 1.34 (25-Jul-2003)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
68320 inodes, 136552 blocks
6827 blocks (5.00%) reserved for the super user
First data block=0
5 block groups
32768 blocks per group, 32768 fragments per group
13664 inodes per group
Superblock backups stored on blocks: 
        32768, 98304

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
# mount /dev/hda2 /mnt/
# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb3              7617504   4021596   3202720  56% /
/dev/hda3              3265260    790404   2308988  26% /var/data
/dev/hda2               537604        20    510276   1% /mnt
# umount /mnt/
=============================
# mount /dev/hda1 /mnt/
# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb3              7617504   4021596   3202720  56% /
/dev/hda3              3265260    790404   2308988  26% /var/data
/dev/hda1               891328    285296    606032  33% /mnt
# umount /mnt/ 
/*     まだ怪しい??    */
# mkdosfs /dev/hda1
mkdosfs 2.7 (14 Feb 2001)
# mount /dev/hda1 /mnt/
# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb3              7617504   4021596   3202720  56% /
/dev/hda3              3265260    790404   2308988  26% /var/data
/dev/hda1               345176         0    345176   0% /mnt
# umount /mnt/
=================

しかたがない新しく インストール しないと駄目みたいである。

# shutdown -h now

Broadcast message from root (pts/0) (Mon Mar 10 09:55:04 2008):

The system is going down for system halt NOW!
sv:~# Connection to 192.168.24.9 closed by remote host.
Connection to 192.168.24.9 closed.

まあインストールの復習 ということです。

にゃんたろう 拝!
2008年 3月 9日 (日) 22:56:46 JST 作成


up

Copyright © 2006.-2008. nyantarou All Rights Reserved.