4 TB external disk on Centos 5

0

I have an old server running CentOS 5(Kernel 2.6.18-92.el5). It is running a legacy application so I can't retire it yet. I had connected a 2 TB USB disk to it to take backups and the disk is almost full right now.

I bought a new 4 TB disk but the OS only detects it as 2TB. I know fdisk doesn't support partitions above 2TB but I have no luck with parted either.

Any workarounds to get the OS to read full space of 4 TB?

From dmesg:

usb-storage: device found at 15
usb-storage: waiting for device to settle before scanning
  Vendor: Seagate   Model: Backup+  Desk     Rev: 040B
  Type:   Direct-Access                      ANSI SCSI revision: 06
sdc: Spinning up disk....ready
sdc : very big device. try to use READ CAPACITY(16).
sdc : READ CAPACITY(16) failed.
sdc : status=0, message=00, host=5, driver=00 
sdc : use 0xffffffff as device size
SCSI device sdc: 4294967296 512-byte hdwr sectors (2199023 MB)

parted /dev/sdc print

Model: Seagate Backup+ Desk (scsi)
Disk /dev/sdc: 2199GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  2100GB  2100GB               primary       

Information: Don't forget to update /etc/fstab, if necessary.
partition
centos5
fdisk
parted
asked on Server Fault Aug 23, 2016 by Debianuser

2 Answers

0

Make sure you use the ext3 filesystem or something that supports above 2TB.

Instructions for creating a larger than 2TB partition (GPT) with parted:

https://sakafi.wordpress.com/2008/08/23/how-to-use-parted-for-creating-patition-larger-that-2-tb/

Copy of site in case it disappears:

To create partitions larger than 2TB we need to use GPT labels. Standard fdisk doesn’t understand GPT labels so we need to use parted.

Here we are going to partition the disk /dev/sdb

root@localhost ~> parted /dev/sdb

This will bring up parted.  Type help to view the commands in parted prompt.

(parted) help
check NUMBER                             do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition
help [COMMAND]                           prints general help, or help on COMMAND
mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on partititon NUMBER
mkpart PART-TYPE [FS-TYPE] START END     make a partition
mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system
move NUMBER START END                    move partition NUMBER
name NUMBER NAME                         name partition NUMBER as NAME
print [free|NUMBER|all]                  display the partition table, a partition, or all devices
quit                                     exit program
rescue START END                         rescue a lost partition near START and END
resize NUMBER START END                  resize partition NUMBER and its file system
rm NUMBER                                delete partition NUMBER
select DEVICE                            choose the device to edit
set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
unit UNIT                                set the default unit to UNIT
version                                  displays the current version of GNU Parted and copyright information

root@localhost ~> parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)

To change the label to gpt we run the following command:

(parted) mklabel gpt

Next run the print command: This will list the disk geometry. Please note the size listed:

(parted) print

Model: Adaptec raid5-1 (scsi)
Disk /dev/sdb: 10.7TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
This will tell us where to start and end the partitions. To create one huge partition ( 8 Tb = 8388608 bytes) run the following commands:

(parted) mkpart primary 0 8388607.000

The command reads as make a primary partition, start at 0 and end at 8388607.000

Also, if you are making a partition for a device smaller than the limit from the notes below, you can use the following if the geometry doesn’t show like it does above. Just exit out of parted, and run this from a shell:

root@localhost ~> parted -s — /dev/sdb  mkpart primary ext3 0 -1

This will take the whole disk for creating the partition.

The parition has been created and now you can quit parted:
(parted) quit

Now all that has to be done is to format the partition:(the -m swith tells mkfs to only reserve 1% of the blocks for the super block)

root@localhost ~> mkfs.ext3 -m1 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1024000000 inodes, 2047999751 blocks
20479997 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
62500 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mount the disk

root@localhost ~> mount /dev/sdb1 /disk1

root@localhost ~> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             240G  2.3G  225G   2% /
/dev/sda1             996M   45M  900M   5% /boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/sdb1             7.6T  177M  7.5T   1% /disk1
answered on Server Fault Aug 23, 2016 by Ryan Babchishin
0

Looks like I need at least 2.6.32 kernel to support larger disks. I server currently has 2.6.18-92.el5: https://unix.stackexchange.com/questions/150699/harddisk-not-recognized-filesystem-too-large-to-mount-safely-on-this-system

Older Linux Kernel version (all 2.4 and pre‐2.6.32) computing environments with a legacy BIOS and MBR partition table scheme encounter a barrier at 2.19 TB because they can address only up to 232 logical blocks. Be sure to use kernels that contain support for drives greater than 2.19TB. The kernels released after April 2010 have support for large capacity drives using 4096 sector sizes.

answered on Server Fault Aug 25, 2016 by Debianuser • edited Apr 13, 2017 by Community

User contributions licensed under CC BY-SA 3.0