Author Topic: (SOLVED) Changes in fstab not persistant for LiveUSB  (Read 1817 times)

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #15 on: October 24, 2012, 06:38:42 PM »
Quote
But at boot with the LiveUSB with Persistence, the swap partition was not activated and the "fstab" returned to:

/dev/root / rootfs defaults 0 0
none /proc proc defaults 0 0
none /dev/pts devpts defaults 0 0

What you did would have no effect on the fstab .....  it gets written at each boot.

What should have happened is that a Swap partition that is present in your system should have been mounted.

After booting with the change in place issue the following command in a terminal

swapon -s

It should return details of swap partitions available, something like this .....

Code: [Select]
[user@XPS ~]$ swapon -s
Filename                                Type            Size    Used    Priority
/dev/sdb3                               partition       8191996 0       -1
[user@XPS ~]$

This is the output of "swapon -s"

[guest@localhost ~]$ swapon -s
Filename            Type      Size   Used   Priority
[guest@localhost ~]$

My swap partition is located in the second hard drive sdb5

UPDATE:
Once I go to Configure Your Computer, Local Disks, Manage disk partitions, locate the swap partition in sdb5 and mount it, the output of "swapon -s" is:

[guest@localhost ~]$ swapon -s
Filename            Type      Size   Used   Priority
/dev/sdb5                               partition   8393924   0   -1
[guest@localhost ~]$

And, just to verify:
[guest@localhost ~]$ cat /proc/swaps
Filename            Type      Size   Used   Priority
/dev/sdb5                               partition   8393924   0   -1
[guest@localhost ~]$

But it is not mounted automatically at boot for the PCLOS LXDE 2012 in USB Pendrive.
« Last Edit: October 24, 2012, 07:13:23 PM by unist »
Registered Linux user #547260

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #16 on: October 24, 2012, 07:15:36 PM »
unist, Where is your swap partition? If it's on a USB drive, the drive must be attached during boot.


My swap partition is in the second hard drive sdb5
Registered Linux user #547260

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #17 on: October 24, 2012, 07:32:11 PM »

- Started mc as root (any file manager can be used as long as you are root.)
- Navigated to /media/disk/changes/Xfce0/etc/rc.d
- Copied rc.local from my running system - it's the same as used on the LiveUSB.
- As root, edited /media/disk/changes/Xfce0/etc/rc.d/rc.local.
- Added the lines for swap and saved.
- Booted on my test computer.

Tom


I already had applied it. In /media/LinuxUSB/changes/LXDE1/etc/rc.d/rd.local I have the following two lines:

SWAPP=`fdisk -l $VAR1 | grep swap | cut -d\  -f 1`
swapon $SWAPP

But the swap partition in sdb5 (Hard Disk Drive No. 2) is not mounted at boot for the PCLOS LXDE in USB Pendrive.
« Last Edit: October 24, 2012, 07:34:39 PM by unist »
Registered Linux user #547260

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11061
  • MLUs Forever!
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #18 on: October 25, 2012, 02:25:10 AM »
When running from the LiveUSB what output do you get from the following command?

fdisk -l $VAR1 | grep swap | cut -d\  -f 1

Please post back (copy & paste) the terminal output, including the command issued.

MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline sparerep

  • Jr. Member
  • **
  • Posts: 25
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #19 on: October 25, 2012, 11:42:28 AM »
If Just17's suggestion doesn't return your swap partition, the next question is:

Does "fdisk -l" show sdb5 as id=83 (Linux), or id=82 (swap).

If fdisk shows it as 83, this method will not attach sdb5 as swap because it depends on the results from fdisk.

Tom
« Last Edit: October 25, 2012, 12:06:39 PM by sparerep »

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #20 on: October 25, 2012, 07:33:29 PM »
When running from the LiveUSB what output do you get from the following command?

fdisk -l $VAR1 | grep swap | cut -d\  -f 1

Please post back (copy & paste) the terminal output, including the command issued.



This is the output:

[root@localhost guest]# fdisk -l $VAR1 | grep swap | cut -d\  -f 1
/dev/sdb5
[root@localhost guest]#
Registered Linux user #547260

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #21 on: October 25, 2012, 07:39:06 PM »
If Just17's suggestion doesn't return your swap partition, the next question is:

Does "fdisk -l" show sdb5 as id=83 (Linux), or id=82 (swap).

If fdisk shows it as 83, this method will not attach sdb5 as swap because it depends on the results from fdisk.

Tom

This is the output of fdisk -l

[root@localhost guest]# fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xad59c312

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS
/dev/sda2          206848  1953521663   976657408    7  HPFS/NTFS

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x360a360a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63   608349419   304174678+  83  Linux
/dev/sdb2       608349420   625137344     8393962+   5  Extended
/dev/sdb5       608349483   625137344     8393931   82  Linux swap / Solaris

Disk /dev/sdh: 4037 MB, 4037017600 bytes
100 heads, 36 sectors/track, 2190 cylinders, total 7884800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1   *        8064     7884799     3938368    c  W95 FAT32 (LBA)

Disk /dev/sdi: 32.0 GB, 32015679488 bytes
255 heads, 63 sectors/track, 3892 cylinders, total 62530624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a62f2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdi1               1    26640383    13320191+   c  W95 FAT32 (LBA)
/dev/sdi2   *    26640384    62529535    17944576   83  Linux
[root@localhost guest]#

So, the swap partition is 82 Linux swap / Solaris
Registered Linux user #547260

Offline sparerep

  • Jr. Member
  • **
  • Posts: 25
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #22 on: October 25, 2012, 10:14:50 PM »
I tried the stick in my Mythtv appliance and it didn't find swap. During installation I let the distro (LinHES) do the formatting and it set the type 0x83 on the swap partition. That wasn't found.

So, I tried a different method that found all swap. But, now I'm questioning my test method.

Here's what I did if you want to give it a try.

Mounted the stick on my main computer.

Created a directory /bin in root (as root, of course.)

/media/disk/changes/LXDE0/root/bin

Created a file and saved it into /bin, naming it add_swap, containing:

#!/bin/bash
#
# add swap
SWAPP=`blkid $1 | grep swap | cut -d: -f 1`
swapon $SWAPP

That's /media/disk/changes/LXDE0/root/bin/add_swap

Made that executable.

Edited /media/disk/changes/LXDE0/etc/rd.d/rc.local
#!/bin/sh
#
/root/bin/add_swap

That worked. But, the problem may have been having the commands in rc.local. So, it's possible that breaking the other two lines out of rc.local into an executable and having a pointer in rc.local would work, as well. That's something to try another day.

Tom

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #23 on: October 26, 2012, 06:59:59 PM »
I tried the stick in my Mythtv appliance and it didn't find swap. During installation I let the distro (LinHES) do the formatting and it set the type 0x83 on the swap partition. That wasn't found.

So, I tried a different method that found all swap. But, now I'm questioning my test method.

Here's what I did if you want to give it a try.

Mounted the stick on my main computer.

Created a directory /bin in root (as root, of course.)

/media/disk/changes/LXDE0/root/bin

Created a file and saved it into /bin, naming it add_swap, containing:

#!/bin/bash
#
# add swap
SWAPP=`blkid $1 | grep swap | cut -d: -f 1`
swapon $SWAPP

That's /media/disk/changes/LXDE0/root/bin/add_swap

Made that executable.

Edited /media/disk/changes/LXDE0/etc/rd.d/rc.local
#!/bin/sh
#
/root/bin/add_swap

That worked. But, the problem may have been having the commands in rc.local. So, it's possible that breaking the other two lines out of rc.local into an executable and having a pointer in rc.local would work, as well. That's something to try another day.

Tom


I applied the procedure, but no luck:

[root@localhost guest]# swapon -s
Filename            Type      Size   Used   Priority
[root@localhost guest]# cat /proc/swaps
Filename            Type      Size   Used   Priority
[root@localhost guest]#

UPDATE:
Once I apply swapon -a I obtain:

[root@localhost guest]# swapon -a
[root@localhost guest]# swapon -s
Filename            Type      Size   Used   Priority
/dev/sdb5                               partition   8393924   0   -1
[root@localhost guest]#

This is add_swap, which is executable:

#!/bin/bash
#
# add swap
SWAPP=`blkid $1 | grep swap | cut -d: -f 1`
swapon $SWAPP

And this is rc.local in rc.d:

#!/bin/sh
#
/root/bin/add_swap
« Last Edit: October 26, 2012, 07:13:23 PM by unist »
Registered Linux user #547260

Offline sparerep

  • Jr. Member
  • **
  • Posts: 25
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #24 on: October 27, 2012, 07:44:32 AM »
I've tested on three computers, and they don't respond the same way.

Two are newer, have sata drives, and respond to blkid.

The third, older Mythtv appliance with two pata drives, does not add swap when using blkikd: in fact, running blkid in a terminal hangs for 30-40 seconds, then returns nothing. I don't know if that's a motherboard or drive issue.

However, Mythtv does add swap when
/media/disk/changes/LXDE0/root/bin/add_swap
is:

#!/bin/bash
#
# add swap
SWAPP=`fdisk -l $VAR1 | grep swap | cut -d\  -f 1`
swapon $SWAPP

I have a couple of more computers I can test on, but don't know what to try next if it doesn't work for you.

Tom

Offline unist

  • Full Member
  • ***
  • Posts: 158
Re: (SOLVED) Changes in fstab not persistant for LiveUSB
« Reply #25 on: October 27, 2012, 09:17:00 AM »
Done it !!!!  :)

I reviewed both /media/LinuxUSB/changes/LXDE1/root/bin/add_swap and /media/LinuxUSB/changes/LXDE1/etc/rc.d/rc.local, and found that rc.local was not executable. I set properties for both files to allow anybody to View content, Change content and Execute. For add_swap I used this:

#!/bin/bash
#
# add swap
SWAPP=`blkid $1 | grep swap | cut -d: -f 1`
swapon $SWAPP

After reboot the output for swapon -s now is:

[root@localhost guest]# swapon -s
Filename            Type      Size   Used   Priority
/dev/sdb5                               partition   8393924   0   -1
[root@localhost guest]#

sparerep: thank you very much !!!
« Last Edit: October 27, 2012, 09:18:43 AM by unist »
Registered Linux user #547260