Script to automagically mount LVMs

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :-)

Moderator: Moderators

Script to automagically mount LVMs

Postby Azerthoth » Sat Jun 13, 2009 21:44

You can run the following script from your Sabayon LiveDVD. This is for those who chose to auto partition and have now done something to their systems that they need to go in and rescue it. This makes the process much much easier.
-------Instructions---------
Download the attached script.
Rename it to lvm-mount.sh
chmod a+x lvm-mount.sh
sh lvm-mount.sh


note that this script MUST be run as root.

There are also instructions for how to do a chroot that will print on your screen when the script has finished running.
Last edited by Azerthoth on Mon Jun 15, 2009 11:30, edited 1 time in total.
Azerthoth
Simple Hen
 
Posts: 86
Joined: Wed Dec 27, 2006 20:03
Location: Bethel, Alaska

Re: Script to automagically mount LVMs

Postby wolfden » Sat Jun 13, 2009 23:46

I shall sticky this
wolfden
Sharecropper
 
Posts: 9050
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: Script to automagically mount LVMs

Postby Fitzcarraldo » Sun Jun 14, 2009 1:51

Azerthoth, it would be great if you would add your How To to the SL Wiki: How to create a new article in the Sabayon Linux Wiki
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7981
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: Script to automagically mount LVMs

Postby Azerthoth » Sun Jun 14, 2009 2:36

I added it to my wiki entry I already had in place for manually mounting LVM. That way the bot in IRC just has to kick out the one link.

http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Mount_LVM
Azerthoth
Simple Hen
 
Posts: 86
Joined: Wed Dec 27, 2006 20:03
Location: Bethel, Alaska

Re: Script to automagically mount LVMs

Postby micia » Mon Jun 15, 2009 10:54

That script could be very useful!
If it is meant to be run as root, you could improve it to make it check for that.
You could add:
Code: Select all
if [ $UID -ne 0 ]; then
   echo "You need to be root to run this script!"
   exit 1
fi


at the beginning.

Thank you for this great script!
micia
Sagely Hen
 
Posts: 2718
Joined: Wed Nov 26, 2008 16:41

Re: Script to automagically mount LVMs

Postby Azerthoth » Mon Jun 15, 2009 11:32

Thanks, the change has been made. Editing the wiki version now too.
Azerthoth
Simple Hen
 
Posts: 86
Joined: Wed Dec 27, 2006 20:03
Location: Bethel, Alaska

Doesnt work for me

Postby martytin » Thu Feb 03, 2011 15:09

Hi,

neither the script nor the manual approach are working for me.

I use a Dell vostro 1510 dualboot and have Vista and Sabayon 5.x 64 KDE installed with default values (except for the boot manager installed on a Linux partition). But Sabayon uses LVM therefore.

Two weeks ago, after a rather large system update using sulfur the keyboard, mousepad and mouse are left dead.
Booting in save-mode quits with the message: "file not found"
I can't access Sabayon ever since!
I had to hard power off Linux three three times since. (Infrequently I had problems with unresponsive keyboard and mousepad before...but the USB mouse always worked and allowed me a (warm?) reboot.)

(I think there were 300+ updates and while I was having a shower I think the laptop began to beep ...after the update process was completed I had to leave the house so I could not check the 500 meters of log output...I guess there is something wrong with the xorg.conf.)

Here is my output from the terminal when I try to mount the LMV volume manually from a Sabayon 4r1-64 live DVD:

Code: Select all
[email protected] ~ $ su
Passwort:
sabayonx86-64 sabayonuser # pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/sda5  VolGroup00 lvm2 a-   211,81G 32,00M
sabayonx86-64 sabayonuser # lvdisplay /dev/VolGroup00
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                DxkBCv-vpQa-4NSd-Dvyd-16n9-bEqU-7770ho
  LV Write Access        read/write
  LV Status              NOT available
  LV Size                210,81 GB
  Current LE             6746
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                FxNLcu-3TDc-AMfh-J5en-mauB-InkY-lTRFf9
  LV Write Access        read/write
  LV Status              NOT available
  LV Size                992,00 MB
  Current LE             31
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

sabayonx86-64 sabayonuser # cd /mnt
sabayonx86-64 mnt # ls
cdrom  floppy  gentoo  livecd  sda5
sabayonx86-64 mnt # mkdir lvm
sabayonx86-64 mnt # vgscan --mknodes
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2
sabayonx86-64 mnt # lvchange -a y /dev/VolGroup00/LogVol00
sabayonx86-64 mnt # mount /dev/VolGroup00/LogVol00 /mnt/lvm
mount: wrong fs type, bad option, bad superblock on /dev/mapper/VolGroup00-LogVo                                                                                               l00,
       missing codepage or helper program, or other error
       Manchmal liefert das Syslog wertvolle Informationen – versuchen
       Sie  dmesg | tail  oder so

sabayonx86-64 mnt #

Code: Select all
sabayonx86-64 mnt # dmesg | tail
[  322.257327] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[  322.259273] sd 5:0:0:0: [sdb] 4030464 512-byte hardware sectors (2064 MB)
[  322.260597] sd 5:0:0:0: [sdb] Write Protect is off
[  322.260611] sd 5:0:0:0: [sdb] Mode Sense: 23 00 00 00
[  322.260616] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[  322.260625]  sdb: sdb1 sdb2
[  322.262236] sd 5:0:0:0: [sdb] Attached SCSI removable disk
[  322.262460] sd 5:0:0:0: Attached scsi generic sg2 type 0
[ 1113.011058] CE: hpet increasing min_delta_ns to 15000 nsec
[ 1358.602966] EXT4-fs: dm-0: not marked OK to use with test code.
sabayonx86-64 mnt #


I hope someone can give me a hint what to do now.

regards,

Martin

P.S.

Feels awkward having to linger around in the "newbies-forum" after 5 years or so using Sabayon as a second OS.
But I still feel that I know virtually nothing. Or Linux is just too complicated to be used as a productive system for someone who is only slightly above average computer user.
martytin
Young Hen
 
Posts: 25
Joined: Wed Jan 10, 2007 17:25


Return to Beginners|Newbies Area

Who is online

Users browsing this forum: No registered users and 2 guests

cron