3

We have linux box running fedora. It has a small laptop hard drive running the OS and a 3ware RAID controller running 3 SATA drives RAID 5.

When we boot the computer and login, I run “fdisk –l” and it lists all the hda partitions. No /dev/sda. If I run “modprobe 3w-9xxx” and then run “fdisk –l” again, it shows all the hda1 through hda7 partitions with a single /dev/sda Obviously the /dev/sda isn’t mounted to a folder, nor is it formatted.

I checked the /etc/fstab file and it has the line: /dev/vbackup/lvbackup /backups xfs defaults 1 2

I’m guessing this means the /backups folder is mounted to this device /dev/vbackup /lvbackup

I know you need to format the drive using “mkfs.xfs –f /dev/sda” but I forget what to do is get /dev/sda to be /dev/vbackup/lvbackup to be mounted to /backups

Thanks in advance

here is the output for the /var/log/messages file

Aug 7 kernel: 3ware 9000 Storage Controller device driver for Linux v2.26.05.003-2.6.21. 
Aug 7 kernel: ACPI: PCI Interrupt 0000:04:0c.0[A] -> GSI 16 (level, low) -> IRQ 18 
Aug 7 kernel: 3w-9xxx: scsi1: Found a 3ware 9000 Storage Controller at -xfc5ffc00, IRQ: 18 
Aug 7 kernel: 3w-9xxx: scsi1: Firmware FE9X 2.08.00.006, BIOS BE9X 2.03.01.052, Ports: 8. 
Aug 7 kernel: scsi 1:0:0:0: Direct-Access AMCC 9500S-8 DISK 2.08 PQ: 0 ANSI: 3 
Aug 7 kernel: sd 1:0:0:0: [sda] 1953083392 512-byte hardwaresectors (999979 MB) 
Aug 7 kernel: sd 1:0:0:0: [sda] Write Protect is off 
Aug 7 kernel: sd 1:0:0:0: [sda] Write cache: enabled, read cache disabled, doesn't support DPO or FUA 
Aug 7 kernel: sd 1:0:0:0: [sda] 1953083392 512-byte hardware sectors (999979 MB) 
Aug 7 kernel: sd 1:0:0:0: [sda] Write Protect is off 
Aug 7 kernel: sd 1:0:0:0: [sda] Write cache: enabled, read cache disabled, doesn't support DPO or FUA 
Aug 7 kernel: sd 1:0:0:0: [sda] Write cache: enabled, read cache: disabled, doesn't support DPO or FUA 
Aug 7 kernel: sd 1:0:0:0: sda : unknown partition table 
Aug 7 kernel: sd 1:0:0:0: sd 1:0:0:0: [sda] Attached SCSI disk 
Aug 7 kernel: sd 1:0:0:0: sd 1:0:0:0: Attached scsi generic sg0 type 0 
Aug 7 scsi.agent[3511]: disk at /devices/pci0000:00/0000:00:1e.0/0000:03:02.0/0000:04:0c.0/host1/target1:0:0/1:0:0:0 
Aug 7 kernel: XFS mounting filesystem sda 

Blockquote

phill
  • 327
  • 2
  • 13
  • 20

5 Answers5

5

Careful! The advice given so far ignores the fact that it appears you have a disk partitioned using lvm. Formatting this may loose data!

Try the commands lvdisplay, pvdisplay, vgdisplay.

You can create an lvm volume without partitioning the drive. It may already be configured and mounted at that location.

Checked the /etc/fstab file and it has the line: /dev/vbackup/lvbackup /backups xfs defaults 1 2

I’m guessing this means the /backups folder is mounted to this device /dev/vbackup /lvbackup

No, the drive /dev/sda is added as a physical volume in the volume group "vbackup". The logical volume "lvbackup" has been created in this volume group. The logical volume ("/dev/vbackup/lvbackup") is mounted on the folder /backups.

If it's not formatted (which I suspect it already is), you would format the logical volume mkfs.xfs /dev/vbackup/lvbackup, then mount it.

I repeat - Do not partition the drive with fdisk. Do not format the drive with mkfs. I strongly suspect it's already formatted and mounted. It's running lvm on the raw drive, and so isn't partitioned either.

Read up on lvm.

If it's already configured, but just didn't come up with the raid controller, try this:

vgchange -a y

mount /backups

Alternatively... Due warnings aside, let's assume you have a new (replacement?) drive and you want it to mount in place of the old drive. Here's the commands you'd use to replicate the prior config (as best I can tell from fstab.)

pvcreate /dev/sda

vgcreate vbackup /dev/sda

lvcreate -L 900G -n lvbackup vbackup

vgchange -a y

mkfs.xfs /dev/vbackup/lvbackup

mount /dev/vbackup/lvbackup /backups

Good luck!

jmanning2k
  • 302
  • 2
  • 9
  • +1 Now we get closer to a helpful answer. – Ludwig Weinzierl Aug 07 '09 at 20:13
  • thats ok.. i don't need the data.. i just deleted and recreated the RAID Arrary and followed the commands assuming the drive is a new replacement. I got as far as the "lvcreate -L -n lvbackup vbackup" however it throws an error saying "invalid argument -n, error parsing of command line" – phill Aug 07 '09 at 20:53
  • figured it out.. "lvcreate -L 900GB -n lvbackup vbackup .. That solutions helps.. just gotta figure out how to test this.. – phill Aug 07 '09 at 21:22
  • sorry I had , but sf ate it as html – jmanning2k Aug 19 '09 at 13:00
2

Simpler way to use parted. Assuming the drive to partition is /dev/sda: To create partition start GNU parted as follows:

parted /dev/sda
Creates a new gpt disklabel
mklabel gpt
Create 4GB partition size:
mkpart primary 0 4G
Quit and save the changes:
quit
Use mkfs to format file system:
sudo mkfs.xfs /dev/sda1
Mount it :
sudo mkdir /backup && sudo mount -t xfs /dev/sda1 /backup
Ali Mezgani
  • 3,810
  • 2
  • 23
  • 36
1

You need to use fdisk to partition it, the different numbers (ie /dev/sda1) are for different partitions. Here is a link to a partitioning tutorial using fdisk.

Then once you have the partitions, you can use the mkfs programs to create the filesystem on that partition. Once you have done that, you can mount it.

Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
  • i ran fdisk /dev/sda and it now mounts to /backups.. once I run fdisk, won't I need to run mkfs.xfs ? I thought its supposed to say /dev/sda1 after running fdisk? – phill Aug 07 '09 at 18:36
  • yea i'm using the w and it says its syncing disks and won't be effective until a reboot or something – phill Aug 07 '09 at 18:57
  • now that i rebooted, ran modprobe 3w-9xxx, and then 'fdisk -l', it says Disk /dev/sda doesn't contain a valid partition table – phill Aug 07 '09 at 18:59
  • what distro? I might start by adding the module so it is loaded at boot... – Kyle Brandt Aug 07 '09 at 19:22
  • Also, any additional error messages from the demsg command or in /var/log/messages ? – Kyle Brandt Aug 07 '09 at 19:24
  • fedora.. when i run demsg it says "bash: demsg: command not found" .. i'll put what was in the /var/log/messages file above – phill Aug 07 '09 at 19:41
  • Should be 'dmesg', but the above output is useful. – jmanning2k Aug 07 '09 at 20:04
1

When we boot the computer and login, I run “fdisk –l” and it lists all the hda partitions.

OK

No /dev/sda.

If I run “modprobe 3w-9xxx” and then run “fdisk –l” again, it shows all the hda1 through hda7 partitions with a single /dev/sda

Hm, when you loaded the appropriate kernel module the device /dev/sda showed up, so far so good. If you don't see /dev/sda1, etc. it means your drive is not partitioned yet.

Obviously the /dev/sda isn’t mounted to a folder, nor is it formatted.

Maybe, but there is no way to learn that from fdisk -l. What does mount say?

I checked the /etc/fstab file and it has the line: /dev/vbackup/lvbackup /backups xfs defaults 1 2

/dev/vbackup/lvbackup is another story, but let's see.

I’m guessing this means the /backups folder is mounted to this device /dev/vbackup /lvbackup

I'd say the device /dev/vbackup/lvbackup will be mounted to the directory /backups either at boot or if you do mount -a. I doesn't say that it is currently mounted. Use either /etc/mtab or mount to find that out.

I know you need to format the drive using “mkfs.xfs –f /dev/sda”

You usually want to format a partition like /dev/sda1 and not /dev/sda.

but I forget what to do beyond that as far as getting the drive properly mounted to a different device name? Any ideas?

Actually you can't mount a drive to a device name. The device name is created by the system for you, either at start up or when the driver is loaded. You can influence this but it has nothing to do with mounting.

Ludwig Weinzierl
  • 1,170
  • 1
  • 11
  • 22
  • i guess i was arbitrary about what i'm trying to accomplish. the /dev/sda is supposed to be /dev/vbackup/lvbackup which is mounted to the backups folder. i guess my question is what do i need to do to make the /dev/sda into /dev/vbackup/lvbackup so the fstab can mount this device to /backups ? thanks in advance – phill Aug 07 '09 at 19:32
  • @phill: Ah OK, /dev/vbackup/lvbackup is a device that belongs to the logical volume manager (LVM). I haven't worked with LVM and I don't know how to configure it, sorry. – Ludwig Weinzierl Aug 07 '09 at 19:57
  • @phill: In my opinion you'll need to format the logical unit: sudo mkfs.xfs /dev/vbackup/lvbackup instead of sudo mkfs.xfs /dev/sda. But as I said, I never used LVM, so be careful. – Ludwig Weinzierl Aug 07 '09 at 19:58
0

Would symlinking work in this case? I have never done it with devices before

ln -s /dev/vbackup/lvbackup /dev/sdXn 

You could then use /dev/sdXn in your fstab

RateControl
  • 1,207
  • 9
  • 20