virtualboxで仮想ドライブの容量が不足したので拡張してみたが失敗したようだ

kinneko@BuildSV:~$ cd VirtualBox\ VMs/
kinneko@BuildSV:~/VirtualBox VMs$ ls
livedroid_squeeze  livetest  lucid10.04
kinneko@BuildSV:~/VirtualBox VMs$ cd lucid10.04/
kinneko@BuildSV:~/VirtualBox VMs/lucid10.04$ ls
Logs  lucid10.04.vbox  lucid10.04.vbox-prev  lucid10.04.vdi
kinneko@BuildSV:~/VirtualBox VMs/lucid10.04$ vbox
vboxheadless  vboxmanage    vboxsdl       vboxwebsrv    
kinneko@BuildSV:~/VirtualBox VMs/lucid10.04$ vboxmanage modifyhd lucid10.04.vdi --resize 30820 
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

一旦仮想マシンから削除して、再度設定する。
仮想メディアマネージャーで、サイズが増えているのを確認する。
マシンを起動する。
パーティションにswapがあるので、そのまま伸ばすわけにはいかない。

kinneko@kinneko-desktop:~$ sudo fdisk -l /dev/sda

Disk /dev/sda: 32.3 GB, 32317112320 bytes
255 heads, 63 sectors/track, 3928 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00037d6f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1996    16026624   83  Linux
/dev/sda2            1996        2089      747521    5  Extended
/dev/sda5            1996        2089      747520   82  Linux swap / Solaris

swapをとめる。

kinneko@kinneko-desktop:~$ sudo swapoff /dev/sda5

swapと拡張パーティションヘッダを削除する。

kinneko@kinneko-desktop:~$ sudo fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 32.3 GB, 32317112320 bytes
255 heads, 63 sectors/track, 3928 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00037d6f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1996    16026624   83  Linux
/dev/sda2            1996        2089      747521    5  Extended
/dev/sda5            1996        2089      747520   82  Linux swap / Solaris

Command (m for help): d
Partition number (1-5): 5

Command (m for help): p

Disk /dev/sda: 32.3 GB, 32317112320 bytes
255 heads, 63 sectors/track, 3928 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00037d6f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1996    16026624   83  Linux
/dev/sda2            1996        2089      747521    5  Extended

Command (m for help): d
Partition number (1-5): 2

Command (m for help): p

Disk /dev/sda: 32.3 GB, 32317112320 bytes
255 heads, 63 sectors/track, 3928 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00037d6f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1996    16026624   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

動作しているパーティションのサイズ変更はできないので、一旦シャットダウンして、インストールディスクで起動する。
お試しで起動する。
dorpbearを入れるには、リポジトリデータベースのコメントアウトして、パッケージデータベースをアップデート。
インストールする。
お試しではユーザーアカウントがないので、terminalを起動してrootにパスワードを設定する。

ubuntu@ubuntu:~$ sudo passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

リモートから接続。


partedはパスにいないようだ。

root@ubuntu:~# export PATH=/sbin:$PATH
root@ubuntu:~# parted /dev/sda
GNU Parted 2.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 32.3GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  16.4GB  16.4GB  primary  ext4         boot

(parted) resize 1                                                         
WARNING: you are attempting to use parted to operate on (resize) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs.  We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Start?  [1049kB]?                                                         
End?  [16.4GB]? 29.5GB                                                    
Error: File system has an incompatible feature enabled.  Compatible features are
has_journal, dir_index, filetype, sparse_super and large_file.  Use tune2fs or
debugfs to remove features.
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 32.3GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  16.4GB  16.4GB  primary  ext4         boot

(parted) quit 

うまくできない。
exit4には対応できてないのだろうか。

root@ubuntu:~# tune2fs -l /dev/sda1
tune2fs 1.41.11 (14-Mar-2010)
Filesystem volume name:   <none>
Last mounted on:          /
Filesystem UUID:          40222320-7286-4144-ae2d-06485c0c7d58
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              1001712
Block count:              4006656
Reserved block count:     200332
Free blocks:              205400
Free inodes:              574854
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      978
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8144
Inode blocks per group:   509
Flex block group size:    16
Filesystem created:       Thu Mar  8 02:56:44 2012
Last mount time:          Thu Mar  8 06:39:25 2012
Last write time:          Thu Mar  8 07:25:08 2012
Mount count:              3
Maximum mount count:      20
Last checked:             Thu Mar  8 02:56:44 2012
Check interval:           15552000 (6 months)
Next check after:         Tue Sep  4 02:56:44 2012
Lifetime writes:          18 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:	          256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      e630d786-36b9-4c51-881d-96faf53494c6
Journal backup:           inode blocks

確かに、指摘されたfeaturesをサポートしている。
属性を削除する。

root@ubuntu:~# debugfs -w /dev/sda1
debugfs 1.41.11 (14-Mar-2010)
debugfs:  features -has_journal -dir_index -filetype -sparse_super -large_file
Filesystem features: ext_attr resize_inode extent flex_bg huge_file uninit_bg dir_nlink extra_isize
debugfs:  quit

リトライ。
が、同じ。
属性が消えてない?

root@ubuntu:~# tune2fs -l /dev/sda1 | grep features
Filesystem features:      ext_attr resize_inode extent flex_bg huge_file uninit_bg dir_nlink extra_isize

間違いなく消えている。


あ、逆か... コンパチのを表示してただけなのね... orz
英語ちゃんと読め....

root@ubuntu:~# debugfs -w /dev/sda1
debugfs 1.41.11 (14-Mar-2010)
debugfs:  features +has_journal +dir_index +filetype +sparse_super +large_file
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
debugfs:  features -ext_attr -resize_inode -extent -flex_bg -huge_file -uninit_bg -dir_nlink -extra_isize
Filesystem features: has_journal dir_index filetype sparse_super large_file
debugfs:  quit
root@ubuntu:~# tune2fs -l /dev/sda1 | grep features
Filesystem features:      has_journal dir_index filetype sparse_super large_file

リリトライ。

root@ubuntu:~# parted /dev/sda
GNU Parted 2.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 32.3GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  16.4GB  16.4GB  primary  ext3         boot

(parted) resize 1                                                         
WARNING: you are attempting to use parted to operate on (resize) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs.  We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Start?  [1049kB]?                                                         
End?  [16.4GB]? 30GB                                                      
Warning: The file system has the 'dir_index' feature enabled.  Parted can only
resize the file system if it disables this feature.  You can enable it later by
running 'tune2fs -O dir_index DEVICE' and then 'e2fsck -fD DEVICE'.
Ignore/Cancel? I                                                          
Warning: A resize operation on this file system will use EXPERIMENTAL code
that MAY CORRUPT it (although no one has reported any such damage yet).
You should at least backup your data first, and run 'e2fsck -f' afterwards.
OK/Cancel? OK                                                             
Warning: Block 32767 shouldn't have been marked (0, 1)!                   
Warning: Block 32768 shouldn't have been marked (1, 0)!                   
Warning: Block 32769 shouldn't have been marked (2, 0)!                   
Warning: Block 32767 shouldn't have been marked (0, 1)!                   
(snip)
ext2_block_relocator_flush: blocks not in order!
ext2_block_relocator_flush: blocks not in order!
(snip)

"ext2_block_relocator_flush: blocks not in order!"が、ずっと終わんないです... orz
ダメかも。