2007年10月10日水曜日

LVMお試し on ubuntu


ubuntu-6.06.1-TLS serverで1台作りなおしているリハビリ中。



とても実践的な Linux LVM HOWTOを見ながら、いそいそ(^^;。






# pvscan
PV /dev/hda6 VG Ubuntu lvm2 [74.29 GB / 0 free]
Total: 1 [74.29 GB] / in use: 1 [74.29 GB] / in no VG: 0 [0 ]
# fdisk /dev/hdb
The number of cylinders for this disk is set to 24321.
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)
Command (m for help): p
Disk /dev/hdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 24321 195358401 8e Linux LVM
Command (m for help): q
# pvscan
PV /dev/hda6 VG Ubuntu lvm2 [74.29 GB / 0 free]
Total: 1 [74.29 GB] / in use: 1 [74.29 GB] / in no VG: 0 [0 ]
# pvcreate /dev/hdb1
Physical volume "/dev/hdb1" successfully created
# pvscan
PV /dev/hda6 VG Ubuntu lvm2 [74.29 GB / 0 free]
PV /dev/evms/hdb1 lvm2 [186.31 GB]
Total: 2 [260.60 GB] / in use: 1 [74.29 GB] / in no VG: 1 [186.31 GB]
# vgcreate home /dev/evms/hdb1
Volume group "home" successfully created
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "Ubuntu" using metadata type lvm2
Found volume group "home" using metadata type lvm2
# vgdisplay -v home
Using volume group(s) on command line
Finding volume group "home"
--- Volume group ---
VG Name home
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 186.30 GB
PE Size 4.00 MB
Total PE 47694
Alloc PE / Size 0 / 0
Free PE / Size 47694 / 186.30 GB
VG UUID doTZj5-bjAc-Tu1q-FElV-GkSQ-Y17F-2wO4F8
--- Physical volumes ---
PV Name /dev/evms/hdb1
PV UUID 7lVW1I-bkBd-JqAY-ZmKr-NO87-uuRD-0AVyao
PV Status allocatable
Total PE / Free PE 47694 / 47694
# vgdisplay -v Ubuntu
Using volume group(s) on command line
Finding volume group "Ubuntu"
--- Volume group ---
VG Name Ubuntu
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.29 GB
PE Size 4.00 MB
Total PE 19018
Alloc PE / Size 19018 / 74.29 GB
Free PE / Size 0 / 0
VG UUID 6lxjFb-cNTB-JOlT-nKcU-AzuL-qO8P-Ynrp8P
--- Logical volume ---
LV Name /dev/Ubuntu/root
VG Name Ubuntu
LV UUID ZxC1fF-jkzK-kKBq-BdY6-4hfy-06S3-zUmdl7
LV Write Access read/write
LV Status available
# open 1
LV Size 71.38 GB
Current LE 18272
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:0
--- Logical volume ---
LV Name /dev/Ubuntu/swap_1
VG Name Ubuntu
LV UUID qzuY2w-MLmX-u5zj-VU7w-q4sF-IIr9-TR95a9
LV Write Access read/write
LV Status available
# open 2
LV Size 2.91 GB
Current LE 746
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:1
--- Physical volumes ---
PV Name /dev/hda6
PV UUID h3VFzZ-Xiaq-MJGN-Zxp9-pyKk-Cp2J-0YpTAG
PV Status allocatable
Total PE / Free PE 19018 / 0
# lvcreate -L 75G -n backup home
Logical volume "backup" created
# lvcreate -L 100G -n shibata home
Logical volume "shibata" created
# vgdisplay -v home
Using volume group(s) on command line
Finding volume group "home"
--- Volume group ---
VG Name home
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 186.30 GB
PE Size 4.00 MB
Total PE 47694
Alloc PE / Size 44800 / 175.00 GB
Free PE / Size 2894 / 11.30 GB
VG UUID doTZj5-bjAc-Tu1q-FElV-GkSQ-Y17F-2wO4F8
--- Logical volume ---
LV Name /dev/home/backup
VG Name home
LV UUID IGmFsr-KCJJ-dYB8-Vn7O-fFMB-cbmv-NxyNjq
LV Write Access read/write
LV Status available
# open 0
LV Size 75.00 GB
Current LE 19200
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:7
--- Logical volume ---
LV Name /dev/home/shibata
VG Name home
LV UUID tLrUnV-VRQo-uSUj-dB6N-mTKK-Qh9u-kt0OkV
LV Write Access read/write
LV Status available
# open 0
LV Size 100.00 GB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:8
--- Physical volumes ---
PV Name /dev/evms/hdb1
PV UUID 7lVW1I-bkBd-JqAY-ZmKr-NO87-uuRD-0AVyao
PV Status allocatable
Total PE / Free PE 47694 / 2894
# lvscan
ACTIVE '/dev/Ubuntu/root' [71.38 GB] inherit
ACTIVE '/dev/Ubuntu/swap_1' [2.91 GB] inherit
ACTIVE '/dev/home/backup' [75.00 GB] inherit
ACTIVE '/dev/home/shibata' [100.00 GB] inherit
# mke2fs -j /dev/home/backup
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
9830400 inodes, 19660800 blocks
983040 blocks (5.00%) reserved for the super user
First data block=0
600 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mke2fs -j /dev/home/shibata
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
13107200 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
800 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, 23887872
Writing inode tables: done
Creating journal (32768 blocks): 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.
# ls -l /dev/mapper/
total 0
brw------- 1 root root 254, 0 Oct 10 2007 Ubuntu-root
brw------- 1 root root 254, 1 Oct 10 2007 Ubuntu-swap_1
crw-rw---- 1 root root 10, 63 Oct 10 2007 control
brw------- 1 root root 254, 7 Oct 9 22:56 home-backup
brw------- 1 root root 254, 8 Oct 9 22:58 home-shibata
# cat /etc/fstab
# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/mapper/Ubuntu-root / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 /boot ext3 defaults 0 2
/dev/mapper/Ubuntu-swap_1 none swap sw 0 0
/dev/mapper/home-backup /home/backup ext3 defaults 0 2
/dev/mapper/home-shibata /home/shibata ext3 defaults 0 2
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
# mount -t ext2 /dev/mapper/home-shibata /mnt/
# cd /home/shibata/
# ls -la
total 20
drwxr-xr-x 2 shibata shibata 4096 Oct 9 21:25 .
drwxr-xr-x 3 root root 4096 Oct 10 2007 ..
-rw-r--r-- 1 shibata shibata 220 Oct 10 2007 .bash_logout
-rw-r--r-- 1 shibata shibata 414 Oct 10 2007 .bash_profile
-rw-r--r-- 1 shibata shibata 2227 Oct 10 2007 .bashrc
-rw-r--r-- 1 shibata shibata 0 Oct 9 21:25 .sudo_as_admin_successful
# cp -a .bash* .sudo_as_admin_successful /mnt/
# sync
# ls -la
total 20
drwxr-xr-x 2 shibata shibata 4096 Oct 9 21:25 .
drwxr-xr-x 3 root root 4096 Oct 10 2007 ..
-rw-r--r-- 1 shibata shibata 220 Oct 10 2007 .bash_logout
-rw-r--r-- 1 shibata shibata 414 Oct 10 2007 .bash_profile
-rw-r--r-- 1 shibata shibata 2227 Oct 10 2007 .bashrc
-rw-r--r-- 1 shibata shibata 0 Oct 9 21:25 .sudo_as_admin_successful
# rm .bash* .sudo_as_admin_successful
# cd ..
# umount /mnt/
# mount /home/shibata/
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/Ubuntu-root
73667824 1032816 68892904 2% /
varrun 509708 56 509652 1% /var/run
varlock 509708 4 509704 1% /var/lock
udev 509708 128 509580 1% /dev
devshm 509708 0 509708 0% /dev/shm
/dev/hda5 233303 13738 207118 7% /boot
/dev/mapper/home-shibata
103212320 131240 97838200 1% /home/shibata
# mkdir /home/backup
# ls -l
total 8
drwxr-xr-x 2 root root 4096 Oct 9 23:06 backup
drwxr-xr-x 3 root root 4096 Oct 9 23:06 shibata
# sync
# sync
# sync
# shutdown -r now
The system is going down for reboot NOW!om (pts/0) (Tue Oct 9 23:09:23 2007)



さて、リブート後。


$ ssh 192.168.0.xxx
shibata@192.168.0.xxx's password: 表示されず
Linux hcube.uriuri.com 2.6.15-26-server #1 SMP Fri Sep 8 21:00:37 UTC 2006 i686 GNU/Linux
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Last login: Tue Oct 9 21:32:25 2007 from 192.168.0.yyy
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/Ubuntu-root
73667824 1031468 68894252 2% /
varrun 509708 52 509656 1% /var/run
varlock 509708 4 509704 1% /var/lock
udev 509708 128 509580 1% /dev
devshm 509708 0 509708 0% /dev/shm
/dev/hda5 233303 13738 207118 7% /boot
/dev/mapper/home-backup
77409288 131228 73345900 1% /home/backup
/dev/mapper/home-shibata
103212320 131240 97838200 1% /home/shibata
$ ls -al
total 36
drwxr-xr-x 3 root root 4096 2007-10-09 23:06 .
drwxr-xr-x 4 root root 4096 2007-10-09 23:06 ..
-rw-r--r-- 1 shibata shibata 220 2007-10-10 06:24 .bash_logout
-rw-r--r-- 1 shibata shibata 414 2007-10-10 06:24 .bash_profile
-rw-r--r-- 1 shibata shibata 2227 2007-10-10 06:24 .bashrc
-rw-r--r-- 1 shibata shibata 0 2007-10-09 21:25 .sudo_as_admin_successful
drwx------ 2 root root 16384 2007-10-09 23:00 lost+found


0 件のコメント:

コメントを投稿