0

I would like to mount /dev/sda2. How am I supposed to do that?

Bellow is the output of fdisk, df, lvmdiskscan, lvdisplay, vgdisplay, lvscan.

[root@IctThtSoluti-06 ~]# fdisk -l

Disk /dev/sda: 1030.8 GB, 1030792151040 bytes
255 heads, 63 sectors/track, 125320 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: 0x00034e05

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1306     9972736   8e  Linux LVM

Disk /dev/mapper/vg_centos6264bit-lv_root: 8095 MB, 8095006720 bytes
255 heads, 63 sectors/track, 984 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: 0x00000000


Disk /dev/mapper/vg_centos6264bit-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 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: 0x00000000

[root@IctThtSoluti-06 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos6264bit-lv_root
                      7.3G  988M  6.0G  14% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             477M   64M  389M  15% /boot



[root@IctThtSoluti-06 ~]# lvmdiskscan
  /dev/ram0                     [      16.00 MiB]
  /dev/root                     [       7.54 GiB]
  /dev/ram1                     [      16.00 MiB]
  /dev/sda1                     [     500.00 MiB]
  /dev/vg_centos6264bit/lv_swap [       1.97 GiB]
  /dev/ram2                     [      16.00 MiB]
  /dev/sda2                     [       9.51 GiB] LVM physical volume
  /dev/ram3                     [      16.00 MiB]
  /dev/ram4                     [      16.00 MiB]
  /dev/ram5                     [      16.00 MiB]
  /dev/ram6                     [      16.00 MiB]
  /dev/ram7                     [      16.00 MiB]
  /dev/ram8                     [      16.00 MiB]
  /dev/ram9                     [      16.00 MiB]
  /dev/ram10                    [      16.00 MiB]
  /dev/ram11                    [      16.00 MiB]
  /dev/ram12                    [      16.00 MiB]
  /dev/ram13                    [      16.00 MiB]
  /dev/ram14                    [      16.00 MiB]
  /dev/ram15                    [      16.00 MiB]
  2 disks
  17 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume


[root@IctThtSoluti-06 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_centos6264bit/lv_root
  LV Name                lv_root
  VG Name                vg_centos6264bit
  LV UUID                GuVsuq-Q0II-gcjX-6Pdp-7azY-FPub-25YWYR
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              available
  # open                 1
  LV Size                7.54 GiB
  Current LE             1930
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/vg_centos6264bit/lv_swap
  LV Name                lv_swap
  VG Name                vg_centos6264bit
  LV UUID                Ukf2if-IlyB-95nM-8Gdq-XXI8-PcKT-fddsqR
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              available
  # open                 1
  LV Size                1.97 GiB
  Current LE             504
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1



[root@IctThtSoluti-06 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_centos6264bit
  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               9.51 GiB
  PE Size               4.00 MiB
  Total PE              2434
  Alloc PE / Size       2434 / 9.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               gG9yNW-Jq57-pFkY-oydY-5R4h-oHS0-W7QoWO


[root@IctThtSoluti-06 ~]# lvscan
  ACTIVE            '/dev/vg_centos6264bit/lv_root' [7.54 GiB] inherit
  ACTIVE            '/dev/vg_centos6264bit/lv_swap' [1.97 GiB] inherit

2 Answers 2

3

You can't mount /dev/sda2 directly. It is used by the logical volume manager, and the existing logical volumes are already mounted.

Expanding on the comments:

Currently you only have 10GB of your 1TB partitioned.

To extend your root volume you have two possibilities:

  1. Extend the size of your physical partition (/dev/sda2) (using fdisk and pvresize)
  2. Create a new partition (/dev/sda3) and add it to your volume group (using fdisk, pvcreate and vgextend)

After that increased the size of your volume group you can extend the size of your logical volume and the filesystem on it.

What you want to do is basically your choice, but keep in mind that you can't create an unlimited number of partitions on a disk.

I'm not going to describe the procedures, as I'm no expert in this and both possibilites have been described in detail by people better suited for this than me. Tutorials for this can easily be found on the internet.

5
  • OK... So how can I use the 1030 GB free space on it? df shows I have 6 GB free space.
    – bpgergo
    Oct 27, 2015 at 11:24
  • Do you want to know how to increase the size of the root volume? Oct 27, 2015 at 11:27
  • I just want to know, how can I start using this 1T disk, that appears in the fdisk -l result. It seems that currently I cannot copy data on it, or read files from it. I think I will need to mount it, but I'm not sure how.
    – bpgergo
    Oct 27, 2015 at 11:35
  • df -h shows vg_centos6264bit has only 7 GB space, although fdisk -l says /dev/sda have 1030 GB. Where is the missing disk space?
    – bpgergo
    Oct 27, 2015 at 11:41
  • apparently /dev/sda has a lot of free space that is not partitioned yet. So I need to create a new partition /dev/sda3
    – bpgergo
    Oct 27, 2015 at 12:06
0

1) create new physical partition /dev/sda3 (and set lvm flag on it ). Do this in parted

mkpart primary 0% 100%
set 3 lvm on
q

2) extend the existing volume group to include the new /dev/sda3 partition

VG_NAME=`vgdisplay  | grep "VG Name"  | awk '{print $3}'`
vgextend $VG_NAME /dev/sda3

3) create logical volume (replace x with size in GigaBytes)

LV_NAME=/dev/vg_centos6264bit/lv_data
lvcreate -L xG -n $LV_NAME $VG_NAME 

4) create file system on the logical volumes

mkfs.ext4 $LV_NAME

5) mount logical volumes

mkdir /data
mount $LV_NAME /data

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .