How to mount the NAS disk?

Post Reply
LcL
Posts: 4
Joined: Sun Jan 22, 2012 11:26 am

How to mount the NAS disk?

Post by LcL » Sun Jan 22, 2012 11:30 am

I've connected NAS HDD to PC with Ubuntu linux.

How can I mount NAS linux partition?
sudo mount /dev/sda1 /mnt/nas
tell's me
mount: unknown filesystem type 'linux_raid_member'

Mijzelf
Posts: 6197
Joined: Mon Jun 16, 2008 10:45 am

Re: How to mount the NAS disk?

Post by Mijzelf » Sun Jan 22, 2012 1:16 pm

It's a bit more complicated. The rootfs is assembled in the initramfs. The main actions are this:

Code: Select all

#!/bin/sh
. /common.sh

APPS_IMAGE=sysroot/boot/images/apps
CONFIG_IMAGE=sysroot/boot/images/config
OEM_IMAGE=sysroot/boot/images/oem

mknod /dev/sda b 8 0
mknod /dev/sda1 b 8 1
mknod /dev/sda2 b 8 2

mknod /dev/sdb b 8 16
mknod /dev/sdb1 b 8 17

mknod /dev/md0 b 9 0
BFDDEV=/dev/md0_vg/BFDlv

echo "Checking for valid image in hard drives"
mkdir -p sysroot/boot
vgchange -ay
mount $BFDDEV sysroot/boot -o noatime
do_normal_boot

###
# Normal, platform independent lifeline boot. Mount images
# and set up the rootfs.
###
do_normal_boot()
{
        echo "Found Valid EMC Image in disk..."
        MNTOPTS=loop
        NFSDEBUGMOD=
        NFS_SERVER=
        NFS_ROOT=/home/soho/soho_root

        echo "Mounting apps image..."
        mkdir -p sysroot/mnt/apps
        if [ "$NFSDEBUGMOD" = "" ] 
        then    
                mount -o loop,ro $APPS_IMAGE sysroot/mnt/apps
        else 
                #for NFS debugging
                enable_network eth0
                echo "mount -t nfs -onolock $NFS_SERVER:$NFS_ROOT sysroot/mnt/apps"
                mount -t nfs -onolock $NFS_SERVER:$NFS_ROOT sysroot/mnt/apps
                sleep 2
        fi

        # mount config
        echo "Mounting config image..."
        losetup /dev/loop1 $CONFIG_IMAGE

        # we temporarily symlink /lib and /usr/lib to the apps image, so we can run
        # the dynamically linked fsck executable from that location in initrd context
        echo "Check config filesystem"
        ln -s /sysroot/mnt/apps/lib /lib
        mkdir -p /usr
        ln -s /sysroot/mnt/apps/usr/lib /usr/lib
        e2fsck -y /dev/loop1 > etc/fsck
        rm -rf /lib /usr/lib /usr

        mkdir -p sysroot/etc
        mount /dev/loop1 sysroot/etc -o noatime,sync

        # mount the branding image if it exists
        if [ -f $OEM_IMAGE ]; then
                mkdir -p sysroot/oem
                mount -o $MNTOPTS sysroot/boot/images/oem sysroot/oem
        fi
}
(This is extracted from /mount_images.sh and /common.sh)

I think in your case the most important part is the vgchange command. Don't know if it's available in bare Ubuntu. Maybe you need to install lvm-tools, or lvm, or lvm2.

LcL
Posts: 4
Joined: Sun Jan 22, 2012 11:26 am

Re: How to mount the NAS disk?

Post by LcL » Sun Jan 22, 2012 4:13 pm

I did it.

1) Load Ubuntu live USB (with additional space 512 MB for data)
2) run in terminal

Code: Select all

sudo apt-get mdadm
sudo apt-get lvm2
3) run DiskUtil and start Raid array with button in GUI

fgouvea
Posts: 11
Joined: Wed Oct 10, 2012 1:55 pm

Re: How to mount the NAS disk?

Post by fgouvea » Mon Oct 15, 2012 7:29 pm

Unfortunately it didn`t happen quite that simple.
I was running Ubuntu 12 liveCD

First note is that it was missing the INSTALL on apt-get. So, it is actually like this:

Code: Select all

sudo apt-get install mdadm
sudo apt-get install lvm2
But even then, when I tried the start Raid, I got the following error:
"not enough components to start".

I noticed the command pvs was not showing my logical volumes right. And even after the:

Code: Select all

sudo mdadm --assemble --scan
my partitions were only visible with

Code: Select all

pvs -a
Then I realized the missing part was (note the root prompt):

Code: Select all

# vgchange -ay
After that:

Code: Select all

# pvs
  PV         VG          Fmt  Attr PSize  PFree
  /dev/md0   md0_vg      lvm2 a-   20.00g    0 
  /dev/md1   2e26c579_vg lvm2 a-    2.71t    0 
We can see the logical volumes with lvdisplay:

Code: Select all

root@ubuntu:/media/apps/ram/lib# lvdisplay md0_vg
  --- Logical volume ---
  LV Name                /dev/md0_vg/BFDlv
  VG Name                md0_vg
  LV UUID                qTUQ6D-Gqpz-MkD5-31KZ-r87S-j9MS-YacLTz
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
   
  --- Logical volume ---
  LV Name                /dev/md0_vg/vol1
  VG Name                md0_vg
  LV UUID                6mFirc-TJem-wEq6-kyAd-nbD1-VGIF-Hi5lEo
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                16.00 GiB
  Current LE             4095
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2
   
root@ubuntu:/media/apps/ram/lib# lvdisplay 2e26c579_vg
  --- Logical volume ---
  LV Name                /dev/2e26c579_vg/lv1430e500
  VG Name                2e26c579_vg
  LV UUID                Azw2hh-fUtY-odRt-gfiF-tNpa-1f12-F9kmKN
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                2.71 TiB
  Current LE             710269
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

There they are!!!
So I could finally mount them with:

Code: Select all

mkdir /media/raid0
chmod 777 /media/raid0
mount /dev/md0_vg/BFDlv /media/raid0

mkdir /media/raid1
chmod 777 /media/raid1
mount /dev/md0_vg/vol1 /media/raid1

mkdir /media/raid2
chmod 777 /media/raid2
mount /dev/2e26c579_vg/lv1430e500 /media/raid2
Then I could finally mount the apps partition with:

Code: Select all

cd /media
mkdir apps
chmod 777 apps
mount -o loop,rw /media/raid0/images/apps /media/apps
This is how my mount points showed after all:

Code: Select all

root@ubuntu:/media/apps/ram/lib# df -h
Filesystem                          Size  Used Avail Use% Mounted on
/cow                                496M   97M  399M  20% /
udev                                488M  4.0K  488M   1% /dev
tmpfs                               199M  800K  198M   1% /run
/dev/sr0                            696M  696M     0 100% /cdrom
/dev/loop0                          667M  667M     0 100% /rofs
tmpfs                               496M   72K  496M   1% /tmp
none                                5.0M  4.0K  5.0M   1% /run/lock
none                                496M   80K  496M   1% /run/shm
/dev/mapper/md0_vg-BFDlv            4.0G  1.2G  2.6G  31% /media/raid0
/dev/mapper/md0_vg-vol1             2.8T  1.7T  1.1T  60% /media/raid1
/dev/loop1                          702M  441M  262M  63% /media/apps
/dev/mapper/2e26c579_vg-lv1430e500  2.8T  1.7T  1.1T  60% /media/raid1
I hope it helps!

urracaloca
Posts: 3
Joined: Wed Mar 25, 2015 7:33 pm

Re: How to mount the NAS disk?

Post by urracaloca » Wed Mar 25, 2015 8:05 pm

hello fgouvea

when I use pvg command I only see

PV VG Fmt Attr PSize PFree
/dev/md126 md0_vg lvm2 a-- 20,01g 0

and cannot see the /dev/md127 (which has the data) can you give to me some clue

Thanks in advance

Luis

svh
Posts: 1
Joined: Tue Oct 13, 2015 11:21 am

Re: How to mount the NAS disk?

Post by svh » Tue Oct 13, 2015 11:23 am

hi urracaloca,

were you able to recover your data partition?
I have a similar issue. Any help is welcome!

Post Reply