This ARCHIVE partition is on a 320GB Samsung disk (HD321KJ) which nearly covers the whole disk. Only 1st 2GB is used as SWAP partition just in case a running Linux installation may need or a Live CD may use during boot.
I want to keep all backup on this partition and need to free up the other disks for OS installation which currently hold them.
I intended to give the whole disk for archiving, so a single partition in single PV would have sufficed. But I created 3 partitions of 100GB size and then added them in the volume group (VG). The rationale is if the hard disk started giving problem; such as inode corruption, physical damage, bad bocks, then usually that will affect particular sectors or blocks and not the whole disk. And I can move data of particular physical volume (PV) using "pvmove" to a smaller hard disk (e.g. 120GB) if needed. I hope this granularity will help me in future.
Also, I decided to go for ext4 as it is superior to ext3.
I have done all of the following using openSUSE 11.2 Live CD as it has the latest tools and good support for ext4 (default FS on openSUSE 11.2 is ext4). Though the partitions have been created on the running Debian Lenny installation I had but it does not ext4 partition creation yet. So, the rest is how I have done the things.
Disk Structure
# fdisk -l /dev/sdb Disk /dev/sdb: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000931b4 Device Boot Start End Blocks Id System /dev/sdb1 1 261 2096451 82 Linux swap / Solaris /dev/sdb2 262 13315 104856255 8e Linux LVM /dev/sdb3 13316 26369 104856255 8e Linux LVM /dev/sdb4 26370 38913 100759680 8e Linux LVM
Create Physical Volumes (PV)
# pvcreate /dev/sdb2 # pvcreate /dev/sdb2 # pvcreate /dev/sdb2
Status of PV
# pvs PV VG Fmt Attr PSize PFree /dev/sdb2 vgarchive lvm2 a- 99.99G 0 /dev/sdb3 vgarchive lvm2 a- 99.99G 0 /dev/sdb4 vgarchive lvm2 a- 96.09G 0 # pvscan PV /dev/sdb2 VG vgarchive lvm2 [99.99 GB / 0 free] PV /dev/sdb3 VG vgarchive lvm2 [99.99 GB / 0 free] PV /dev/sdb4 VG vgarchive lvm2 [96.09 GB / 0 free] Total: 3 [296.07 GB] / in use: 3 [296.07 GB] / in no VG: 0 [0 ] # pvdisplay --- Physical volume --- PV Name /dev/sdb2 VG Name vgarchive PV Size 100.00 GB / not usable 6.69 MB Allocatable yes (but full) PE Size (KByte) 8192 Total PE 12799 Free PE 0 Allocated PE 12799 PV UUID 3JQwlp-l00C-ws7g-F4OJ-0RPi-mwd1-vFhUyC --- Physical volume --- PV Name /dev/sdb3 VG Name vgarchive PV Size 100.00 GB / not usable 6.69 MB Allocatable yes (but full) PE Size (KByte) 8192 Total PE 12799 Free PE 0 Allocated PE 12799 PV UUID Q4b9QY-RmEK-8QfJ-JPRs-vBhf-nLPs-8f3Aj5 --- Physical volume --- PV Name /dev/sdb4 VG Name vgarchive PV Size 96.09 GB / not usable 6.12 MB Allocatable yes (but full) PE Size (KByte) 8192 Total PE 12299 Free PE 0 Allocated PE 12299 PV UUID RWuFWt-1xtl-uJK5-RHKv-TojO-EaRD-xucbu6
Create Volume Group (VG)
vgcreate -s 8M vgarchive /dev/sdb2 /dev/sdb3 /dev/sdb4
Note: extent size of 8MB has been used instead of default 4MB because that leads to a maximum logical volume size of around 256GB. But I will be having a single logical volume of 296GB (see below).
Status of VG
# vgs VG #PV #LV #SN Attr VSize VFree vgarchive 3 1 0 wz--n- 296.07G 0 # vgdisplay --- Volume group --- VG Name vgarchive System ID Format lvm2 Metadata Areas 3 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 3 Act PV 3 VG Size 296.07 GB PE Size 8.00 MB Total PE 37897 Alloc PE / Size 37897 / 296.07 GB Free PE / Size 0 / 0 VG UUID fsZyxq-JAcA-NAPk-L1at-gzOb-UiXa-7ufVXE
Create Logical Volume (LV)
lvcreate -n lvarchive -l 37897 vgarchive
Note: Used all available extents.
Status of LV
# lvs LV VG Attr LSize Origin Snap% Move Log Copy% Convert lvarchive vgarchive -wi-ao 296.07G # lvscan ACTIVE '/dev/vgarchive/lvarchive' [296.07 GB] inherit # lvdisplay --- Logical volume --- LV Name /dev/vgarchive/lvarchive VG Name vgarchive LV UUID sGk5MF-WF1h-okA0-OGhZ-i6Hy-AmTH-gvOW0R LV Write Access read/write LV Status available # open 1 LV Size 296.07 GB Current LE 37897 Segments 3 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0
Create Partition
mkfs.ext4 -L Archive -m 1 /dev/vgarchive/lvarchive
Partition Tuning
Then I started to tune few parameters in the partition.Maximum mount count is disabled as I want to know how many times it has been mounted. But it may pose problem when the partition should be checked for errors. Some Linux operating systems check filesystem after an interval of maximum mounts. So, for regular interval check I am going to use time and it has been set to 3 months.
tune2fs -c -1 /dev/vgarchive/lvarchive tune2fs -i 3m /dev/vgarchive/lvarchive
Reserved 2GB size (524288 blocks) for filesystem operation.
tune2fs -r 524288 /dev/vgarchive/lvarchive
Set default mount options ACL and user_xattr.
tune2fs -o acl,user_xattr /dev/vgarchive/lvarchive
Status of Partition
# tune2fs -l /dev/vgarchive/lvarchive tune2fs 1.41.9 (22-Aug-2009) Filesystem volume name: Archive Last mounted on:So, thats it. The partition is ready and just need to mount it and move all recovered data here. adiĆ³s por ahora.Filesystem UUID: 082a3363-078a-47d5-933d-b6f197fe2b1b Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 19406848 Block count: 77613056 Reserved block count: 524288 Free blocks: 76346216 Free inodes: 19406837 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 1005 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Flex block group size: 16 Filesystem created: Sun Jan 17 09:27:16 2010 Last mount time: Sun Jan 17 09:33:15 2010 Last write time: Sun Jan 17 02:49:06 2010 Mount count: 1 Maximum mount count: -1 Last checked: Sun Jan 17 09:27:16 2010 Check interval: 7776000 (3 months) Next check after: Sat Apr 17 09:27:16 2010 Lifetime writes: 4872 MB 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: 7e31a891-aa72-4c87-81e1-2319d96bd220 Journal backup: inode blocks
0 comments:
Post a Comment