Problem setting up ext3 on LVM partition on 2 USB sticks
Posted: Tue Sep 25, 2012 11:44 am
Hello.
I'm trying to set up a photo album server on my Raspberry Pi. I've currently got about 30 gig of photos & videos.
I had been toying with the idea of using an external hard drive to store these on as although I can just about squeeze these onto the SD card, it doesn't leave any room for more photos in the future. I wasn't sure about leaving the hard-drive switched on all the time, and looked into energy saving devices controllable by the Pi to control the hard-drive. I couldn't find any with a UK plug socket for much under £50 though which seemed a bit excessive. There are USB controlled switches but I'd have to wire them up to mains plugs and I was a bit dubious about doing this safely. I found an eco-plug that would switch off plug sockets based on the power in a USB socket, but unfortunetley (and please correct me if I'm wrong), you can't turn off the 5V power to the USB sockets on the Pi as you can on some machines and so this wouldn't work.
Finally I saw PNY 32Gig USB sticks being sold for £9. I bought 2 of them with the plan to make a single volume out of them using LVM. However I've hit a problem trying to set up a single drive using LVM.
Here's what I did:
I first installed LVM:
My 2 32gb usb sticks when inserted are at sda, and sdb.
First I prepare the sticks to have lvm partitions on them. Not sure if nescesary, but doing it to be on safe side.
and use the following options:
d: remove existing partition
n p 1 (followed by few enters): create new primary partition
t 8e: set partition to be linux LVM
p: list new partition setup to ensure it's right
w: write changes & exit
Then repeat this for the 2nd usb stick at sdb
I now create LVM physical volumes on both usb sticks
I now create the LVM volume group to add the LVG physical volumes to:
I now add the second physical volume:
I check all's going well:
and get the following output:
I now create the logical volume. The lvcreate command requires a size to be specified or it won't run. As I want to have one big partition, I calculate the number of physical extents available and multiply them by the size of the physical extent. From the data above I have 4*15600.
Again I check all is well with the following command:
and get the following output:
And finaly I try and create a file system to sit in the logical volume:
this is where I hit problems. invariably I get the following error just after it's finished writing the inode table:
After rebooting vg0 is missing from /dev as are sda, sda1, sdb, and sdb1. lsusb often only lists one or occasionally neither of the usb sticks. I have to delete the logical volume, and the volume group, and then remove the usb sticks, reboot the pi, and re-insert them before it recognises the usb sticks again.
I haven't a clue why. The usb sticks are fine: they work on my linux netbook, and windows PC without any problems.
The only odd thing I've noticed is that when plugged directly into the Pi, the usb sticks feel quite warm. I've not know sticks to feel hot when inserted into a usb slot before. I have tried plugging them in through two different unpowered hubs. They are not recognised when plugged in either although they are recognised when plugged into my netbook via the unpowered hubs. I'm not sure if there is some sort of power issue here. My power supply provides 1A. I've had issues before with a faulty power supply causing random glitches, but I've tried setting up LVM several times now, always failing in the same way. Also since changing my power supply I've not had any other problems with my Pi.
I have tried setting up LVM on these 2 usb sticks on my linux netbook which runs ubuntu. It works. Oddly enough it's much slower when setting up the inode tables than the Pi, but I can create my file system on top of the logical volume, and can populate the resultant 60gb volume with files.
I've looked up the mkfs error. Some put it down to hardware problems. As far as I can tell my Pi, the power supply, and USB sticks are working (although the failure of the Pi to recognise the USB sticks when plugged in through a USB hub might indicate different). Sometimes they say it's due to having a single too big partition. I would be suprised if format would fail because there wasn't a partition before it, and besides it worked just fine on ubuntu (which is based on debian as is the rasbian os I am running my my Pi). The third problem can stem from partitions over 250gb, but mine is only 60gb and so should not be the problem.
I'd be most grateful for any suggestions people might have as to how to fix this problem, as I'm a little stumped.
I'm trying to set up a photo album server on my Raspberry Pi. I've currently got about 30 gig of photos & videos.
I had been toying with the idea of using an external hard drive to store these on as although I can just about squeeze these onto the SD card, it doesn't leave any room for more photos in the future. I wasn't sure about leaving the hard-drive switched on all the time, and looked into energy saving devices controllable by the Pi to control the hard-drive. I couldn't find any with a UK plug socket for much under £50 though which seemed a bit excessive. There are USB controlled switches but I'd have to wire them up to mains plugs and I was a bit dubious about doing this safely. I found an eco-plug that would switch off plug sockets based on the power in a USB socket, but unfortunetley (and please correct me if I'm wrong), you can't turn off the 5V power to the USB sockets on the Pi as you can on some machines and so this wouldn't work.
Finally I saw PNY 32Gig USB sticks being sold for £9. I bought 2 of them with the plan to make a single volume out of them using LVM. However I've hit a problem trying to set up a single drive using LVM.
Here's what I did:
I first installed LVM:
Code: Select all
sudo apt-get install lvm2First I prepare the sticks to have lvm partitions on them. Not sure if nescesary, but doing it to be on safe side.
Code: Select all
sudo fdisk /dev/sdad: remove existing partition
n p 1 (followed by few enters): create new primary partition
t 8e: set partition to be linux LVM
p: list new partition setup to ensure it's right
w: write changes & exit
Then repeat this for the 2nd usb stick at sdb
I now create LVM physical volumes on both usb sticks
Code: Select all
sudo pvcreate /dev/sda1
sudo pvcreate /dev/sdb1Code: Select all
sudo vgcreate vg0 /dev/sda1Code: Select all
sudo vgextend vg0 /dev/sdb1Code: Select all
sudo vgdisplayCode: Select all
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 60.94 GiB
PE Size 4.00 MiB
Total PE 15600
Alloc PE / Size 0 / 0
Free PE / Size 15600 / 60.94 GiB
VG UUID ytfNNg-xdAK-AA7P-3mxq-9V2g-0rQ0-GaEUul
Code: Select all
sudo lvcreate -L 62400 -nlv0 vg0Code: Select all
sudo lvdisplayCode: Select all
--- Logical volume ---
LV Name /dev/vg0/lv0
VG Name vg0
LV UUID 5vlRRf-kuQ1-aE1W-Sfe0-jlKf-3BSi-dB3bdn
LV Write Access read/write
LV Status available
# open 0
LV Size 60.94 GiB
Current LE 15600
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
Code: Select all
sudo mkfs -t ext3 -m 1 -v /dev/vg0/lv0It hangs at this point. Can't close it with Ctrl-C. If I ssh into a second shell, and try killing off the processes it has no effect. The only way I can close it down is by rebooting.ext3fs_mkdir: Attempt to read block from filesystem resulted in short read while creating root dir
After rebooting vg0 is missing from /dev as are sda, sda1, sdb, and sdb1. lsusb often only lists one or occasionally neither of the usb sticks. I have to delete the logical volume, and the volume group, and then remove the usb sticks, reboot the pi, and re-insert them before it recognises the usb sticks again.
I haven't a clue why. The usb sticks are fine: they work on my linux netbook, and windows PC without any problems.
The only odd thing I've noticed is that when plugged directly into the Pi, the usb sticks feel quite warm. I've not know sticks to feel hot when inserted into a usb slot before. I have tried plugging them in through two different unpowered hubs. They are not recognised when plugged in either although they are recognised when plugged into my netbook via the unpowered hubs. I'm not sure if there is some sort of power issue here. My power supply provides 1A. I've had issues before with a faulty power supply causing random glitches, but I've tried setting up LVM several times now, always failing in the same way. Also since changing my power supply I've not had any other problems with my Pi.
I have tried setting up LVM on these 2 usb sticks on my linux netbook which runs ubuntu. It works. Oddly enough it's much slower when setting up the inode tables than the Pi, but I can create my file system on top of the logical volume, and can populate the resultant 60gb volume with files.
I've looked up the mkfs error. Some put it down to hardware problems. As far as I can tell my Pi, the power supply, and USB sticks are working (although the failure of the Pi to recognise the USB sticks when plugged in through a USB hub might indicate different). Sometimes they say it's due to having a single too big partition. I would be suprised if format would fail because there wasn't a partition before it, and besides it worked just fine on ubuntu (which is based on debian as is the rasbian os I am running my my Pi). The third problem can stem from partitions over 250gb, but mine is only 60gb and so should not be the problem.
I'd be most grateful for any suggestions people might have as to how to fix this problem, as I'm a little stumped.