Bruce wrote:

> > sda2 is not really a partition. It contains the extended partitions.
> > In your case, sda5 and sda6.
> 
> Actually an extended partition is a partition, but it has sub-
> partitions.  All this stuff is avoided with a GUID Partition Table
> (GPT) which is a lot more sane in the world of large disk drives.

Ok, Bruce, I liked what you said about a GPT, did some research on it, and set 
up a new hard disk with it. Following are some results, and I'll appreciate any 
comments.

I found a very useful article here on installing a GPT:

http://www.ibm.com/developerworks/linux/library/l-gpt/index.html?ca=dgr-lnxw07GPT-Storagedth-lx&S_TACT=105AGY83&S_CMP=grlnxw07

The article gives several choices of programs to partition a disk; I chose 
gdisk. That's fine for me because I have Fedora 17 as a host system, and it 
uses both GPT and LVM to format the filesystem.

Using gdisk with a brand new, fresh disk.
First, do a listing:
#########
[root@alan-fedora alan]# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.4

Partition table scan:
   MBR: not present
   BSD: not present
   APM: not present
   GPT: not present

Creating new GPT entries.
Disk /dev/sda: 5860533168 sectors, 2.7 TiB Logical sector size: 512 bytes Disk 
identifier (GUID): 34ED1705-7876-4D24-A89B-155825BF7D18
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134 Partitions will be 
aligned on 2048-sector boundaries Total free space is 5860533101 sectors (2.7 
TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
#########

Now fire up gdisk and make a partition:
#########
[root@alan-fedora alan]# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.4

Partition table scan:
   MBR: not present
   BSD: not present
   APM: not present
   GPT: not present

Creating new GPT entries.

Command (? for help):
#########

I set up the partitions using the disk on which Fedora 17 is installed as a 
guide (this filesystem is on /dev/sdb).

Next print the new partition table (we're in gdisk now):
#########
Command (? for help): p
Disk /dev/sda: 5860533168 sectors, 2.7 TiB Logical sector size: 512 bytes Disk 
identifier (GUID): B46C766D-7CD1-458D-A7D4-63CC5024283D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134 Partitions will be 
aligned on 2048-sector boundaries Total free space is 5616237421 sectors (2.6 
TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048            4095   1024.0 KiB  EF02  BIOS boot 
partition
    2            4096         1028095   500.0 MiB   0700  Microsoft 
basic data
    3         1028096        34582527   16.0 GiB    8200  Linux swap
    4        34582528       244297727   100.0 GiB   8E00  Linux LVM
#########

The above link explains what the above stuff means.

Lastly, write the new partition table:
#########
Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING 
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.
#########

Double-check the installation:
#########
[root@alan-fedora alan]# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.4

Partition table scan:
   MBR: protective
   BSD: not present
   APM: not present
   GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 5860533168 sectors, 2.7 TiB Logical sector size: 512 bytes Disk 
identifier (GUID): B46C766D-7CD1-458D-A7D4-63CC5024283D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134 Partitions will be 
aligned on 2048-sector boundaries Total free space is 5616237421 sectors (2.6 
TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048            4095   1024.0 KiB  EF02  BIOS boot 
partition
    2            4096         1028095   500.0 MiB   0700  Microsoft 
basic data
    3         1028096        34582527   16.0 GiB    8200  Linux swap
    4        34582528       244297727   100.0 GiB   8E00  Linux LVM
#########

A question remains in my mind, about which I'll have to do more research: Does 
any more need to be done than what I did above with respect to creating 
partitions? I seem to recall reading that partition 2 might be formatted as 
ext4, but that makes no sense to me because the above link specifically 
mentions that it needs to be a FAT32 partition.


Now that the disk has been partitioned, I want to make an LVM filesystem. I 
found a very helpful article here, which I used to follow the instructions 
below:

https://wiki.archlinux.org/index.php/LVM

First make sure the device-mapper kernel module is loaded:
#########
modprobe dm-mod
#########

Now create the LVM stuff:
#########
[root@alan-fedora alan]# pvcreate /dev/sda4
   Writing physical volume data to disk "/dev/sda4"
   Physical volume "/dev/sda4" successfully created
#########

Display the LVM volumes.
This command seems to display ALL of the LVM volumes, including the one created 
by Fedora 17:
#########
[root@alan-fedora alan]# pvdisplay
   --- Physical volume ---
   PV Name               /dev/sdb3
   VG Name               vg_alan-fedora
   PV Size               2.73 TiB / not usable 30.00 MiB
   Allocatable           yes (but full)
   PE Size               32.00 MiB
   Total PE              89408
   Free PE               0
   Allocated PE          89408
   PV UUID               z00IIw-k1Ie-y8Uy-9ovN-pqZz-k2GR-kDItHD

   "/dev/sda4" is a new physical volume of "100.00 GiB"
   --- NEW Physical volume ---
   PV Name               /dev/sda4
   VG Name
   PV Size               100.00 GiB
   Allocatable           NO
   PE Size               0
   Total PE              0
   Free PE               0
   Allocated PE          0
   PV UUID               inre2u-eYeu-1uAH-p0Xh-50GZ-OKDQ-g2CFPf
#########

Next create a volume group:
#########
[root@alan-fedora alan]# vgcreate vg_alan-lfs /dev/sda4
   Volume group "vg_alan-lfs" successfully created
#########

Display the results:
#########
[root@alan-fedora alan]# pvdisplay
   --- Physical volume ---
   PV Name               /dev/sdb3
   VG Name               vg_alan-fedora
   PV Size               2.73 TiB / not usable 30.00 MiB
   Allocatable           yes (but full)
   PE Size               32.00 MiB
   Total PE              89408
   Free PE               0
   Allocated PE          89408
   PV UUID               z00IIw-k1Ie-y8Uy-9ovN-pqZz-k2GR-kDItHD

   --- Physical volume ---
   PV Name               /dev/sda4
   VG Name               vg_alan-lfs
   PV Size               100.00 GiB / not usable 4.00 MiB
   Allocatable           yes
   PE Size               4.00 MiB
   Total PE              25599
   Free PE               25599
   Allocated PE          0
   PV UUID               inre2u-eYeu-1uAH-p0Xh-50GZ-OKDQ-g2CFPf
#########

Now we have to make a logical volume.

Here's what lvdisplay shows for the Fedora installation:
#########
[root@alan-fedora alan]# lvdisplay
   --- Logical volume ---
   LV Path                /dev/vg_alan-fedora/lv_swap
   LV Name                lv_swap
   VG Name                vg_alan-fedora
   LV UUID                OjnAJ5-0moS-9cVc-zfZM-5rdt-EMFe-1xVXAC
   LV Write Access        read/write
   LV Creation host, time alan-fedora.alandomain, 2012-11-04 05:44:42 -0500
   LV Status              available
   # open                 2
   LV Size                17.38 GiB
   Current LE             556
   Segments               1
   Allocation             inherit
   Read ahead sectors     auto
   - currently set to     256
   Block device           253:0

   --- Logical volume ---
   LV Path                /dev/vg_alan-fedora/lv_home
   LV Name                lv_home
   VG Name                vg_alan-fedora
   LV UUID                DQUoiB-bNoy-p9kb-29fq-1N67-pNLM-VQa4FE
   LV Write Access        read/write
   LV Creation host, time alan-fedora.alandomain, 2012-11-04 05:44:42 -0500
   LV Status              available
   # open                 1
   LV Size                2.66 TiB
   Current LE             87252
   Segments               1
   Allocation             inherit
   Read ahead sectors     auto
   - currently set to     256
   Block device           253:2

   --- Logical volume ---
   LV Path                /dev/vg_alan-fedora/lv_root
   LV Name                lv_root
   VG Name                vg_alan-fedora
   LV UUID                ZvETul-E7sM-VYvf-z68s-Sl0M-EOg6-cLaYGh
   LV Write Access        read/write
   LV Creation host, time alan-fedora.alandomain, 2012-11-04 05:45:02 -0500
   LV Status              available
   # open                 1
   LV Size                50.00 GiB
   Current LE             1600
   Segments               1
   Allocation             inherit
   Read ahead sectors     auto
   - currently set to     256
   Block device           253:1
#########

Now create a logical volume taking up the rest of the LVM volume group on 
/dev/sda:
#########
[root@alan-fedora alan]# lvcreate -l +100%FREE vg_alan-lfs -n lv_root
   Logical volume "lv_root" created
#########

lvdisplay shows that this was added to the above listing:
#########
--- Logical volume ---
   LV Path                /dev/vg_alan-fedora/lv_home
   LV Name                lv_home
   VG Name                vg_alan-fedora
   LV UUID                DQUoiB-bNoy-p9kb-29fq-1N67-pNLM-VQa4FE
   LV Write Access        read/write
   LV Creation host, time alan-fedora.alandomain, 2012-11-04 05:44:42 -0500
   LV Status              available
   # open                 1
   LV Size                2.66 TiB
   Current LE             87252
   Segments               1
   Allocation             inherit
   Read ahead sectors     auto
   - currently set to     256
   Block device           253:2
#########

Make the volume groups "available":
#########
[root@alan-fedora alan]# vgscan
   Reading all physical volumes.  This may take a while...
   Found volume group "vg_alan-fedora" using metadata type lvm2
   Found volume group "vg_alan-lfs" using metadata type lvm2

[root@alan-fedora alan]# vgchange -ay
   3 logical volume(s) in volume group "vg_alan-fedora" now active
   1 logical volume(s) in volume group "vg_alan-lfs" now active 
[root@alan-fedora alan]#
#########

Finally, make the ext4 filesystem:
#########
[root@alan-fedora alan]# cd /dev/mapper

[root@alan-fedora mapper]# ls
control  vg_alan--fedora-lv_home  vg_alan--fedora-lv_root 
vg_alan--fedora-lv_swap  vg_alan--lfs-lv_root 

[root@alan-fedora mapper]# ls -l total 0 crw-------. 1 root root 10, 236 Nov  5 
18:53 control
lrwxrwxrwx. 1 root root       7 Nov  5 20:47 vg_alan--fedora-lv_home -> 
../dm-2
lrwxrwxrwx. 1 root root       7 Nov  5 20:47 vg_alan--fedora-lv_root -> 
../dm-1
lrwxrwxrwx. 1 root root       7 Nov  5 20:47 vg_alan--fedora-lv_swap -> 
../dm-0
lrwxrwxrwx. 1 root root       7 Nov  5 22:04 vg_alan--lfs-lv_root -> ../dm-3

[root@alan-fedora mapper]# mkfs.ext4 /dev/mapper/vg_alan--lfs-lv_root
mke2fs 1.42.3 (14-May-2012) Filesystem label= OS type: Linux Block size=4096 
(log=2) Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26213376 blocks
1310668 blocks (5.00%) reserved for the super user First data block=0 Maximum 
filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
#########

Next mount the root filesystem:
#########
[root@alan-fedora mapper]# mount /dev/mapper/vg_alan--lfs-lv_root /mnt/lfs
#########

That's as far as I got before I burned out and went to bed. Again, I'll 
appreciate any comments.

Alan
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to