linux - LVM mount physical disk for backups
2013-07
I have a home server running Centos 6.4. There are 2 400GB physical disks, and I believe I have 1 logical volume over one of the disks. I want to mount the 2nd disk under /backup and use it for backups only (my thinking was to keep backup data on a separate physical device).
- Are my assumptions about my set up correct?
- Should I add the 2nd disk to the LVM, and if so how do I ensure that only backup data goes to the 2nd disk?
- Should I the disk some other way
I've included some paired down output that I hope will be useful:
[root@server ~]# fdisk -l
Disk /dev/sda: 400.1 GB, 400088457216 bytes
...
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 48642 390198272 8e Linux LVM
Disk /dev/sdb: 400.1 GB, 400088457216 bytes
...
Device Boot Start End Blocks Id System
/dev/sdb1 1 48642 390710272 83 Linux
Disk /dev/mapper/vg_server-lv_root: 53.7 GB, 53687091200 bytes
...
Disk /dev/mapper/vg_server-lv_swap: 8405 MB, 8405385216 bytes
...
Disk /dev/mapper/vg_server-lv_home: 337.5 GB, 337469505536 bytes
...
[root@server ~]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_server-lv_root
53G 3.5G 47G 7% /
tmpfs 4.2G 0 4.2G 0% /dev/shm
/dev/sda1 508M 68M 415M 14% /boot
/dev/mapper/vg_server-lv_home
333G 41G 275G 13% /home
[root@server ~]# pvs --all
PV VG Fmt Attr PSize PFree
/dev/ram0 --- 0 0
/dev/ram1 --- 0 0
/dev/ram10 --- 0 0
/dev/ram11 --- 0 0
/dev/ram12 --- 0 0
/dev/ram13 --- 0 0
/dev/ram14 --- 0 0
/dev/ram15 --- 0 0
/dev/ram2 --- 0 0
/dev/ram3 --- 0 0
/dev/ram4 --- 0 0
/dev/ram5 --- 0 0
/dev/ram6 --- 0 0
/dev/ram7 --- 0 0
/dev/ram8 --- 0 0
/dev/ram9 --- 0 0
/dev/root --- 0 0
/dev/sda1 --- 0 0
/dev/sda2 vg_server lvm2 a-- 372.12g 0
/dev/sdb1 --- 0 0
/dev/vg_server/lv_home --- 0 0
/dev/vg_server/lv_swap --- 0 0
Edit
Further output as requested
[root@server ~]# cat '/proc/partitions'
major minor #blocks name
8 0 390711384 sda
8 1 512000 sda1
8 2 390198272 sda2
8 16 390711384 sdb
8 17 390710272 sdb1
253 0 52428800 dm-0
253 1 8208384 dm-1
253 2 329560064 dm-2
You appear to have 3 logical volumes: root, /home, and swap. There's no reason to add the backup drive to LVM. If you do, then you can specify which disk a volume should be allocated on when you create it, though in your case, your first disk is already 100% allocated, so the new disk is the only place a new volume could go.
I'm trying to mount an LVM2 volume, but all the instructions I see online say to mount the Volume Group, such as 'mkdir -p /mnt/VolGroup00/LogVol00' but I don't know how to figure out the name of it. I see the drive in Palimpsest, and that's all the info I know. How do I do this?
Faced this problem a while ago, I'd posted this on my blog
List out all your partitions, type
linux:/ # lvmdiskscan
You will get a list of something like this
File descriptor 3 left open
File descriptor 4 left open
/dev/dm-0 [ 9.67 GB]
/dev/sda1 [ 78.41 MB]
/dev/dm-1 [ 6.44 GB]
/dev/sda2 [ 115.52 GB]
/dev/dm-2 [ 2.00 GB]
/dev/sda3 [ 18.11 GB] LVM physical volume
/dev/sda5 [ 15.33 GB]
Make a note of /dev/dm-x
, those are the devices which correspond to the LVM partitions. Also do note the sizes.
Next, type lvdisplay to show a detailed list of all logical volumes available.
lvdisplay |more
LV Name /dev/system/home
VG Name system
LV UUID 1QP9XM-vlKi-umNO-CXvV-TnZN-RCLk-e1FDIr
LV Write Access read/write
LV Status available
# open 1
LV Size 9.67 GB
Current LE 2475
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
— Logical volume —
LV Name /dev/system/root
VG Name system
LV UUID D1fKUJ-uU1C-jlVB-4imh-rrgy-FQu0-TC2Ssm
LV Write Access read/write
LV Status available
# open 1
LV Size 6.44 GB
Current LE 1649
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
— Logical volume —
LV Name /dev/system/swap
VG Name system
LV UUID w5LqIb-xvcr-Xsbk-y3wg-lT3i-LqdN-GFK8Mi
LV Write Access read/write
LV Status available
# open 0
LV Size 2.00 GB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
Now from the above set of data we can deduce that my /home
partition, of size 9.67 GB is available as LV group /dev/system/home
on /dev/dm-0
Now that we know where the partition is available, we can proceed with the mounting using the mount command, as
mount /dev/md-0 /home
And there you go, your LV partition is mounted!
You can get a list of volume names by running lvscan
.
The output will look like
/dev/VG1/LV1
/dev/VG1/LV2
/dev/VG2/LV3
i.e. with the volume group names in the middle and logical volumes at the end. See if any of them correspond to the information in Palimpset.
Also, compare to the list of disks already mounted (mount
), and see which one isn't there. It might look a little different, e.g.:
$ mount
/dev/mapper/VG1-LV1 is mounted on /usr
/dev/mapper/VG1-LV2 is mounted on /home
You can see where the volume group and logical volume appear at the end.
Once you've found the right one, mount it in the usual way:
mount /dev/VG2/LV3 /mnt