Find the answer to your Linux question:
Results 1 to 9 of 9
My basic idea was to move one directory to a bigger disk. I used this page to do that: embraceubuntu + .com/2006/01/29/move-home-to-its-own-partition/ And here are the steps what were proceeded: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2011
    Posts
    4

    Mount error when moving a directory to another disk


    My basic idea was to move one directory to a bigger disk.
    I used this page to do that: embraceubuntu + .com/2006/01/29/move-home-to-its-own-partition/
    And here are the steps what were proceeded:

    Code:
    mkdir /mnt/newpostgresql
    sudo mount -t ext4 /dev/sdb1 /mnt/newpostgresql
    cd /var/lib/postgresql
    find . -depth -print0 | cpio --null --sparse -pvd /mnt/newpostgresql
    umount /mnt/newpostgresql
    mv /var/lib/postgresql /var/lib/old_postgresql
    mkdir /var/lib/postgresql
    mount /dev/sdb1 /var/lib/postgresql
    /etc/fstab ->
    /dev/sdb1 /var/lib/postgresql ext4 nodev,nosuid 0 2
    restart
    Code:
    rm -r /var/lib/old_postgresql
    After rebooting I had the following error:
    "Serious error where found while checking the disk drive for ..."

    There is an option to skip this error, but it's quite to inconvient to do this every boot.

    I searched many places, but I couldn't find what could cause the problem. Previously I also moved my home directory to the same disk.
    Now I also have the home directory in the /var/lib/postgresql
    Here is my /etc/fstab:
    Code:
    # /etc/fstab: static file system information.
    #
    # Use 'blkid -o value -s UUID' to print the universally unique identifier
    # for a device; this may be used with UUID= as a more robust way to name
    # devices that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    nodev,noexec,nosuid 0       0
    # / was on /dev/sda1 during installation
    UUID=2c5347a2-b829-4e4d-b82b-c4d7b3ea0dd5 /               ext4    errors=remount-ro 0       1
    # swap was on /dev/sda5 during installation
    UUID=022af060-e909-4d12-a532-8834b319e75c none            swap    sw              0       0
    /dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
    /dev/sdb1 /home ext4 nodev,nosuid 0 2
    /dev/sdb1 /var/lib/postgresql ext4 nodev,nosuid 0 2

    Any help or suggestion is appreciated.

    Thanks a lot
    Aron

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Hi and Welcome !

    /dev/sdb1 /home ext4 nodev,nosuid 0 2
    /dev/sdb1 /var/lib/postgresql ext4 nodev,nosuid 0 2
    Check /etc/fstab file. You are assigning two mount points to same partition.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Just Joined!
    Join Date
    Sep 2011
    Posts
    4
    Thanks your reply!
    That partition is my second disk, and I would like to achieve to have my /home and /var/lib/postgresql in the bigger disk. Isn't that possible to create to mount point in one partition? Should I create a separate partition for /var/lib/postgresql?

  4. $spacer_open
    $spacer_close
  5. #4
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,023
    Hello there!
    sdb would be the disk, sdb1 is a mount point. You'll need to have a second mount point to assign your /var directory.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  6. #5
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Its not possible to assign same mount point to two different locations. However, you can assign as many mount points as you like inside a single partition. In other words, path must be different. Best example is, / and /home. Both exist in single partition but path is different. Note that / must be mounted before /home.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  7. #6
    Just Joined!
    Join Date
    Sep 2011
    Posts
    4
    Hm, I see. Does it mean, that I should've done this process?:

    Code:
    mkdir /mnt/newpostgresql
    sudo mount -t ext4 /dev/sdb2/mnt/newpostgresql
    cd /var/lib/postgresql
    find . -depth -print0 | cpio --null --sparse -pvd /mnt/newpostgresql
    umount /mnt/newpostgresql
    mv /var/lib/postgresql /var/lib/old_postgresql
    mkdir /var/lib/postgresql
    mount /dev/sdb2 /var/lib/postgresql
    /etc/fstab ->
    /dev/sdb2 /var/lib/postgresql ext4 nodev,nosuid 0 2
    restart 
    rm -r /var/lib/old_postgresql
    Is there a way to fix this mounting without losing data under /var/lib/postgresql (a big postgresql db is there)? And if there is, what commands should I use?

  8. #7
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Boot up from LiveCD of any Linux distro and mount /dev/sdb1 and sdb2 partitions. Check if postgresql db is intact in sdb2 and data of /home is all fine in /dev/sdb1.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  9. #8
    Just Joined!
    Join Date
    Sep 2011
    Posts
    4
    ok, thanks guys very much, I'll try it.

  10. #9
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2
    mount your sdb2 partition on another mount point like /mnt/postgresql-lib
    and create a softlink postgresql in /var/lib to /mnt/postgresql-lib

    check your mount has the appropriate security authorisation to work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •