Page 1 of 4 123 ... LastLast
Results 1 to 10 of 38

Thread: Adding new HDDs to Ubuntu Server

  1. #1
    Join Date
    Dec 2013
    Location
    UK
    Beans
    107
    Distro
    Ubuntu 14.04 Trusty Tahr

    Adding new HDDs to Ubuntu Server

    Hi all,

    I've given this my best shot with my limited Ubuntu know-how.. and I'm pretty sure I'm close, but need a little help..

    I'm adding 2x sata 4TB Western Digital Red drives to my Ubuntu server.

    I formatted them using a desktop Ubuntu machine to ext4 using GParted and a USB adaptor. I've just installed them into my server, and edited fstab.

    I've already pre-loaded files to them, so would rather not have to reformat again now they are installed... but if it comes to it, then so be it.

    I think there is an issue with partition tables, either I've told fstab the wrong type of table, or I've formatted them with the wrong type of table, I used GPT based on the advice of a website I read for guidance when formatting.

    The two new drives appear as dev/sdc and dev/sdd. I'd have expected them to be sdc1 and sdd1, but the 1's are missing.

    fdisk -l returns this result:

    Code:
    scott@6FC:/etc$ sudo fdisk -l
    
    Disk /dev/sda: 120.0 GB, 120034123776 bytes
    255 heads, 63 sectors/track, 14593 cylinders, total 234441648 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: 0x000c769e
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048      499711      248832   83  Linux
    /dev/sda2          501758   234440703   116969473    5  Extended
    /dev/sda5          501760   234440703   116969472   8e  Linux LVM
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdc: 2199.0 GB, 2199023255040 bytes
    255 heads, 63 sectors/track, 267349 cylinders, total 4294967295 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/sdc1               1  4294967295  2147483647+  ee  GPT
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdd'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdd: 2199.0 GB, 2199023255040 bytes
    255 heads, 63 sectors/track, 267349 cylinders, total 4294967295 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/sdd1               1  4294967295  2147483647+  ee  GPT
    
    Disk /dev/sdb: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x000d7be2
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048   976773119   488385536   83  Linux
    
    Disk /dev/mapper/6FC--vg-root: 113.3 GB, 113330094080 bytes
    255 heads, 63 sectors/track, 13778 cylinders, total 221347840 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
    
    Disk /dev/mapper/6FC--vg-root doesn't contain a valid partition table
    
    Disk /dev/mapper/6FC--vg-swap_1: 6442 MB, 6442450944 bytes
    255 heads, 63 sectors/track, 783 cylinders, total 12582912 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
    
    Disk /dev/mapper/6FC--vg-swap_1 doesn't contain a valid partition table
    scott@6FC:/etc$
    My fstab looks like this, I'm trying to mount one drive in /media/family, and the other in /media/media. I just copied the formatting of the line above for sdb1 as that drive works, I dont know what defaults and 0 or 2 mean.

    Code:
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' 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>
    /dev/mapper/6FC--vg-root /               ext4    errors=remount-ro 0       1
    # /boot was on /dev/sda1 during installation
    UUID=442ef4fd-bc9b-4e17-825e-27f5e7a1414d /boot           ext2    defaults        0       2
    #/dev/mapper/6FC--vg-swap_1 none            swap    sw              0       0
    /dev/mapper/cryptswap1 none swap sw 0 0
    /dev/sdb1/    /media/storage    ext4    defaults    0    2
    /dev/sdc/    /media/family    ext4    defaults    0    2
    /dev/sdd/    /media/media    ext4    defaults    0    2
    /media/storage/images /usr/share/zoneminder/images none defaults,bind 0 2
    /media/storage/events /usr/share/zoneminder/events none defaults,bind 0 2
    //192.168.1.75/volume_1 /mnt/nas cifs guest,uid=1000,iocharset=utf8    0    0
    Above, I’ve highlighted my attempts at changing fstab..

    mount -a returns this result:

    Code:
    scott@6FC:/etc$ sudo mount -a
    mount: wrong fs type, bad option, bad superblock on /dev/sdc,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so
    
    mount: wrong fs type, bad option, bad superblock on /dev/sdd,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so
    
    scott@6FC:/etc$
    Many thanks for any tips as to what I've done wrong, Scott
    Last edited by scott.bouch; August 6th, 2015 at 10:52 PM.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Adding new HDDs to Ubuntu Server

    sda .... sdz are disks.
    sda1.....99 are partitions.

    GPT is applied to the "disk". Then partitions are created. parted or gparted are used for this part.

    mkfs is applied to the "partition." gparted can do this, if you elect NOT to use LVM. On a server, using LVM is much, much, much more flexible. LVM has pv, vg, and lv parts. LVs relate to "partitions".

    So - that error make me think you didn't create the file system on sdX1 .... Did you?

    Remember, that Linux/Unix will let an administrator do whatever they say, even if it is wrong. Could it be that you put the file system onto the disk without the partitioning?

    Also - mounting things under /media is a really bad idea. That is where the OS puts things that are automatically mounted. For mounts that you cause, it is smarter to put those **anywhere** except /media.

    These lines all look wrong to me.
    Code:
    /dev/sdb1/    /media/storage    ext4    defaults    0    2
    /dev/sdc/    /media/family    ext4    defaults    0    2
    /dev/sdd/    /media/media    ext4    defaults    0    2
    Can't fix sdc or sdd - but perhaps you should use UUIDs - device names like sda, sdb, sdc .... change from time to time. That is why we use UUIDs and LABELs these days inside our fstabs.
    Code:
    /dev/sdb1   /media/storage    ext4    defaults    0    2
    Notice how I removed the trailing slash. I would also create the mount point (that is just an empty directory) somewhere outside /media.

    Use the sudo blkid command to get the UUID for each partition/device. https://help.ubuntu.com/community/UsingUUID has more details.

  3. #3
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Adding new HDDs to Ubuntu Server

    Quote Originally Posted by scott.bouch View Post
    Hi all,

    I've given this my best shot with my limited Ubuntu know-how.. and I'm pretty sure I'm close, but need a little help..

    I'm adding 2x sata 4TB Western Digital Red drives to my Ubuntu server.

    I formatted them using a desktop Ubuntu machine to ext4 using GParted and a USB adaptor. I've just installed them into my server, and edited fstab.

    I've already pre-loaded files to them, so would rather not have to reformat again now they are installed... but if it comes to it, then so be it.

    I think there is an issue with partition tables, either I've told fstab the wrong type of table, or I've formatted them with the wrong type of table, I used GPT based on the advice of a website I read for guidance when formatting.

    The two new drives appear as dev/sdc and dev/sdd. I'd have expected them to be sdc1 and sdd1, but the 1's are missing.

    fdisk -l returns this result:

    Code:
    scott@6FC:/etc$ sudo fdisk -l
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    Disk /dev/sdc: 2199.0 GB, 2199023255040 bytes
    255 heads, 63 sectors/track, 267349 cylinders, total 4294967295 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/sdc1               1  4294967295  2147483647+  ee  GPT
    
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdd'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    Disk /dev/sdd: 2199.0 GB, 2199023255040 bytes
    255 heads, 63 sectors/track, 267349 cylinders, total 4294967295 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/sdd1               1  4294967295  2147483647+  ee  GPT
    
    You shouldn't use fdisk on partitions larger then 2TB (see the warnings in red). The proper tool is parted from the CLI or gparted with the GUI. None the less the partitions you formatted are there in blue.

    Code:
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' 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>
    /dev/mapper/6FC--vg-root /               ext4    errors=remount-ro 0       1
    # /boot was on /dev/sda1 during installation
    UUID=442ef4fd-bc9b-4e17-825e-27f5e7a1414d /boot           ext2    defaults        0       2
    #/dev/mapper/6FC--vg-swap_1 none            swap    sw              0       0
    /dev/mapper/cryptswap1 none swap sw 0 0
    /dev/sdb1/    /media/storage    ext4    defaults    0    2
    /dev/sdc/    /media/family    ext4    defaults    0    2
    /dev/sdd/    /media/media    ext4    defaults    0    2
    /media/storage/images /usr/share/zoneminder/images none defaults,bind 0 2
    /media/storage/events /usr/share/zoneminder/events none defaults,bind 0 2
    //192.168.1.75/volume_1 /mnt/nas cifs guest,uid=1000,iocharset=utf8    0    0
    My (above) fstab looks like this, I'm trying to mount one drive in /media/family, and the other in /media/media. I just copied the formatting of the line above for sdb1 as that drive works, I dont know what defaults and 0 or 2 mean.
    Above, I’ve highlighted my attempts at changing fstab.
    You should follow the advice above (in red) and use the UUID to mount sdb1, sdc1 and sdd1. This means you need to find what the are the UUID's Post the output of this command from the CLI so we can advise you specifically
    Code:
    sudo blkid -c /dev/null -o list
    The proper format for the fstab file should be
    Code:
    UUID=<some long number> <mountpoint> <file system type> <dump?> <fsck?>
    All of the fields used in the fstab are explained in the man pages
    Code:
    man fstab
    The number two means that this is a partition that should be checked with fsck after the root file system is checked.
    Last edited by bab1; August 7th, 2015 at 12:46 AM.
    -BAB1

  4. #4
    Join Date
    Dec 2013
    Location
    UK
    Beans
    107
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Adding new HDDs to Ubuntu Server

    Thank you guys for all your help, It's a big learning curve!

    Ok, so blkid returned this result, the two new drives don't appear:

    Code:
    scott@6FC:~$ sudo blkid -c /dev/null -o list
    [sudo] password for scott: 
    no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory
    device                          fs_type      label         mount point                         UUID
    -----------------------------------------------------------------------------------------------------------------------------------
    /dev/sda1                       ext2                       /boot                               442ef4fd-bc9b-4e17-825e-27f5e7a1414d
    /dev/sda5                       LVM2_member                (in use)                            cP6I40-148L-tXrh-w2bm-R1UT-YqLb-OZMHNQ
    /dev/sdb1                       ext4         Storage       /media/storage                      1ecfb548-c745-49f5-b143-37965eea3fe9
    /dev/mapper/6FC--vg-root        ext4                       /                                   7e34d6d4-0fa1-4ce3-9964-9e61b61fe322
    scott@6FC:~$
    I can see the logic in using the UUID instead of sdxx for mounting, as I guess the UUID is the physical drive serial number, or generated from it?

    Also, now you mention it, I added a partition table when I formatted them, but forgot to add a partition... oops.. I didn't notice, as my desktop machine just treated it as a removable USB drive, and allowed me to add files. Root did claim ownership, which I had to adjust to me to allow the saving of files.

    Is there an easy way to create a partition, and move my data into it? Or am I best to just start all over again?

    Once sorted, I'll try mounting to my mnt directory instead of media, and also will use UUID's instead. I may also move the storage directory to mnt too (and use UUID), as I put that in media about a year ago. This is what I get for "just having a go" - but you've got to learn somehow!

    A project for this weekend...

    Many thanks, Scott.
    Last edited by scott.bouch; August 7th, 2015 at 11:51 AM.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Adding new HDDs to Ubuntu Server

    UUID is connected to partitions or LVs (logical volumes) too.

    Remember when I said that Unix lets you do what you want, even when it is not normal? You've seen that. For disks in a RAID set, it is common not to bother with partitioning.

    Root always gets ownership of new partitions, new file systems. That is normal.

    I would start over. Also, since you are already using LVM, you might want to add these new disks to the existing VG. It really comes down to how you backup the new storage. I like to limit my partition sizes to whatever my backup storage can handle. With LVM, I only expand available storage when needed.

    A little history of mount points:
    * /media is used by the OS for automatic mounting of external storage
    * /mnt is used by root for temporary storage - basically a place to connect partitions before they are ready for public use
    * /export is used for NFS mounts in many organizations - /export/home is commonly used for HOMEs that are available across many different systems. Each userid has 1 HOME, but it is mounted on every system they have a login on.

    You can mount new partitions/LVs anywhere, onto any directory. Why not take advantage of that? Of course, you can mount storage on directory structures that are full too - most people thing of this as a mistake because any files below that point cannot be accessed anymore, but it does work. I use /D/.... as a place to add extra static storage and /misc/... for automounted, on-demand, storage (like for media files).

    You should do what makes sense for you. Don't worry about the way I do it or anyone else does it, provided you have a reason for doing it the way you decide and it doesn't conflict with other parts of the system.

  6. #6
    Join Date
    Dec 2013
    Location
    UK
    Beans
    107
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Adding new HDDs to Ubuntu Server

    Hi TheFu,

    Thanks for your kind words on the matter..

    I'm intent on keeping these as two separate 4TB drives, one for family stuff (photo albums, etc..), the other for media (music / films etc,..) not raiding them togehter..

    However, this does bring me to another point... I'll have a NAS box (2 bay of max 2TB each) which I intend to use to take nightly backups of the family drive. If I configure it in raid 0 to make 4TB, this will be adequate for my family drive backups using one of the utilities listed here: https://help.ubuntu.com/community/BackupYourSystem - Do you have any advice on achieving this?

    I have two reasons for wanting to use the NAS as a backup of the family stuff, rather than raid 1-ing the two new drives:

    - I can keep it in a separate location to the server so that there's more chance of recovering data after a house fire / flood.
    - I'd rather not have the NAS running all the time, to save power, and prolong the life of the drives... the NAS has as setting to go into standby mode a few minutes after the last use.

    I'll get the drives out of the server tonight and re-format them. I'll make sure I can mount them properly first this time before filling them with data!

    If I can mount them anywhere, I think I'll just place them (all three) in the root directory as /family, /media and /storage (renamed to cctv) reason being to just keep life simple. unless there is an issue with creating folders in the root directory?

    Thanks, Scott.

  7. #7
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Adding new HDDs to Ubuntu Server

    You can't use /media. That is already taken and a "special directory" as discussed above.

    Do not use RAID0. That is a fast way to lost all the data on both disks. RAID0 should be used only by people with extreme performance needs for temporary storage only. Think video editors. Most of those guys have switched to SSDs and run those in RAID0 to get even more performance for the file they are actively working on. For you and I with spinning disks, RAID0 is a bad idea. If 1 disk in the set fails - all the data is gone on both. Sweet! NOT!

    Rather than RAID, LVM is a viable alternative to merge disks - just be certain that you can backup at the partition level. That is key.

    Power needs for a NAS are minimal. Spinning down and up the disk will cause more wear and tear on the drives than anything else. Those RED drives are designed to spin 24/7/365 for 5+ yrs. Let them do that. Watch the temperatures so they don't over heat. The only drives that I allow to spin down are in a laptop. You can control spin down settings with hdparm.

    Backups ... I've answered that question 20 times in these forums. Search a little. i find the suggestions on that linked page to be simplistic and next to useless. Sorry. I use rsync for media backups (as needed, usually weekly) and rdiff-backup for all others which happen nightly, automatically.

    Of course there are other opinions about this stuff. I just know what works for me and that with 6 systems running 24/7 here the last 15 yrs, our power bill hasn't changed much. I have been actively retiring 125W systems for 45W systems the last few years and never had a 165W AMD monster. Down to 2 power sucking systems, but those run 10+ VMs each. Most of the time, they use less even with 6 disks and the connected external disk arrays.

  8. #8
    Join Date
    Dec 2013
    Location
    UK
    Beans
    107
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Adding new HDDs to Ubuntu Server

    Oh, sorry, thanks for pointing out about /media... I'll think of a batter name.

    Here is my idea on the backups.. I find it much easier to share ideas like this using a diagram, saves ideas getting mixed up.

    I'm only concerned with backing up the Family drive... media, and operating system can be replaced easily. CCTV footage of next doors cat is no great loss either.

    SB-storage-idea-1.jpg

    Main reason to have the NAS drives in RAID 0 is to make it up to 4TB to match the family drive capacity.. The box is limited to 2x 2TB.

    Interesting to learn that the drives fail quicker due to cycles, so I'd have more reliability if I didn't use power-saving on the NAS and kept the disks spinning.

    Thanks, Scott.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Adding new HDDs to Ubuntu Server

    Split the 4TB drive in half match your backup storage.

    DO NOT USE RAID0.

    There are many ways you can "merge" data on multiple partitions, when you get there. Or you can just use symlinks. The key is to have a way to backup your data and not get screwed over something foolish like RAID0.

  10. #10
    Join Date
    Dec 2013
    Location
    UK
    Beans
    107
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Adding new HDDs to Ubuntu Server

    Or idea #2 would suit the NAS drives being always on..

    SB-storage-idea-2.jpg

    - NAS drives in raid 0 to make single 4TB volume.
    - Family drive of server, and NAS volume in raid 1 together, if possible to raid over a network.

    If a house fire takes out either the server or the NAS, our family photos are safe.

    Cheers, Scott

    Ok, back to the drive issue..

    I've just formatted the family drive again, (last time I did actually create a partition on it, but reformatted it anyway). I formatted it on my desktop machine, and found out it's UUID.

    I've now put it back in the server, edited fstab to use the UUID instead, and mount it to newly created directory /family:

    Code:
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' 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>
    /dev/mapper/6FC--vg-root /               ext4    errors=remount-ro 0       1
    # /boot was on /dev/sda1 during installation
    UUID=442ef4fd-bc9b-4e17-825e-27f5e7a1414d /boot           ext2    defaults        0       2
    #/dev/mapper/6FC--vg-swap_1 none            swap    sw              0       0
    /dev/mapper/cryptswap1 none swap sw 0 0
    /dev/sdb1/      /media/storage  ext4    defaults        0       2
    UUID=ee009e34-d4b6-4c80-b129-af727c607e5b       /family ext4    defaults        0       2
    
    /media/storage/images /usr/share/zoneminder/images none defaults,bind 0 2
    /media/storage/events /usr/share/zoneminder/events none defaults,bind 0 2
    //192.168.1.75/volume_1 /mnt/nas cifs guest,uid=1000,iocharset=utf8     0       0

    Running mount -a returns:
    Code:
    scott@6FC:/$ sudo mount -a
    mount: special device UUID=ee009e34-d4b6-4c80-b129-af727c607e5b does not exist

    So then checking with blkid does not show the drives UUID at all:
    Code:
    scott@6FC:/$ sudo blkid -c /dev/null -o list
    device                          fs_type      label         mount point                         UUID
    -----------------------------------------------------------------------------------------------------------------------------------
    /dev/sda1                       ext2                       /boot                               442ef4fd-bc9b-4e17-825e-27f5e7a1414d
    /dev/sda5                       LVM2_member                (in use)                            cP6I40-148L-tXrh-w2bm-R1UT-YqLb-OZMHNQ
    /dev/sdb1                       ext4         Storage       /media/storage                      1ecfb548-c745-49f5-b143-37965eea3fe9
    /dev/mapper/6FC--vg-root        ext4                       /                                   7e34d6d4-0fa1-4ce3-9964-9e61b61fe322
    Cheers, Scott.
    Last edited by howefield; August 12th, 2015 at 01:18 PM.

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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